diff options
Diffstat (limited to '')
| -rw-r--r-- | src/lib/libcrypto/hmac/hmactest.c | 37 |
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 | ||
| 64 | struct test_st | 63 | #ifdef OPENSSL_NO_HMAC |
| 64 | int 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 | |||
| 77 | static 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 | ||
| 106 | static char *pt(unsigned char *md); | 118 | static char *pt(unsigned char *md); |
| 107 | #else | 119 | int main(int argc, char *argv[]) |
| 108 | static char *pt(); | ||
| 109 | #endif | ||
| 110 | |||
| 111 | int main(argc,argv) | ||
| 112 | int argc; | ||
| 113 | char *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 | ||
| 138 | static char *pt(md) | 151 | static char *pt(unsigned char *md) |
| 139 | unsigned 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 | ||
