projects
/
oweals
/
openssl.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
aes-586.pl from HEAD.
[oweals/openssl.git]
/
crypto
/
md5
/
md5_one.c
diff --git
a/crypto/md5/md5_one.c
b/crypto/md5/md5_one.c
index c98721f4d8d4222edfaacd1443e5148a2f3e9e2e..43fee89379634a4658887f2cc4e4abecebd22ac9 100644
(file)
--- a/
crypto/md5/md5_one.c
+++ b/
crypto/md5/md5_one.c
@@
-59,17
+59,39
@@
#include <stdio.h>
#include <string.h>
#include <openssl/md5.h>
#include <stdio.h>
#include <string.h>
#include <openssl/md5.h>
+#include <openssl/crypto.h>
-unsigned char *MD5(unsigned char *d, unsigned long n, unsigned char *md)
+#ifdef CHARSET_EBCDIC
+#include <openssl/ebcdic.h>
+#endif
+
+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_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);
MD5_Update(&c,d,n);
+#else
+ {
+ char temp[1024];
+ unsigned long chunk;
+
+ while (n > 0)
+ {
+ chunk = (n > sizeof(temp)) ? sizeof(temp) : n;
+ ebcdic2ascii(temp, d, chunk);
+ MD5_Update(&c,temp,chunk);
+ n -= chunk;
+ d += chunk;
+ }
+ }
+#endif
MD5_Final(md,&c);
MD5_Final(md,&c);
-
memset(&c,0
,sizeof(c)); /* security consideration */
+
OPENSSL_cleanse(&c
,sizeof(c)); /* security consideration */
return(md);
}
return(md);
}