mirror of
https://github.com/openssl/openssl.git
synced 2024-11-24 18:43:34 +08:00
Check return values of <Digest>_Init functions in low level digest calls.
This commit is contained in:
parent
2b85e23d2e
commit
fbe6ba81e9
@ -69,7 +69,8 @@ unsigned char *MD2(const unsigned char *d, size_t n, unsigned char *md)
|
||||
static unsigned char m[MD2_DIGEST_LENGTH];
|
||||
|
||||
if (md == NULL) md=m;
|
||||
MD2_Init(&c);
|
||||
if (!MD2_Init(&c))
|
||||
return NULL;
|
||||
#ifndef CHARSET_EBCDIC
|
||||
MD2_Update(&c,d,n);
|
||||
#else
|
||||
|
@ -71,7 +71,8 @@ unsigned char *MD4(const unsigned char *d, size_t n, unsigned char *md)
|
||||
static unsigned char m[MD4_DIGEST_LENGTH];
|
||||
|
||||
if (md == NULL) md=m;
|
||||
MD4_Init(&c);
|
||||
if (!MD4_Init(&c))
|
||||
return NULL;
|
||||
#ifndef CHARSET_EBCDIC
|
||||
MD4_Update(&c,d,n);
|
||||
#else
|
||||
|
@ -71,7 +71,8 @@ unsigned char *MD5(const unsigned char *d, size_t n, unsigned char *md)
|
||||
static unsigned char m[MD5_DIGEST_LENGTH];
|
||||
|
||||
if (md == NULL) md=m;
|
||||
MD5_Init(&c);
|
||||
if (!MD5_Init(&c))
|
||||
return NULL;
|
||||
#ifndef CHARSET_EBCDIC
|
||||
MD5_Update(&c,d,n);
|
||||
#else
|
||||
|
@ -66,7 +66,8 @@ unsigned char *MDC2(const unsigned char *d, size_t n, unsigned char *md)
|
||||
static unsigned char m[MDC2_DIGEST_LENGTH];
|
||||
|
||||
if (md == NULL) md=m;
|
||||
MDC2_Init(&c);
|
||||
if (!MDC2_Init(&c))
|
||||
return NULL;
|
||||
MDC2_Update(&c,d,n);
|
||||
MDC2_Final(md,&c);
|
||||
OPENSSL_cleanse(&c,sizeof(c)); /* security consideration */
|
||||
|
@ -68,7 +68,8 @@ unsigned char *RIPEMD160(const unsigned char *d, size_t n,
|
||||
static unsigned char m[RIPEMD160_DIGEST_LENGTH];
|
||||
|
||||
if (md == NULL) md=m;
|
||||
RIPEMD160_Init(&c);
|
||||
if (!RIPEMD160_Init(&c))
|
||||
return NULL;
|
||||
RIPEMD160_Update(&c,d,n);
|
||||
RIPEMD160_Final(md,&c);
|
||||
OPENSSL_cleanse(&c,sizeof(c)); /* security consideration */
|
||||
|
@ -68,7 +68,8 @@ unsigned char *SHA1(const unsigned char *d, size_t n, unsigned char *md)
|
||||
static unsigned char m[SHA_DIGEST_LENGTH];
|
||||
|
||||
if (md == NULL) md=m;
|
||||
SHA1_Init(&c);
|
||||
if (!SHA1_Init(&c))
|
||||
return NULL;
|
||||
SHA1_Update(&c,d,n);
|
||||
SHA1_Final(md,&c);
|
||||
OPENSSL_cleanse(&c,sizeof(c));
|
||||
|
@ -68,7 +68,8 @@ unsigned char *SHA(const unsigned char *d, size_t n, unsigned char *md)
|
||||
static unsigned char m[SHA_DIGEST_LENGTH];
|
||||
|
||||
if (md == NULL) md=m;
|
||||
SHA_Init(&c);
|
||||
if (!SHA_Init(&c))
|
||||
return NULL;
|
||||
SHA_Update(&c,d,n);
|
||||
SHA_Final(md,&c);
|
||||
OPENSSL_cleanse(&c,sizeof(c));
|
||||
|
Loading…
Reference in New Issue
Block a user