Mercurial > dropbear
diff sha1.c @ 143:5d99163f7e32 libtomcrypt-orig
import of libtomcrypt 0.99
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Sun, 19 Dec 2004 11:34:45 +0000 |
parents | 6362d3854bb4 |
children | c2b93763dac9 |
line wrap: on
line diff
--- a/sha1.c Tue Jun 15 14:07:21 2004 +0000 +++ b/sha1.c Sun Dec 19 11:34:45 2004 +0000 @@ -38,9 +38,9 @@ #define F3(x,y,z) (x ^ y ^ z) #ifdef CLEAN_STACK -static void _sha1_compress(hash_state *md, unsigned char *buf) +static int _sha1_compress(hash_state *md, unsigned char *buf) #else -static void sha1_compress(hash_state *md, unsigned char *buf) +static int sha1_compress(hash_state *md, unsigned char *buf) #endif { ulong32 a,b,c,d,e,W[80],i; @@ -139,17 +139,21 @@ md->sha1.state[2] = md->sha1.state[2] + c; md->sha1.state[3] = md->sha1.state[3] + d; md->sha1.state[4] = md->sha1.state[4] + e; + + return CRYPT_OK; } #ifdef CLEAN_STACK -static void sha1_compress(hash_state *md, unsigned char *buf) +static int sha1_compress(hash_state *md, unsigned char *buf) { - _sha1_compress(md, buf); + int err; + err = _sha1_compress(md, buf); burn_stack(sizeof(ulong32) * 87); + return err; } #endif -void sha1_init(hash_state * md) +int sha1_init(hash_state * md) { _ARGCHK(md != NULL); md->sha1.state[0] = 0x67452301UL; @@ -159,6 +163,7 @@ md->sha1.state[4] = 0xc3d2e1f0UL; md->sha1.curlen = 0; md->sha1.length = 0; + return CRYPT_OK; } HASH_PROCESS(sha1_process, sha1_compress, sha1, 64)