Return an error if no recipient type matches.
[openssl.git] / crypto / md2 / md2test.c
index 461d124..db5f5bc 100644 (file)
 #include <stdlib.h>
 #include <string.h>
 
-#ifdef NO_MD2
+#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
 
-char *test[]={
+static char *test[]={
        "",
        "a",
        "abc",
@@ -84,7 +87,7 @@ char *test[]={
        NULL,
        };
 
-char *ret[]={
+static char *ret[]={
        "8350e5a3e24c153df2275c9f80692773",
        "32ec01ec4a6dac72c0ab96fb34c0b5d1",
        "da853b0d3f88d99b30283a69e6ded6bb",
@@ -100,13 +103,15 @@ 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);
@@ -119,8 +124,11 @@ int main(int argc, 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(unsigned char *md)