adjusted file dependant functions
when LTC_NO_FILE is defined, the functions hash_filehandle() and hash_file() won't be available at all instead of returning CRYPT_NOP
This commit is contained in:
parent
6816ac3f3f
commit
0a432b6b08
@ -10,6 +10,7 @@
|
||||
*/
|
||||
#include "tomcrypt.h"
|
||||
|
||||
#ifndef LTC_NO_FILE
|
||||
/**
|
||||
@file hash_file.c
|
||||
Hash a file, Tom St Denis
|
||||
@ -24,9 +25,6 @@
|
||||
*/
|
||||
int hash_file(int hash, const char *fname, unsigned char *out, unsigned long *outlen)
|
||||
{
|
||||
#ifdef LTC_NO_FILE
|
||||
return CRYPT_NOP;
|
||||
#else
|
||||
FILE *in;
|
||||
int err;
|
||||
LTC_ARGCHK(fname != NULL);
|
||||
@ -48,8 +46,8 @@ int hash_file(int hash, const char *fname, unsigned char *out, unsigned long *ou
|
||||
}
|
||||
|
||||
return err;
|
||||
#endif
|
||||
}
|
||||
#endif /* #ifndef LTC_NO_FILE */
|
||||
|
||||
|
||||
/* $Source$ */
|
||||
|
@ -10,6 +10,7 @@
|
||||
*/
|
||||
#include "tomcrypt.h"
|
||||
|
||||
#ifndef LTC_NO_FILE
|
||||
/**
|
||||
@file hash_filehandle.c
|
||||
Hash open files, Tom St Denis
|
||||
@ -25,9 +26,6 @@
|
||||
*/
|
||||
int hash_filehandle(int hash, FILE *in, unsigned char *out, unsigned long *outlen)
|
||||
{
|
||||
#ifdef LTC_NO_FILE
|
||||
return CRYPT_NOP;
|
||||
#else
|
||||
hash_state md;
|
||||
unsigned char buf[512];
|
||||
size_t x;
|
||||
@ -62,8 +60,8 @@ int hash_filehandle(int hash, FILE *in, unsigned char *out, unsigned long *outle
|
||||
zeromem(buf, sizeof(buf));
|
||||
#endif
|
||||
return err;
|
||||
#endif
|
||||
}
|
||||
#endif /* #ifndef LTC_NO_FILE */
|
||||
|
||||
|
||||
/* $Source$ */
|
||||
|
@ -334,8 +334,11 @@ int hash_memory(int hash,
|
||||
unsigned char *out, unsigned long *outlen);
|
||||
int hash_memory_multi(int hash, unsigned char *out, unsigned long *outlen,
|
||||
const unsigned char *in, unsigned long inlen, ...);
|
||||
|
||||
#ifndef LTC_NO_FILE
|
||||
int hash_filehandle(int hash, FILE *in, unsigned char *out, unsigned long *outlen);
|
||||
int hash_file(int hash, const char *fname, unsigned char *out, unsigned long *outlen);
|
||||
#endif
|
||||
|
||||
/* a simple macro for making hash "process" functions */
|
||||
#define HASH_PROCESS(func_name, compress_name, state_var, block_size) \
|
||||
|
Loading…
Reference in New Issue
Block a user