WCE update, mostly typos.
[openssl.git] / crypto / md2 / md2test.c
index 55924d44cd5782aa741e6d4ed2eb967e25649189..db5f5bc6d20e6adda0b496f2320f747b9956b498 100644 (file)
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include "md2.h"
 
-char *test[]={
+#include "../e_os.h"
+
+#ifdef OPENSSL_NO_MD2
+int main(int argc, char *argv[])
+{
+    printf("No MD2 support\n");
+    return(0);
+}
+#else
+#include <openssl/evp.h>
+#include <openssl/md2.h>
+
+#ifdef CHARSET_EBCDIC
+#include <openssl/ebcdic.h>
+#endif
+
+static char *test[]={
        "",
        "a",
        "abc",
@@ -72,7 +87,7 @@ char *test[]={
        NULL,
        };
 
-char *ret[]={
+static char *ret[]={
        "8350e5a3e24c153df2275c9f80692773",
        "32ec01ec4a6dac72c0ab96fb34c0b5d1",
        "da853b0d3f88d99b30283a69e6ded6bb",
@@ -82,26 +97,21 @@ char *ret[]={
        "d5976f79d83d3a0dc9806c3c66f3efd8",
        };
 
-#ifndef NOPROTO
 static char *pt(unsigned char *md);
-#else
-static char *pt();
-#endif
-
-int main(argc,argv)
-int argc;
-char *argv[];
+int main(int argc, char *argv[])
        {
        int i,err=0;
        char **P,**R;
        char *p;
+       unsigned char md[MD2_DIGEST_LENGTH];
 
        P=test;
        R=ret;
        i=1;
        while (*P != NULL)
                {
-               p=pt(MD2((unsigned char *)*P,(unsigned long)strlen(*P),NULL));
+               EVP_Digest((unsigned char *)*P,strlen(*P),md,NULL,EVP_md2(), NULL);
+               p=pt(md);
                if (strcmp(p,*R) != 0)
                        {
                        printf("error calculating MD2 on '%s'\n",*P);
@@ -114,12 +124,14 @@ char *argv[];
                R++;
                P++;
                }
-       exit(err);
-       return(0);
+#ifdef OPENSSL_SYS_NETWARE
+    if (err) printf("ERROR: %d\n", err);
+#endif
+       EXIT(err);
+       return err;
        }
 
-static char *pt(md)
-unsigned char *md;
+static char *pt(unsigned char *md)
        {
        int i;
        static char buf[80];
@@ -128,3 +140,4 @@ unsigned char *md;
                sprintf(&(buf[i*2]),"%02x",md[i]);
        return(buf);
        }
+#endif