diff --git a/src/hashes/helper/hash_file.c b/src/hashes/helper/hash_file.c index c9714a0..4c184d8 100644 --- a/src/hashes/helper/hash_file.c +++ b/src/hashes/helper/hash_file.c @@ -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$ */ diff --git a/src/hashes/helper/hash_filehandle.c b/src/hashes/helper/hash_filehandle.c index 3eb6f0c..6a6052f 100644 --- a/src/hashes/helper/hash_filehandle.c +++ b/src/hashes/helper/hash_filehandle.c @@ -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$ */ diff --git a/src/headers/tomcrypt_hash.h b/src/headers/tomcrypt_hash.h index 56b272a..a29a69f 100644 --- a/src/headers/tomcrypt_hash.h +++ b/src/headers/tomcrypt_hash.h @@ -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) \