improve make dclean to remove files generated during build
[openssl.git] / crypto / md4 / md4_one.c
index 87a995d38d434f68ff3bb6056d887abe6f03880b..bb6436263818aa49e08dfb8f02a2cd206654c8e0 100644 (file)
 #include <stdio.h>
 #include <string.h>
 #include <openssl/md4.h>
+#include <openssl/crypto.h>
 
 #ifdef CHARSET_EBCDIC
 #include <openssl/ebcdic.h>
 #endif
 
-unsigned char *MD4(const unsigned char *d, unsigned long n, unsigned char *md)
+unsigned char *MD4(const unsigned char *d, size_t n, unsigned char *md)
        {
        MD4_CTX c;
        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
@@ -89,7 +91,7 @@ unsigned char *MD4(const unsigned char *d, unsigned long n, unsigned char *md)
        }
 #endif
        MD4_Final(md,&c);
-       memset(&c,0,sizeof(c)); /* security consideration */
+       OPENSSL_cleanse(&c,sizeof(c)); /* security consideration */
        return(md);
        }