diff options
| author | beck <> | 1999-09-29 04:37:45 +0000 |
|---|---|---|
| committer | beck <> | 1999-09-29 04:37:45 +0000 |
| commit | de8f24ea083384bb66b32ec105dc4743c5663cdf (patch) | |
| tree | 1412176ae62a3cab2cf2b0b92150fcbceaac6092 /src/lib/libcrypto/sha/shatest.c | |
| parent | cb929d29896bcb87c2a97417fbd03e50078fc178 (diff) | |
| download | openbsd-de8f24ea083384bb66b32ec105dc4743c5663cdf.tar.gz openbsd-de8f24ea083384bb66b32ec105dc4743c5663cdf.tar.bz2 openbsd-de8f24ea083384bb66b32ec105dc4743c5663cdf.zip | |
OpenSSL 0.9.4 merge
Diffstat (limited to '')
| -rw-r--r-- | src/lib/libcrypto/sha/shatest.c | 35 |
1 files changed, 24 insertions, 11 deletions
diff --git a/src/lib/libcrypto/sha/shatest.c b/src/lib/libcrypto/sha/shatest.c index 03816e9b39..2b0744d937 100644 --- a/src/lib/libcrypto/sha/shatest.c +++ b/src/lib/libcrypto/sha/shatest.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 "sha.h" | 62 | |
| 63 | #ifdef NO_SHA | ||
| 64 | int main(int argc, char *argv[]) | ||
| 65 | { | ||
| 66 | printf("No SHA support\n"); | ||
| 67 | return(0); | ||
| 68 | } | ||
| 69 | #else | ||
| 70 | #include <openssl/sha.h> | ||
| 71 | |||
| 72 | #ifdef CHARSET_EBCDIC | ||
| 73 | #include <openssl/ebcdic.h> | ||
| 74 | #endif | ||
| 63 | 75 | ||
| 64 | #define SHA_0 /* FIPS 180 */ | 76 | #define SHA_0 /* FIPS 180 */ |
| 65 | #undef SHA_1 /* FIPS 180-1 */ | 77 | #undef SHA_1 /* FIPS 180-1 */ |
| @@ -87,15 +99,8 @@ char *bigret= | |||
| 87 | "34aa973cd4c4daa4f61eeb2bdbad27316534016f"; | 99 | "34aa973cd4c4daa4f61eeb2bdbad27316534016f"; |
| 88 | #endif | 100 | #endif |
| 89 | 101 | ||
| 90 | #ifndef NOPROTO | ||
| 91 | static char *pt(unsigned char *md); | 102 | static char *pt(unsigned char *md); |
| 92 | #else | 103 | int main(int argc, char *argv[]) |
| 93 | static char *pt(); | ||
| 94 | #endif | ||
| 95 | |||
| 96 | int main(argc,argv) | ||
| 97 | int argc; | ||
| 98 | char *argv[]; | ||
| 99 | { | 104 | { |
| 100 | int i,err=0; | 105 | int i,err=0; |
| 101 | unsigned char **P,**R; | 106 | unsigned char **P,**R; |
| @@ -104,6 +109,11 @@ char *argv[]; | |||
| 104 | SHA_CTX c; | 109 | SHA_CTX c; |
| 105 | unsigned char md[SHA_DIGEST_LENGTH]; | 110 | unsigned char md[SHA_DIGEST_LENGTH]; |
| 106 | 111 | ||
| 112 | #ifdef CHARSET_EBCDIC | ||
| 113 | ebcdic2ascii(test[0], test[0], strlen(test[0])); | ||
| 114 | ebcdic2ascii(test[1], test[1], strlen(test[1])); | ||
| 115 | #endif | ||
| 116 | |||
| 107 | P=(unsigned char **)test; | 117 | P=(unsigned char **)test; |
| 108 | R=(unsigned char **)ret; | 118 | R=(unsigned char **)ret; |
| 109 | i=1; | 119 | i=1; |
| @@ -124,6 +134,9 @@ char *argv[]; | |||
| 124 | } | 134 | } |
| 125 | 135 | ||
| 126 | memset(buf,'a',1000); | 136 | memset(buf,'a',1000); |
| 137 | #ifdef CHARSET_EBCDIC | ||
| 138 | ebcdic2ascii(buf, buf, 1000); | ||
| 139 | #endif /*CHARSET_EBCDIC*/ | ||
| 127 | SHA_Init(&c); | 140 | SHA_Init(&c); |
| 128 | for (i=0; i<1000; i++) | 141 | for (i=0; i<1000; i++) |
| 129 | SHA_Update(&c,buf,1000); | 142 | SHA_Update(&c,buf,1000); |
| @@ -143,8 +156,7 @@ char *argv[]; | |||
| 143 | return(0); | 156 | return(0); |
| 144 | } | 157 | } |
| 145 | 158 | ||
| 146 | static char *pt(md) | 159 | static char *pt(unsigned char *md) |
| 147 | unsigned char *md; | ||
| 148 | { | 160 | { |
| 149 | int i; | 161 | int i; |
| 150 | static char buf[80]; | 162 | static char buf[80]; |
| @@ -153,3 +165,4 @@ unsigned char *md; | |||
| 153 | sprintf(&(buf[i*2]),"%02x",md[i]); | 165 | sprintf(&(buf[i*2]),"%02x",md[i]); |
| 154 | return(buf); | 166 | return(buf); |
| 155 | } | 167 | } |
| 168 | #endif | ||
