comparison libtomcrypt/src/hashes/helper/hash_file.c @ 1471:6dba84798cd5

Update to libtomcrypt 1.18.1, merged with Dropbear changes
author Matt Johnston <matt@ucc.asn.au>
date Fri, 09 Feb 2018 21:44:05 +0800
parents f849a5ca2efc
children 1ff2a1034c52
comparison
equal deleted inserted replaced
1470:8bba51a55704 1471:6dba84798cd5
3 * LibTomCrypt is a library that provides various cryptographic 3 * LibTomCrypt is a library that provides various cryptographic
4 * algorithms in a highly modular and flexible manner. 4 * algorithms in a highly modular and flexible manner.
5 * 5 *
6 * The library is free for all purposes without any express 6 * The library is free for all purposes without any express
7 * guarantee it works. 7 * guarantee it works.
8 *
9 * Tom St Denis, [email protected], http://libtom.org
10 */ 8 */
11 #include "tomcrypt.h" 9 #include "tomcrypt.h"
12 10
11 #ifndef LTC_NO_FILE
13 /** 12 /**
14 @file hash_file.c 13 @file hash_file.c
15 Hash a file, Tom St Denis 14 Hash a file, Tom St Denis
16 */ 15 */
17 16
22 @param outlen [in/out] The max size and resulting size of the message digest 21 @param outlen [in/out] The max size and resulting size of the message digest
23 @result CRYPT_OK if successful 22 @result CRYPT_OK if successful
24 */ 23 */
25 int hash_file(int hash, const char *fname, unsigned char *out, unsigned long *outlen) 24 int hash_file(int hash, const char *fname, unsigned char *out, unsigned long *outlen)
26 { 25 {
27 #ifdef LTC_NO_FILE
28 (void)hash; (void)fname; (void)out; (void)outlen;
29 return CRYPT_NOP;
30 #else
31 FILE *in; 26 FILE *in;
32 int err; 27 int err;
33 LTC_ARGCHK(fname != NULL); 28 LTC_ARGCHK(fname != NULL);
34 LTC_ARGCHK(out != NULL); 29 LTC_ARGCHK(out != NULL);
35 LTC_ARGCHK(outlen != NULL); 30 LTC_ARGCHK(outlen != NULL);
47 if (fclose(in) != 0) { 42 if (fclose(in) != 0) {
48 return CRYPT_ERROR; 43 return CRYPT_ERROR;
49 } 44 }
50 45
51 return err; 46 return err;
52 #endif
53 } 47 }
48 #endif /* #ifndef LTC_NO_FILE */
54 49
55 50
56 /* $Source$ */ 51 /* ref: $Format:%D$ */
57 /* $Revision$ */ 52 /* git commit: $Format:%H$ */
58 /* $Date$ */ 53 /* commit time: $Format:%ai$ */