diff options
Diffstat (limited to '')
| -rw-r--r-- | src/lib/libcrypto/ripemd/asm/rips.cpp | 8 | ||||
| -rw-r--r-- | src/lib/libcrypto/ripemd/rmd160.c | 18 | ||||
| -rw-r--r-- | src/lib/libcrypto/ripemd/rmdtest.c | 40 |
3 files changed, 36 insertions, 30 deletions
diff --git a/src/lib/libcrypto/ripemd/asm/rips.cpp b/src/lib/libcrypto/ripemd/asm/rips.cpp index 78a933c448..f7a13677a9 100644 --- a/src/lib/libcrypto/ripemd/asm/rips.cpp +++ b/src/lib/libcrypto/ripemd/asm/rips.cpp | |||
| @@ -32,7 +32,9 @@ void GetTSC(unsigned long& tsc) | |||
| 32 | 32 | ||
| 33 | #include <stdio.h> | 33 | #include <stdio.h> |
| 34 | #include <stdlib.h> | 34 | #include <stdlib.h> |
| 35 | #include "ripemd.h" | 35 | #include <openssl/ripemd.h> |
| 36 | |||
| 37 | #define ripemd160_block_x86 ripemd160_block_asm_host_order | ||
| 36 | 38 | ||
| 37 | extern "C" { | 39 | extern "C" { |
| 38 | void ripemd160_block_x86(RIPEMD160_CTX *ctx, unsigned char *buffer,int num); | 40 | void ripemd160_block_x86(RIPEMD160_CTX *ctx, unsigned char *buffer,int num); |
| @@ -55,8 +57,10 @@ void main(int argc,char *argv[]) | |||
| 55 | if (num == 0) num=16; | 57 | if (num == 0) num=16; |
| 56 | if (num > 250) num=16; | 58 | if (num > 250) num=16; |
| 57 | numm=num+2; | 59 | numm=num+2; |
| 60 | #if 0 | ||
| 58 | num*=64; | 61 | num*=64; |
| 59 | numm*=64; | 62 | numm*=64; |
| 63 | #endif | ||
| 60 | 64 | ||
| 61 | for (j=0; j<6; j++) | 65 | for (j=0; j<6; j++) |
| 62 | { | 66 | { |
| @@ -71,7 +75,7 @@ void main(int argc,char *argv[]) | |||
| 71 | GetTSC(e2); | 75 | GetTSC(e2); |
| 72 | ripemd160_block_x86(&ctx,buffer,num); | 76 | ripemd160_block_x86(&ctx,buffer,num); |
| 73 | } | 77 | } |
| 74 | printf("ripemd160 (%d bytes) %d %d (%.2f)\n",num, | 78 | printf("ripemd160 (%d bytes) %d %d (%.2f)\n",num*64, |
| 75 | e1-s1,e2-s2,(double)((e1-s1)-(e2-s2))/2); | 79 | e1-s1,e2-s2,(double)((e1-s1)-(e2-s2))/2); |
| 76 | } | 80 | } |
| 77 | } | 81 | } |
diff --git a/src/lib/libcrypto/ripemd/rmd160.c b/src/lib/libcrypto/ripemd/rmd160.c index 3fa1b8096e..4f8b88a18a 100644 --- a/src/lib/libcrypto/ripemd/rmd160.c +++ b/src/lib/libcrypto/ripemd/rmd160.c | |||
| @@ -58,23 +58,17 @@ | |||
| 58 | 58 | ||
| 59 | #include <stdio.h> | 59 | #include <stdio.h> |
| 60 | #include <stdlib.h> | 60 | #include <stdlib.h> |
| 61 | #include "ripemd.h" | 61 | #include <openssl/ripemd.h> |
| 62 | 62 | ||
| 63 | #define BUFSIZE 1024*16 | 63 | #define BUFSIZE 1024*16 |
| 64 | 64 | ||
| 65 | #ifndef NOPROTO | ||
| 66 | void do_fp(FILE *f); | 65 | void do_fp(FILE *f); |
| 67 | void pt(unsigned char *md); | 66 | void pt(unsigned char *md); |
| 67 | #ifndef _OSD_POSIX | ||
| 68 | int read(int, void *, unsigned int); | 68 | int read(int, void *, unsigned int); |
| 69 | #else | ||
| 70 | void do_fp(); | ||
| 71 | void pt(); | ||
| 72 | int read(); | ||
| 73 | #endif | 69 | #endif |
| 74 | 70 | ||
| 75 | int main(argc, argv) | 71 | int main(int argc, char **argv) |
| 76 | int argc; | ||
| 77 | char **argv; | ||
| 78 | { | 72 | { |
| 79 | int i,err=0; | 73 | int i,err=0; |
| 80 | FILE *IN; | 74 | FILE *IN; |
| @@ -102,8 +96,7 @@ char **argv; | |||
| 102 | exit(err); | 96 | exit(err); |
| 103 | } | 97 | } |
| 104 | 98 | ||
| 105 | void do_fp(f) | 99 | void do_fp(FILE *f) |
| 106 | FILE *f; | ||
| 107 | { | 100 | { |
| 108 | RIPEMD160_CTX c; | 101 | RIPEMD160_CTX c; |
| 109 | unsigned char md[RIPEMD160_DIGEST_LENGTH]; | 102 | unsigned char md[RIPEMD160_DIGEST_LENGTH]; |
| @@ -123,8 +116,7 @@ FILE *f; | |||
| 123 | pt(md); | 116 | pt(md); |
| 124 | } | 117 | } |
| 125 | 118 | ||
| 126 | void pt(md) | 119 | void pt(unsigned char *md) |
| 127 | unsigned char *md; | ||
| 128 | { | 120 | { |
| 129 | int i; | 121 | int i; |
| 130 | 122 | ||
diff --git a/src/lib/libcrypto/ripemd/rmdtest.c b/src/lib/libcrypto/ripemd/rmdtest.c index 6a0297f975..19e9741db2 100644 --- a/src/lib/libcrypto/ripemd/rmdtest.c +++ b/src/lib/libcrypto/ripemd/rmdtest.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 "ripemd.h" | 62 | #include <openssl/ripemd.h> |
| 63 | 63 | ||
| 64 | char *test[]={ | 64 | #ifdef OPENSSL_NO_RIPEMD |
| 65 | int main(int argc, char *argv[]) | ||
| 66 | { | ||
| 67 | printf("No ripemd 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 | |||
| 77 | static char *test[]={ | ||
| 65 | "", | 78 | "", |
| 66 | "a", | 79 | "a", |
| 67 | "abc", | 80 | "abc", |
| @@ -73,7 +86,7 @@ char *test[]={ | |||
| 73 | NULL, | 86 | NULL, |
| 74 | }; | 87 | }; |
| 75 | 88 | ||
| 76 | char *ret[]={ | 89 | static char *ret[]={ |
| 77 | "9c1185a5c5e9fc54612808977ee8f548b2258d31", | 90 | "9c1185a5c5e9fc54612808977ee8f548b2258d31", |
| 78 | "0bdc9d2d256b3ee9daae347be6f4dc835a467ffe", | 91 | "0bdc9d2d256b3ee9daae347be6f4dc835a467ffe", |
| 79 | "8eb208f7e05d987a9b044a8e98c6b087f15a0bfc", | 92 | "8eb208f7e05d987a9b044a8e98c6b087f15a0bfc", |
| @@ -84,26 +97,24 @@ char *ret[]={ | |||
| 84 | "9b752e45573d4b39f4dbd3323cab82bf63326bfb", | 97 | "9b752e45573d4b39f4dbd3323cab82bf63326bfb", |
| 85 | }; | 98 | }; |
| 86 | 99 | ||
| 87 | #ifndef NOPROTO | ||
| 88 | static char *pt(unsigned char *md); | 100 | static char *pt(unsigned char *md); |
| 89 | #else | 101 | int main(int argc, char *argv[]) |
| 90 | static char *pt(); | ||
| 91 | #endif | ||
| 92 | |||
| 93 | int main(argc,argv) | ||
| 94 | int argc; | ||
| 95 | char *argv[]; | ||
| 96 | { | 102 | { |
| 97 | int i,err=0; | 103 | int i,err=0; |
| 98 | unsigned char **P,**R; | 104 | unsigned char **P,**R; |
| 99 | char *p; | 105 | char *p; |
| 106 | unsigned char md[RIPEMD160_DIGEST_LENGTH]; | ||
| 100 | 107 | ||
| 101 | P=(unsigned char **)test; | 108 | P=(unsigned char **)test; |
| 102 | R=(unsigned char **)ret; | 109 | R=(unsigned char **)ret; |
| 103 | i=1; | 110 | i=1; |
| 104 | while (*P != NULL) | 111 | while (*P != NULL) |
| 105 | { | 112 | { |
| 106 | p=pt(RIPEMD160(&(P[0][0]),(unsigned long)strlen((char *)*P),NULL)); | 113 | #ifdef CHARSET_EBCDIC |
| 114 | ebcdic2ascii((char *)*P, (char *)*P, strlen((char *)*P)); | ||
| 115 | #endif | ||
| 116 | EVP_Digest(&(P[0][0]),(unsigned long)strlen((char *)*P),md,NULL,EVP_ripemd160(), NULL); | ||
| 117 | p=pt(md); | ||
| 107 | if (strcmp(p,(char *)*R) != 0) | 118 | if (strcmp(p,(char *)*R) != 0) |
| 108 | { | 119 | { |
| 109 | printf("error calculating RIPEMD160 on '%s'\n",*P); | 120 | printf("error calculating RIPEMD160 on '%s'\n",*P); |
| @@ -120,8 +131,7 @@ char *argv[]; | |||
| 120 | return(0); | 131 | return(0); |
| 121 | } | 132 | } |
| 122 | 133 | ||
| 123 | static char *pt(md) | 134 | static char *pt(unsigned char *md) |
| 124 | unsigned char *md; | ||
| 125 | { | 135 | { |
| 126 | int i; | 136 | int i; |
| 127 | static char buf[80]; | 137 | static char buf[80]; |
| @@ -130,4 +140,4 @@ unsigned char *md; | |||
| 130 | sprintf(&(buf[i*2]),"%02x",md[i]); | 140 | sprintf(&(buf[i*2]),"%02x",md[i]); |
| 131 | return(buf); | 141 | return(buf); |
| 132 | } | 142 | } |
| 133 | 143 | #endif | |
