diff options
| author | markus <> | 2002-09-05 12:51:52 +0000 |
|---|---|---|
| committer | markus <> | 2002-09-05 12:51:52 +0000 |
| commit | 5514995a9d5ed91db089875adb509c7781357c0e (patch) | |
| tree | 2484410a46ba6c05ef94c253da36fbceef990b64 /src/lib/libcrypto/md5 | |
| parent | fd9566423b542798f5c8b06e68101a9ea5bb9885 (diff) | |
| download | openbsd-5514995a9d5ed91db089875adb509c7781357c0e.tar.gz openbsd-5514995a9d5ed91db089875adb509c7781357c0e.tar.bz2 openbsd-5514995a9d5ed91db089875adb509c7781357c0e.zip | |
import openssl-0.9.7-beta1
Diffstat (limited to 'src/lib/libcrypto/md5')
| -rw-r--r-- | src/lib/libcrypto/md5/asm/md5-sparcv9.S | 8 | ||||
| -rw-r--r-- | src/lib/libcrypto/md5/md5.c | 18 | ||||
| -rw-r--r-- | src/lib/libcrypto/md5/md5s.cpp | 2 | ||||
| -rw-r--r-- | src/lib/libcrypto/md5/md5test.c | 32 |
4 files changed, 28 insertions, 32 deletions
diff --git a/src/lib/libcrypto/md5/asm/md5-sparcv9.S b/src/lib/libcrypto/md5/asm/md5-sparcv9.S index ca4257f134..a599ed5660 100644 --- a/src/lib/libcrypto/md5/asm/md5-sparcv9.S +++ b/src/lib/libcrypto/md5/asm/md5-sparcv9.S | |||
| @@ -24,12 +24,12 @@ | |||
| 24 | * | 24 | * |
| 25 | * To compile with SC4.x/SC5.x: | 25 | * To compile with SC4.x/SC5.x: |
| 26 | * | 26 | * |
| 27 | * cc -xarch=v[9|8plus] -DULTRASPARC -DMD5_BLOCK_DATA_ORDER \ | 27 | * cc -xarch=v[9|8plus] -DOPENSSL_SYSNAME_ULTRASPARC -DMD5_BLOCK_DATA_ORDER \ |
| 28 | * -c md5-sparcv9.S | 28 | * -c md5-sparcv9.S |
| 29 | * | 29 | * |
| 30 | * and with gcc: | 30 | * and with gcc: |
| 31 | * | 31 | * |
| 32 | * gcc -mcpu=ultrasparc -DULTRASPARC -DMD5_BLOCK_DATA_ORDER \ | 32 | * gcc -mcpu=ultrasparc -DOPENSSL_SYSNAME_ULTRASPARC -DMD5_BLOCK_DATA_ORDER \ |
| 33 | * -c md5-sparcv9.S | 33 | * -c md5-sparcv9.S |
| 34 | * | 34 | * |
| 35 | * or if above fails (it does if you have gas): | 35 | * or if above fails (it does if you have gas): |
| @@ -72,7 +72,7 @@ | |||
| 72 | #define Dval R8 | 72 | #define Dval R8 |
| 73 | 73 | ||
| 74 | #if defined(MD5_BLOCK_DATA_ORDER) | 74 | #if defined(MD5_BLOCK_DATA_ORDER) |
| 75 | # if defined(ULTRASPARC) | 75 | # if defined(OPENSSL_SYSNAME_ULTRASPARC) |
| 76 | # define LOAD lda | 76 | # define LOAD lda |
| 77 | # define X(i) [%i1+i*4]%asi | 77 | # define X(i) [%i1+i*4]%asi |
| 78 | # define md5_block md5_block_asm_data_order_aligned | 78 | # define md5_block md5_block_asm_data_order_aligned |
| @@ -1012,7 +1012,7 @@ md5_block: | |||
| 1012 | st B,[Bptr] | 1012 | st B,[Bptr] |
| 1013 | nop != | 1013 | nop != |
| 1014 | 1014 | ||
| 1015 | #ifdef ULTRASPARC | 1015 | #ifdef OPENSSL_SYSNAME_ULTRASPARC |
| 1016 | bg,a,pt %icc,.Lmd5_block_loop | 1016 | bg,a,pt %icc,.Lmd5_block_loop |
| 1017 | #else | 1017 | #else |
| 1018 | bg,a .Lmd5_block_loop | 1018 | bg,a .Lmd5_block_loop |
diff --git a/src/lib/libcrypto/md5/md5.c b/src/lib/libcrypto/md5/md5.c index 9d6f5a6003..7ed0024ae1 100644 --- a/src/lib/libcrypto/md5/md5.c +++ b/src/lib/libcrypto/md5/md5.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 "md5.h" | 61 | #include <openssl/md5.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 | MD5_CTX c; | 101 | MD5_CTX c; |
| 109 | unsigned char md[MD5_DIGEST_LENGTH]; | 102 | unsigned char md[MD5_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/md5/md5s.cpp b/src/lib/libcrypto/md5/md5s.cpp index ef8e175df0..dd343fd4e6 100644 --- a/src/lib/libcrypto/md5/md5s.cpp +++ b/src/lib/libcrypto/md5/md5s.cpp | |||
| @@ -32,7 +32,7 @@ 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 "md5.h" | 35 | #include <openssl/md5.h> |
| 36 | 36 | ||
| 37 | extern "C" { | 37 | extern "C" { |
| 38 | void md5_block_x86(MD5_CTX *ctx, unsigned char *buffer,int num); | 38 | void md5_block_x86(MD5_CTX *ctx, unsigned char *buffer,int num); |
diff --git a/src/lib/libcrypto/md5/md5test.c b/src/lib/libcrypto/md5/md5test.c index 74b84bc67f..862b89658a 100644 --- a/src/lib/libcrypto/md5/md5test.c +++ b/src/lib/libcrypto/md5/md5test.c | |||
| @@ -59,9 +59,18 @@ | |||
| 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 "md5.h" | ||
| 63 | 62 | ||
| 64 | char *test[]={ | 63 | #ifdef OPENSSL_NO_MD5 |
| 64 | int main(int argc, char *argv[]) | ||
| 65 | { | ||
| 66 | printf("No MD5 support\n"); | ||
| 67 | return(0); | ||
| 68 | } | ||
| 69 | #else | ||
| 70 | #include <openssl/evp.h> | ||
| 71 | #include <openssl/md5.h> | ||
| 72 | |||
| 73 | static char *test[]={ | ||
| 65 | "", | 74 | "", |
| 66 | "a", | 75 | "a", |
| 67 | "abc", | 76 | "abc", |
| @@ -72,7 +81,7 @@ char *test[]={ | |||
| 72 | NULL, | 81 | NULL, |
| 73 | }; | 82 | }; |
| 74 | 83 | ||
| 75 | char *ret[]={ | 84 | static char *ret[]={ |
| 76 | "d41d8cd98f00b204e9800998ecf8427e", | 85 | "d41d8cd98f00b204e9800998ecf8427e", |
| 77 | "0cc175b9c0f1b6a831c399e269772661", | 86 | "0cc175b9c0f1b6a831c399e269772661", |
| 78 | "900150983cd24fb0d6963f7d28e17f72", | 87 | "900150983cd24fb0d6963f7d28e17f72", |
| @@ -82,26 +91,21 @@ char *ret[]={ | |||
| 82 | "57edf4a22be3c955ac49da2e2107b67a", | 91 | "57edf4a22be3c955ac49da2e2107b67a", |
| 83 | }; | 92 | }; |
| 84 | 93 | ||
| 85 | #ifndef NOPROTO | ||
| 86 | static char *pt(unsigned char *md); | 94 | static char *pt(unsigned char *md); |
| 87 | #else | 95 | int main(int argc, char *argv[]) |
| 88 | static char *pt(); | ||
| 89 | #endif | ||
| 90 | |||
| 91 | int main(argc,argv) | ||
| 92 | int argc; | ||
| 93 | char *argv[]; | ||
| 94 | { | 96 | { |
| 95 | int i,err=0; | 97 | int i,err=0; |
| 96 | unsigned char **P,**R; | 98 | unsigned char **P,**R; |
| 97 | char *p; | 99 | char *p; |
| 100 | unsigned char md[MD5_DIGEST_LENGTH]; | ||
| 98 | 101 | ||
| 99 | P=(unsigned char **)test; | 102 | P=(unsigned char **)test; |
| 100 | R=(unsigned char **)ret; | 103 | R=(unsigned char **)ret; |
| 101 | i=1; | 104 | i=1; |
| 102 | while (*P != NULL) | 105 | while (*P != NULL) |
| 103 | { | 106 | { |
| 104 | p=pt(MD5(&(P[0][0]),(unsigned long)strlen((char *)*P),NULL)); | 107 | EVP_Digest(&(P[0][0]),(unsigned long)strlen((char *)*P),md,NULL,EVP_md5(), NULL); |
| 108 | p=pt(md); | ||
| 105 | if (strcmp(p,(char *)*R) != 0) | 109 | if (strcmp(p,(char *)*R) != 0) |
| 106 | { | 110 | { |
| 107 | printf("error calculating MD5 on '%s'\n",*P); | 111 | printf("error calculating MD5 on '%s'\n",*P); |
| @@ -118,8 +122,7 @@ char *argv[]; | |||
| 118 | return(0); | 122 | return(0); |
| 119 | } | 123 | } |
| 120 | 124 | ||
| 121 | static char *pt(md) | 125 | static char *pt(unsigned char *md) |
| 122 | unsigned char *md; | ||
| 123 | { | 126 | { |
| 124 | int i; | 127 | int i; |
| 125 | static char buf[80]; | 128 | static char buf[80]; |
| @@ -128,3 +131,4 @@ unsigned char *md; | |||
| 128 | sprintf(&(buf[i*2]),"%02x",md[i]); | 131 | sprintf(&(buf[i*2]),"%02x",md[i]); |
| 129 | return(buf); | 132 | return(buf); |
| 130 | } | 133 | } |
| 134 | #endif | ||
