diff options
| author | beck <> | 2002-05-15 02:29:21 +0000 |
|---|---|---|
| committer | beck <> | 2002-05-15 02:29:21 +0000 |
| commit | b64270d1e45fe7f3241e4c9b6ce60d5ac89bc2e9 (patch) | |
| tree | fa27cf82a1250b64ed3bf5f4a18c7354d470bbcc /src/lib/libcrypto/md5 | |
| parent | e471e1ea98d673597b182ea85f29e30c97cd08b5 (diff) | |
| download | openbsd-b64270d1e45fe7f3241e4c9b6ce60d5ac89bc2e9.tar.gz openbsd-b64270d1e45fe7f3241e4c9b6ce60d5ac89bc2e9.tar.bz2 openbsd-b64270d1e45fe7f3241e4c9b6ce60d5ac89bc2e9.zip | |
OpenSSL 0.9.7 stable 2002 05 08 merge
Diffstat (limited to 'src/lib/libcrypto/md5')
| -rw-r--r-- | src/lib/libcrypto/md5/Makefile.ssl | 11 | ||||
| -rw-r--r-- | src/lib/libcrypto/md5/asm/md5-sparcv9.S | 8 | ||||
| -rw-r--r-- | src/lib/libcrypto/md5/md5.h | 12 | ||||
| -rw-r--r-- | src/lib/libcrypto/md5/md5_dgst.c | 3 | ||||
| -rw-r--r-- | src/lib/libcrypto/md5/md5_locl.h | 6 | ||||
| -rw-r--r-- | src/lib/libcrypto/md5/md5test.c | 7 |
6 files changed, 26 insertions, 21 deletions
diff --git a/src/lib/libcrypto/md5/Makefile.ssl b/src/lib/libcrypto/md5/Makefile.ssl index 784215579b..f9a1190efb 100644 --- a/src/lib/libcrypto/md5/Makefile.ssl +++ b/src/lib/libcrypto/md5/Makefile.ssl | |||
| @@ -12,7 +12,8 @@ INSTALL_PREFIX= | |||
| 12 | OPENSSLDIR= /usr/local/ssl | 12 | OPENSSLDIR= /usr/local/ssl |
| 13 | INSTALLTOP=/usr/local/ssl | 13 | INSTALLTOP=/usr/local/ssl |
| 14 | MAKE= make -f Makefile.ssl | 14 | MAKE= make -f Makefile.ssl |
| 15 | MAKEDEPEND= $(TOP)/util/domd $(TOP) | 15 | MAKEDEPPROG= makedepend |
| 16 | MAKEDEPEND= $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG) | ||
| 16 | MAKEFILE= Makefile.ssl | 17 | MAKEFILE= Makefile.ssl |
| 17 | AR= ar r | 18 | AR= ar r |
| 18 | 19 | ||
| @@ -50,8 +51,7 @@ all: lib | |||
| 50 | 51 | ||
| 51 | lib: $(LIBOBJ) | 52 | lib: $(LIBOBJ) |
| 52 | $(AR) $(LIB) $(LIBOBJ) | 53 | $(AR) $(LIB) $(LIBOBJ) |
| 53 | @echo You may get an error following this line. Please ignore. | 54 | $(RANLIB) $(LIB) || echo Never mind. |
| 54 | - $(RANLIB) $(LIB) | ||
| 55 | @touch lib | 55 | @touch lib |
| 56 | 56 | ||
| 57 | # elf | 57 | # elf |
| @@ -130,5 +130,6 @@ clean: | |||
| 130 | # DO NOT DELETE THIS LINE -- make depend depends on it. | 130 | # DO NOT DELETE THIS LINE -- make depend depends on it. |
| 131 | 131 | ||
| 132 | md5_dgst.o: ../../include/openssl/md5.h ../../include/openssl/opensslconf.h | 132 | md5_dgst.o: ../../include/openssl/md5.h ../../include/openssl/opensslconf.h |
| 133 | md5_dgst.o: ../../include/openssl/opensslv.h ../md32_common.h md5_locl.h | 133 | md5_dgst.o: ../../include/openssl/opensslv.h ../md32_common.h md5_dgst.c |
| 134 | md5_one.o: ../../include/openssl/md5.h | 134 | md5_dgst.o: md5_locl.h |
| 135 | md5_one.o: ../../include/openssl/md5.h md5_one.c | ||
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.h b/src/lib/libcrypto/md5/md5.h index d10bc8397f..52cb753e6a 100644 --- a/src/lib/libcrypto/md5/md5.h +++ b/src/lib/libcrypto/md5/md5.h | |||
| @@ -63,7 +63,7 @@ | |||
| 63 | extern "C" { | 63 | extern "C" { |
| 64 | #endif | 64 | #endif |
| 65 | 65 | ||
| 66 | #ifdef NO_MD5 | 66 | #ifdef OPENSSL_NO_MD5 |
| 67 | #error MD5 is disabled. | 67 | #error MD5 is disabled. |
| 68 | #endif | 68 | #endif |
| 69 | 69 | ||
| @@ -74,9 +74,9 @@ extern "C" { | |||
| 74 | * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | 74 | * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
| 75 | */ | 75 | */ |
| 76 | 76 | ||
| 77 | #if defined(WIN16) || defined(__LP32__) | 77 | #if defined(OPENSSL_SYS_WIN16) || defined(__LP32__) |
| 78 | #define MD5_LONG unsigned long | 78 | #define MD5_LONG unsigned long |
| 79 | #elif defined(_CRAY) || defined(__ILP64__) | 79 | #elif defined(OENSSL_SYS_CRAY) || defined(__ILP64__) |
| 80 | #define MD5_LONG unsigned long | 80 | #define MD5_LONG unsigned long |
| 81 | #define MD5_LONG_LOG2 3 | 81 | #define MD5_LONG_LOG2 3 |
| 82 | /* | 82 | /* |
| @@ -102,9 +102,9 @@ typedef struct MD5state_st | |||
| 102 | int num; | 102 | int num; |
| 103 | } MD5_CTX; | 103 | } MD5_CTX; |
| 104 | 104 | ||
| 105 | void MD5_Init(MD5_CTX *c); | 105 | int MD5_Init(MD5_CTX *c); |
| 106 | void MD5_Update(MD5_CTX *c, const void *data, unsigned long len); | 106 | int MD5_Update(MD5_CTX *c, const void *data, unsigned long len); |
| 107 | void MD5_Final(unsigned char *md, MD5_CTX *c); | 107 | int MD5_Final(unsigned char *md, MD5_CTX *c); |
| 108 | unsigned char *MD5(const unsigned char *d, unsigned long n, unsigned char *md); | 108 | unsigned char *MD5(const unsigned char *d, unsigned long n, unsigned char *md); |
| 109 | void MD5_Transform(MD5_CTX *c, const unsigned char *b); | 109 | void MD5_Transform(MD5_CTX *c, const unsigned char *b); |
| 110 | #ifdef __cplusplus | 110 | #ifdef __cplusplus |
diff --git a/src/lib/libcrypto/md5/md5_dgst.c b/src/lib/libcrypto/md5/md5_dgst.c index 23d196b8d4..c38a3f021e 100644 --- a/src/lib/libcrypto/md5/md5_dgst.c +++ b/src/lib/libcrypto/md5/md5_dgst.c | |||
| @@ -70,7 +70,7 @@ const char *MD5_version="MD5" OPENSSL_VERSION_PTEXT; | |||
| 70 | #define INIT_DATA_C (unsigned long)0x98badcfeL | 70 | #define INIT_DATA_C (unsigned long)0x98badcfeL |
| 71 | #define INIT_DATA_D (unsigned long)0x10325476L | 71 | #define INIT_DATA_D (unsigned long)0x10325476L |
| 72 | 72 | ||
| 73 | void MD5_Init(MD5_CTX *c) | 73 | int MD5_Init(MD5_CTX *c) |
| 74 | { | 74 | { |
| 75 | c->A=INIT_DATA_A; | 75 | c->A=INIT_DATA_A; |
| 76 | c->B=INIT_DATA_B; | 76 | c->B=INIT_DATA_B; |
| @@ -79,6 +79,7 @@ void MD5_Init(MD5_CTX *c) | |||
| 79 | c->Nl=0; | 79 | c->Nl=0; |
| 80 | c->Nh=0; | 80 | c->Nh=0; |
| 81 | c->num=0; | 81 | c->num=0; |
| 82 | return 1; | ||
| 82 | } | 83 | } |
| 83 | 84 | ||
| 84 | #ifndef md5_block_host_order | 85 | #ifndef md5_block_host_order |
diff --git a/src/lib/libcrypto/md5/md5_locl.h b/src/lib/libcrypto/md5/md5_locl.h index c912484122..34c5257306 100644 --- a/src/lib/libcrypto/md5/md5_locl.h +++ b/src/lib/libcrypto/md5/md5_locl.h | |||
| @@ -66,9 +66,9 @@ | |||
| 66 | #endif | 66 | #endif |
| 67 | 67 | ||
| 68 | #ifdef MD5_ASM | 68 | #ifdef MD5_ASM |
| 69 | # if defined(__i386) || defined(_M_IX86) || defined(__INTEL__) | 69 | # if defined(__i386) || defined(__i386__) || defined(_M_IX86) || defined(__INTEL__) |
| 70 | # define md5_block_host_order md5_block_asm_host_order | 70 | # define md5_block_host_order md5_block_asm_host_order |
| 71 | # elif defined(__sparc) && defined(ULTRASPARC) | 71 | # elif defined(__sparc) && defined(OPENSSL_SYS_ULTRASPARC) |
| 72 | void md5_block_asm_data_order_aligned (MD5_CTX *c, const MD5_LONG *p,int num); | 72 | void md5_block_asm_data_order_aligned (MD5_CTX *c, const MD5_LONG *p,int num); |
| 73 | # define HASH_BLOCK_DATA_ORDER_ALIGNED md5_block_asm_data_order_aligned | 73 | # define HASH_BLOCK_DATA_ORDER_ALIGNED md5_block_asm_data_order_aligned |
| 74 | # endif | 74 | # endif |
| @@ -77,7 +77,7 @@ | |||
| 77 | void md5_block_host_order (MD5_CTX *c, const void *p,int num); | 77 | void md5_block_host_order (MD5_CTX *c, const void *p,int num); |
| 78 | void md5_block_data_order (MD5_CTX *c, const void *p,int num); | 78 | void md5_block_data_order (MD5_CTX *c, const void *p,int num); |
| 79 | 79 | ||
| 80 | #if defined(__i386) || defined(_M_IX86) || defined(__INTEL__) | 80 | #if defined(__i386) || defined(__i386__) || defined(_M_IX86) || defined(__INTEL__) |
| 81 | /* | 81 | /* |
| 82 | * *_block_host_order is expected to handle aligned data while | 82 | * *_block_host_order is expected to handle aligned data while |
| 83 | * *_block_data_order - unaligned. As algorithm and host (x86) | 83 | * *_block_data_order - unaligned. As algorithm and host (x86) |
diff --git a/src/lib/libcrypto/md5/md5test.c b/src/lib/libcrypto/md5/md5test.c index 6bd8656302..862b89658a 100644 --- a/src/lib/libcrypto/md5/md5test.c +++ b/src/lib/libcrypto/md5/md5test.c | |||
| @@ -60,13 +60,14 @@ | |||
| 60 | #include <string.h> | 60 | #include <string.h> |
| 61 | #include <stdlib.h> | 61 | #include <stdlib.h> |
| 62 | 62 | ||
| 63 | #ifdef NO_MD5 | 63 | #ifdef OPENSSL_NO_MD5 |
| 64 | int main(int argc, char *argv[]) | 64 | int main(int argc, char *argv[]) |
| 65 | { | 65 | { |
| 66 | printf("No MD5 support\n"); | 66 | printf("No MD5 support\n"); |
| 67 | return(0); | 67 | return(0); |
| 68 | } | 68 | } |
| 69 | #else | 69 | #else |
| 70 | #include <openssl/evp.h> | ||
| 70 | #include <openssl/md5.h> | 71 | #include <openssl/md5.h> |
| 71 | 72 | ||
| 72 | static char *test[]={ | 73 | static char *test[]={ |
| @@ -96,13 +97,15 @@ int main(int argc, char *argv[]) | |||
| 96 | int i,err=0; | 97 | int i,err=0; |
| 97 | unsigned char **P,**R; | 98 | unsigned char **P,**R; |
| 98 | char *p; | 99 | char *p; |
| 100 | unsigned char md[MD5_DIGEST_LENGTH]; | ||
| 99 | 101 | ||
| 100 | P=(unsigned char **)test; | 102 | P=(unsigned char **)test; |
| 101 | R=(unsigned char **)ret; | 103 | R=(unsigned char **)ret; |
| 102 | i=1; | 104 | i=1; |
| 103 | while (*P != NULL) | 105 | while (*P != NULL) |
| 104 | { | 106 | { |
| 105 | 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); | ||
| 106 | if (strcmp(p,(char *)*R) != 0) | 109 | if (strcmp(p,(char *)*R) != 0) |
| 107 | { | 110 | { |
| 108 | printf("error calculating MD5 on '%s'\n",*P); | 111 | printf("error calculating MD5 on '%s'\n",*P); |
