summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/md2/md2test.c
diff options
context:
space:
mode:
authormarkus <>2002-09-05 12:51:52 +0000
committermarkus <>2002-09-05 12:51:52 +0000
commit5514995a9d5ed91db089875adb509c7781357c0e (patch)
tree2484410a46ba6c05ef94c253da36fbceef990b64 /src/lib/libcrypto/md2/md2test.c
parentfd9566423b542798f5c8b06e68101a9ea5bb9885 (diff)
downloadopenbsd-5514995a9d5ed91db089875adb509c7781357c0e.tar.gz
openbsd-5514995a9d5ed91db089875adb509c7781357c0e.tar.bz2
openbsd-5514995a9d5ed91db089875adb509c7781357c0e.zip
import openssl-0.9.7-beta1
Diffstat (limited to 'src/lib/libcrypto/md2/md2test.c')
-rw-r--r--src/lib/libcrypto/md2/md2test.c36
1 files changed, 22 insertions, 14 deletions
diff --git a/src/lib/libcrypto/md2/md2test.c b/src/lib/libcrypto/md2/md2test.c
index 55924d44cd..7d3664faf5 100644
--- a/src/lib/libcrypto/md2/md2test.c
+++ b/src/lib/libcrypto/md2/md2test.c
@@ -59,9 +59,22 @@
59#include <stdio.h> 59#include <stdio.h>
60#include <stdlib.h> 60#include <stdlib.h>
61#include <string.h> 61#include <string.h>
62#include "md2.h" 62#include <openssl/md2.h>
63 63
64char *test[]={ 64#ifdef OPENSSL_NO_MD2
65int main(int argc, char *argv[])
66{
67 printf("No MD2 support\n");
68 return(0);
69}
70#else
71#include <openssl/evp.h>
72
73#ifdef CHARSET_EBCDIC
74#include <openssl/ebcdic.h>
75#endif
76
77static char *test[]={
65 "", 78 "",
66 "a", 79 "a",
67 "abc", 80 "abc",
@@ -72,7 +85,7 @@ char *test[]={
72 NULL, 85 NULL,
73 }; 86 };
74 87
75char *ret[]={ 88static char *ret[]={
76 "8350e5a3e24c153df2275c9f80692773", 89 "8350e5a3e24c153df2275c9f80692773",
77 "32ec01ec4a6dac72c0ab96fb34c0b5d1", 90 "32ec01ec4a6dac72c0ab96fb34c0b5d1",
78 "da853b0d3f88d99b30283a69e6ded6bb", 91 "da853b0d3f88d99b30283a69e6ded6bb",
@@ -82,26 +95,21 @@ char *ret[]={
82 "d5976f79d83d3a0dc9806c3c66f3efd8", 95 "d5976f79d83d3a0dc9806c3c66f3efd8",
83 }; 96 };
84 97
85#ifndef NOPROTO
86static char *pt(unsigned char *md); 98static char *pt(unsigned char *md);
87#else 99int main(int argc, char *argv[])
88static char *pt();
89#endif
90
91int main(argc,argv)
92int argc;
93char *argv[];
94 { 100 {
95 int i,err=0; 101 int i,err=0;
96 char **P,**R; 102 char **P,**R;
97 char *p; 103 char *p;
104 unsigned char md[MD2_DIGEST_LENGTH];
98 105
99 P=test; 106 P=test;
100 R=ret; 107 R=ret;
101 i=1; 108 i=1;
102 while (*P != NULL) 109 while (*P != NULL)
103 { 110 {
104 p=pt(MD2((unsigned char *)*P,(unsigned long)strlen(*P),NULL)); 111 EVP_Digest((unsigned char *)*P,(unsigned long)strlen(*P),md,NULL,EVP_md2(), NULL);
112 p=pt(md);
105 if (strcmp(p,*R) != 0) 113 if (strcmp(p,*R) != 0)
106 { 114 {
107 printf("error calculating MD2 on '%s'\n",*P); 115 printf("error calculating MD2 on '%s'\n",*P);
@@ -118,8 +126,7 @@ char *argv[];
118 return(0); 126 return(0);
119 } 127 }
120 128
121static char *pt(md) 129static char *pt(unsigned char *md)
122unsigned char *md;
123 { 130 {
124 int i; 131 int i;
125 static char buf[80]; 132 static char buf[80];
@@ -128,3 +135,4 @@ unsigned char *md;
128 sprintf(&(buf[i*2]),"%02x",md[i]); 135 sprintf(&(buf[i*2]),"%02x",md[i]);
129 return(buf); 136 return(buf);
130 } 137 }
138#endif