X-Git-Url: https://git.openssl.org/gitweb/?p=openssl.git;a=blobdiff_plain;f=crypto%2Fmd5%2Fmd5_one.c;h=43fee89379634a4658887f2cc4e4abecebd22ac9;hp=b89dec850d2d5b20ed511227cac38a986b2380cd;hb=9c4fe782607d8542c5f55ef1b5c687fef1da5d75;hpb=9dbc41d7eed7d69da54dc81082794845c50ad482 diff --git a/crypto/md5/md5_one.c b/crypto/md5/md5_one.c index b89dec850d..43fee89379 100644 --- a/crypto/md5/md5_one.c +++ b/crypto/md5/md5_one.c @@ -59,18 +59,20 @@ #include #include #include +#include #ifdef CHARSET_EBCDIC #include #endif -unsigned char *MD5(const unsigned char *d, unsigned long n, unsigned char *md) +unsigned char *MD5(const unsigned char *d, size_t n, unsigned char *md) { MD5_CTX c; 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 @@ -89,7 +91,7 @@ unsigned char *MD5(const unsigned char *d, unsigned long n, unsigned char *md) } #endif MD5_Final(md,&c); - memset(&c,0,sizeof(c)); /* security consideration */ + OPENSSL_cleanse(&c,sizeof(c)); /* security consideration */ return(md); }