summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/hmac/hmactest.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/hmac/hmactest.c')
-rw-r--r--src/lib/libcrypto/hmac/hmactest.c34
1 files changed, 23 insertions, 11 deletions
diff --git a/src/lib/libcrypto/hmac/hmactest.c b/src/lib/libcrypto/hmac/hmactest.c
index 5938e375dc..9a67dff36a 100644
--- a/src/lib/libcrypto/hmac/hmactest.c
+++ b/src/lib/libcrypto/hmac/hmactest.c
@@ -59,7 +59,19 @@
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" 62
63#ifdef 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
72#ifdef CHARSET_EBCDIC
73#include <openssl/ebcdic.h>
74#endif
63 75
64struct test_st 76struct test_st
65 { 77 {
@@ -102,19 +114,19 @@ struct test_st
102 }; 114 };
103 115
104 116
105#ifndef NOPROTO
106static char *pt(unsigned char *md); 117static char *pt(unsigned char *md);
107#else 118int main(int argc, char *argv[])
108static char *pt();
109#endif
110
111int main(argc,argv)
112int argc;
113char *argv[];
114 { 119 {
115 int i,err=0; 120 int i,err=0;
116 char *p; 121 char *p;
117 122
123#ifdef CHARSET_EBCDIC
124 ebcdic2ascii(test[0].data, test[0].data, test[0].data_len);
125 ebcdic2ascii(test[1].data, test[1].data, test[1].data_len);
126 ebcdic2ascii(test[2].key, test[2].key, test[2].key_len);
127 ebcdic2ascii(test[2].data, test[2].data, test[2].data_len);
128#endif
129
118 for (i=0; i<4; i++) 130 for (i=0; i<4; i++)
119 { 131 {
120 p=pt(HMAC(EVP_md5(), 132 p=pt(HMAC(EVP_md5(),
@@ -135,8 +147,7 @@ char *argv[];
135 return(0); 147 return(0);
136 } 148 }
137 149
138static char *pt(md) 150static char *pt(unsigned char *md)
139unsigned char *md;
140 { 151 {
141 int i; 152 int i;
142 static char buf[80]; 153 static char buf[80];
@@ -145,3 +156,4 @@ unsigned char *md;
145 sprintf(&(buf[i*2]),"%02x",md[i]); 156 sprintf(&(buf[i*2]),"%02x",md[i]);
146 return(buf); 157 return(buf);
147 } 158 }
159#endif