diff options
Diffstat (limited to 'src/lib/libcrypto/md5/md5_one.c')
| -rw-r--r-- | src/lib/libcrypto/md5/md5_one.c | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/src/lib/libcrypto/md5/md5_one.c b/src/lib/libcrypto/md5/md5_one.c index ab6bb435f9..b89dec850d 100644 --- a/src/lib/libcrypto/md5/md5_one.c +++ b/src/lib/libcrypto/md5/md5_one.c | |||
| @@ -57,19 +57,37 @@ | |||
| 57 | */ | 57 | */ |
| 58 | 58 | ||
| 59 | #include <stdio.h> | 59 | #include <stdio.h> |
| 60 | #include "md5_locl.h" | 60 | #include <string.h> |
| 61 | #include <openssl/md5.h> | ||
| 61 | 62 | ||
| 62 | unsigned char *MD5(d, n, md) | 63 | #ifdef CHARSET_EBCDIC |
| 63 | unsigned char *d; | 64 | #include <openssl/ebcdic.h> |
| 64 | unsigned long n; | 65 | #endif |
| 65 | unsigned char *md; | 66 | |
| 67 | unsigned char *MD5(const unsigned char *d, unsigned long n, unsigned char *md) | ||
| 66 | { | 68 | { |
| 67 | MD5_CTX c; | 69 | MD5_CTX c; |
| 68 | static unsigned char m[MD5_DIGEST_LENGTH]; | 70 | static unsigned char m[MD5_DIGEST_LENGTH]; |
| 69 | 71 | ||
| 70 | if (md == NULL) md=m; | 72 | if (md == NULL) md=m; |
| 71 | MD5_Init(&c); | 73 | MD5_Init(&c); |
| 74 | #ifndef CHARSET_EBCDIC | ||
| 72 | MD5_Update(&c,d,n); | 75 | MD5_Update(&c,d,n); |
| 76 | #else | ||
| 77 | { | ||
| 78 | char temp[1024]; | ||
| 79 | unsigned long chunk; | ||
| 80 | |||
| 81 | while (n > 0) | ||
| 82 | { | ||
| 83 | chunk = (n > sizeof(temp)) ? sizeof(temp) : n; | ||
| 84 | ebcdic2ascii(temp, d, chunk); | ||
| 85 | MD5_Update(&c,temp,chunk); | ||
| 86 | n -= chunk; | ||
| 87 | d += chunk; | ||
| 88 | } | ||
| 89 | } | ||
| 90 | #endif | ||
| 73 | MD5_Final(md,&c); | 91 | MD5_Final(md,&c); |
| 74 | memset(&c,0,sizeof(c)); /* security consideration */ | 92 | memset(&c,0,sizeof(c)); /* security consideration */ |
| 75 | return(md); | 93 | return(md); |
