diff options
author | Andy Polyakov <appro@openssl.org> | 2005-11-30 20:53:14 +0000 |
---|---|---|
committer | Andy Polyakov <appro@openssl.org> | 2005-11-30 20:53:14 +0000 |
commit | 137db78b46347614d7c5d6f2ff8a092faf70ac70 (patch) | |
tree | 1cd18b7240c9c30b38b4917f2fb6e63fc610c8f5 /crypto | |
parent | a3344c8e5edbf8560143ac456d55efd109938000 (diff) |
Adapt Whirlpool API for EVP.
Diffstat (limited to 'crypto')
-rw-r--r-- | crypto/whrlpool/whrlpool.h | 6 | ||||
-rw-r--r-- | crypto/whrlpool/wp_dgst.c | 20 |
2 files changed, 18 insertions, 8 deletions
diff --git a/crypto/whrlpool/whrlpool.h b/crypto/whrlpool/whrlpool.h index bf9d7f5f0c..03c91da115 100644 --- a/crypto/whrlpool/whrlpool.h +++ b/crypto/whrlpool/whrlpool.h @@ -24,10 +24,10 @@ typedef struct { } WHIRLPOOL_CTX; #ifndef OPENSSL_NO_WHIRLPOOL -void WHIRLPOOL_Init (WHIRLPOOL_CTX *c); -void WHIRLPOOL_Update (WHIRLPOOL_CTX *c,const void *inp,size_t bytes); +int WHIRLPOOL_Init (WHIRLPOOL_CTX *c); +int WHIRLPOOL_Update (WHIRLPOOL_CTX *c,const void *inp,size_t bytes); void WHIRLPOOL_BitUpdate(WHIRLPOOL_CTX *c,const void *inp,size_t bits); -void WHIRLPOOL_Final (unsigned char *md,WHIRLPOOL_CTX *c); +int WHIRLPOOL_Final (unsigned char *md,WHIRLPOOL_CTX *c); unsigned char *WHIRLPOOL(const void *inp,size_t bytes,unsigned char *md); #endif diff --git a/crypto/whrlpool/wp_dgst.c b/crypto/whrlpool/wp_dgst.c index 1d33eb658c..7aa4bebe2e 100644 --- a/crypto/whrlpool/wp_dgst.c +++ b/crypto/whrlpool/wp_dgst.c @@ -54,9 +54,13 @@ #include "wp_locl.h" #include <string.h> -void WHIRLPOOL_Init (WHIRLPOOL_CTX *c) { memset (c,0,sizeof(*c)); } +int WHIRLPOOL_Init (WHIRLPOOL_CTX *c) + { + memset (c,0,sizeof(*c)); + return(1); + } -void WHIRLPOOL_Update (WHIRLPOOL_CTX *c,const void *_inp,size_t bytes) +int WHIRLPOOL_Update (WHIRLPOOL_CTX *c,const void *_inp,size_t bytes) { /* Well, largest suitable chunk size actually is * (1<<(sizeof(size_t)*8-3))-64, but below number @@ -73,6 +77,8 @@ void WHIRLPOOL_Update (WHIRLPOOL_CTX *c,const void *_inp,size_t bytes) } if (bytes) WHIRLPOOL_BitUpdate(c,inp,bytes*8); + + return(1); } void WHIRLPOOL_BitUpdate(WHIRLPOOL_CTX *c,const void *_inp,size_t bits) @@ -206,7 +212,7 @@ void WHIRLPOOL_BitUpdate(WHIRLPOOL_CTX *c,const void *_inp,size_t bits) } } -void WHIRLPOOL_Final (unsigned char *md,WHIRLPOOL_CTX *c) +int WHIRLPOOL_Final (unsigned char *md,WHIRLPOOL_CTX *c) { unsigned int bitoff = c->bitoff, byteoff = bitoff/8; @@ -238,8 +244,12 @@ void WHIRLPOOL_Final (unsigned char *md,WHIRLPOOL_CTX *c) whirlpool_block(c,c->data,1); - memcpy(md,c->H.c,WHIRLPOOL_DIGEST_LENGTH); - memset(c,0,sizeof(*c)); + if (md) { + memcpy(md,c->H.c,WHIRLPOOL_DIGEST_LENGTH); + memset(c,0,sizeof(*c)); + return(1); + } + return(0); } unsigned char *WHIRLPOOL(const void *inp, size_t bytes,unsigned char *md) |