summaryrefslogtreecommitdiffstats
path: root/crypto/md5
diff options
context:
space:
mode:
authorUlf Möller <ulf@openssl.org>1999-06-04 21:35:58 +0000
committerUlf Möller <ulf@openssl.org>1999-06-04 21:35:58 +0000
commita53955d8abd68c604de02cc1e101c66169207fb7 (patch)
treee51051484f2b073f7b58a1549442bf0657ca2978 /crypto/md5
parent9231f4779677a3cb95a4f8ccebd56432cb914498 (diff)
Support the EBCDIC character set and BS2000/OSD-POSIX (work in progress).
Submitted by: Martin Kraemer <Martin.Kraemer@MchP.Siemens.De>
Diffstat (limited to 'crypto/md5')
-rw-r--r--crypto/md5/md5.c3
-rw-r--r--crypto/md5/md5_one.c20
2 files changed, 23 insertions, 0 deletions
diff --git a/crypto/md5/md5.c b/crypto/md5/md5.c
index ef65a1d72f..7ed0024ae1 100644
--- a/crypto/md5/md5.c
+++ b/crypto/md5/md5.c
@@ -64,7 +64,10 @@
void do_fp(FILE *f);
void pt(unsigned char *md);
+#ifndef _OSD_POSIX
int read(int, void *, unsigned int);
+#endif
+
int main(int argc, char **argv)
{
int i,err=0;
diff --git a/crypto/md5/md5_one.c b/crypto/md5/md5_one.c
index c98721f4d8..4b10e7f940 100644
--- a/crypto/md5/md5_one.c
+++ b/crypto/md5/md5_one.c
@@ -60,6 +60,10 @@
#include <string.h>
#include <openssl/md5.h>
+#ifdef CHARSET_EBCDIC
+#include <openssl/ebcdic.h>
+#endif
+
unsigned char *MD5(unsigned char *d, unsigned long n, unsigned char *md)
{
MD5_CTX c;
@@ -67,7 +71,23 @@ unsigned char *MD5(unsigned char *d, unsigned long n, unsigned char *md)
if (md == NULL) md=m;
MD5_Init(&c);
+#ifndef CHARSET_EBCDIC
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);
memset(&c,0,sizeof(c)); /* security consideration */
return(md);