comparison libtomcrypt/src/hashes/helper/hash_filehandle.c @ 1710:1ff2a1034c52

Fix whitespace changes vs upstream libtomcrypt
author Matt Johnston <matt@ucc.asn.au>
date Wed, 10 Jun 2020 23:01:33 +0800
parents 6dba84798cd5
children
comparison
equal deleted inserted replaced
1709:04155ce30759 1710:1ff2a1034c52
12 /** 12 /**
13 @file hash_filehandle.c 13 @file hash_filehandle.c
14 Hash open files, Tom St Denis 14 Hash open files, Tom St Denis
15 */ 15 */
16 16
17 /** 17 /**
18 Hash data from an open file handle. 18 Hash data from an open file handle.
19 @param hash The index of the hash you want to use 19 @param hash The index of the hash you want to use
20 @param in The FILE* handle of the file you want to hash 20 @param in The FILE* handle of the file you want to hash
21 @param out [out] The destination of the digest 21 @param out [out] The destination of the digest
22 @param outlen [in/out] The max size and resulting size of the digest 22 @param outlen [in/out] The max size and resulting size of the digest
23 @result CRYPT_OK if successful 23 @result CRYPT_OK if successful
24 */ 24 */
25 int hash_filehandle(int hash, FILE *in, unsigned char *out, unsigned long *outlen) 25 int hash_filehandle(int hash, FILE *in, unsigned char *out, unsigned long *outlen)
26 { 26 {
27 hash_state md; 27 hash_state md;
28 unsigned char *buf; 28 unsigned char *buf;
55 if ((err = hash_descriptor[hash].process(&md, buf, (unsigned long)x)) != CRYPT_OK) { 55 if ((err = hash_descriptor[hash].process(&md, buf, (unsigned long)x)) != CRYPT_OK) {
56 goto LBL_CLEANBUF; 56 goto LBL_CLEANBUF;
57 } 57 }
58 } while (x == LTC_FILE_READ_BUFSIZE); 58 } while (x == LTC_FILE_READ_BUFSIZE);
59 if ((err = hash_descriptor[hash].done(&md, out)) == CRYPT_OK) { 59 if ((err = hash_descriptor[hash].done(&md, out)) == CRYPT_OK) {
60 *outlen = hash_descriptor[hash].hashsize; 60 *outlen = hash_descriptor[hash].hashsize;
61 } 61 }
62 62
63 LBL_CLEANBUF: 63 LBL_CLEANBUF:
64 zeromem(buf, LTC_FILE_READ_BUFSIZE); 64 zeromem(buf, LTC_FILE_READ_BUFSIZE);
65 LBL_ERR: 65 LBL_ERR:
66 XFREE(buf); 66 XFREE(buf);