summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/hmac/hmactest.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/hmac/hmactest.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/hmac/hmactest.c')
-rw-r--r--src/lib/libcrypto/hmac/hmactest.c37
1 files changed, 25 insertions, 12 deletions
diff --git a/src/lib/libcrypto/hmac/hmactest.c b/src/lib/libcrypto/hmac/hmactest.c
index 5938e375dc..96d3beb8e6 100644
--- a/src/lib/libcrypto/hmac/hmactest.c
+++ b/src/lib/libcrypto/hmac/hmactest.c
@@ -59,9 +59,22 @@
59#include <stdio.h> 59#include <stdio.h>
60#include <string.h> 60#include <string.h>
61#include <stdlib.h> 61#include <stdlib.h>
62#include "hmac.h"
63 62
64struct test_st 63#ifdef OPENSSL_NO_HMAC
64int main(int argc, char *argv[])
65{
66 printf("No HMAC support\n");
67 return(0);
68}
69#else
70#include <openssl/hmac.h>
71#include <openssl/md5.h>
72
73#ifdef CHARSET_EBCDIC
74#include <openssl/ebcdic.h>
75#endif
76
77static struct test_st
65 { 78 {
66 unsigned char key[16]; 79 unsigned char key[16];
67 int key_len; 80 int key_len;
@@ -102,19 +115,19 @@ struct test_st
102 }; 115 };
103 116
104 117
105#ifndef NOPROTO
106static char *pt(unsigned char *md); 118static char *pt(unsigned char *md);
107#else 119int main(int argc, char *argv[])
108static char *pt();
109#endif
110
111int main(argc,argv)
112int argc;
113char *argv[];
114 { 120 {
115 int i,err=0; 121 int i,err=0;
116 char *p; 122 char *p;
117 123
124#ifdef CHARSET_EBCDIC
125 ebcdic2ascii(test[0].data, test[0].data, test[0].data_len);
126 ebcdic2ascii(test[1].data, test[1].data, test[1].data_len);
127 ebcdic2ascii(test[2].key, test[2].key, test[2].key_len);
128 ebcdic2ascii(test[2].data, test[2].data, test[2].data_len);
129#endif
130
118 for (i=0; i<4; i++) 131 for (i=0; i<4; i++)
119 { 132 {
120 p=pt(HMAC(EVP_md5(), 133 p=pt(HMAC(EVP_md5(),
@@ -135,8 +148,7 @@ char *argv[];
135 return(0); 148 return(0);
136 } 149 }
137 150
138static char *pt(md) 151static char *pt(unsigned char *md)
139unsigned char *md;
140 { 152 {
141 int i; 153 int i;
142 static char buf[80]; 154 static char buf[80];
@@ -145,3 +157,4 @@ unsigned char *md;
145 sprintf(&(buf[i*2]),"%02x",md[i]); 157 sprintf(&(buf[i*2]),"%02x",md[i]);
146 return(buf); 158 return(buf);
147 } 159 }
160#endif