add ssl_locl.h to err header files, rebuild ssl error strings
[openssl.git] / crypto / md2 / md2_one.c
index b12c37ce4def4e1a538b7bca74ef7cac8ce7b8e3..f7fef5cc0a739fc57a899a3e464edcce2f46ccc3 100644 (file)
 /* This is a separate file so that #defines in cryptlib.h can
  * map my MD functions to different names */
 
-unsigned char *MD2(const unsigned char *d, unsigned long n, unsigned char *md)
+unsigned char *MD2(const unsigned char *d, size_t n, unsigned char *md)
        {
        MD2_CTX c;
        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
@@ -88,6 +89,6 @@ unsigned char *MD2(const unsigned char *d, unsigned long n, unsigned char *md)
        }
 #endif
        MD2_Final(md,&c);
-       memset(&c,0,sizeof(c)); /* Security consideration */
+       OPENSSL_cleanse(&c,sizeof(c));  /* Security consideration */
        return(md);
        }