X-Git-Url: https://git.openssl.org/gitweb/?p=openssl.git;a=blobdiff_plain;f=crypto%2Fmd5%2Fmd5_one.c;h=43fee89379634a4658887f2cc4e4abecebd22ac9;hp=4b10e7f9402acc0d8d38bd3bedd0d25f7f5bdc44;hb=9c4fe782607d8542c5f55ef1b5c687fef1da5d75;hpb=a53955d8abd68c604de02cc1e101c66169207fb7 diff --git a/crypto/md5/md5_one.c b/crypto/md5/md5_one.c index 4b10e7f940..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(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(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); }