summaryrefslogtreecommitdiffstats
path: root/crypto/md2
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/md2
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/md2')
-rw-r--r--crypto/md2/md2_one.c16
-rw-r--r--crypto/md2/md2test.c4
2 files changed, 20 insertions, 0 deletions
diff --git a/crypto/md2/md2_one.c b/crypto/md2/md2_one.c
index 17b288bad8..7157299d95 100644
--- a/crypto/md2/md2_one.c
+++ b/crypto/md2/md2_one.c
@@ -70,7 +70,23 @@ unsigned char *MD2(unsigned char *d, unsigned long n, unsigned char *md)
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);
diff --git a/crypto/md2/md2test.c b/crypto/md2/md2test.c
index 63404b1833..461d124957 100644
--- a/crypto/md2/md2test.c
+++ b/crypto/md2/md2test.c
@@ -69,6 +69,10 @@ int main(int argc, char *argv[])
#else
#include <openssl/md2.h>
+#ifdef CHARSET_EBCDIC
+#include <openssl/ebcdic.h>
+#endif
+
char *test[]={
"",
"a",