X-Git-Url: https://git.openssl.org/gitweb/?p=openssl.git;a=blobdiff_plain;f=crypto%2Fmd2%2Fmd2_one.c;h=b12c37ce4def4e1a538b7bca74ef7cac8ce7b8e3;hp=17b288bad82357221383c0d238ef4a1e1e4aa867;hb=2dc769a1c17e1e0c7aef6e11496c8ba2c1db2e28;hpb=ec577822f95a8bca0023c5c77cef1a4916822d4a diff --git a/crypto/md2/md2_one.c b/crypto/md2/md2_one.c index 17b288bad8..b12c37ce4d 100644 --- a/crypto/md2/md2_one.c +++ b/crypto/md2/md2_one.c @@ -63,14 +63,30 @@ /* This is a separate file so that #defines in cryptlib.h can * map my MD functions to different names */ -unsigned char *MD2(unsigned char *d, unsigned long n, unsigned char *md) +unsigned char *MD2(const unsigned char *d, unsigned long n, unsigned char *md) { MD2_CTX c; static unsigned char m[MD2_DIGEST_LENGTH]; if (md == NULL) md=m; MD2_Init(&c); +#ifndef CHARSET_EBCDIC MD2_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); + MD2_Update(&c,temp,chunk); + n -= chunk; + d += chunk; + } + } +#endif MD2_Final(md,&c); memset(&c,0,sizeof(c)); /* Security consideration */ return(md);