diff options
Diffstat (limited to 'src/lib/libcrypto/sha')
-rw-r--r-- | src/lib/libcrypto/sha/Makefile.ssl | 20 | ||||
-rw-r--r-- | src/lib/libcrypto/sha/sha.h | 24 | ||||
-rw-r--r-- | src/lib/libcrypto/sha/sha1_one.c | 2 | ||||
-rw-r--r-- | src/lib/libcrypto/sha/sha1dgst.c | 2 | ||||
-rw-r--r-- | src/lib/libcrypto/sha/sha1test.c | 16 | ||||
-rw-r--r-- | src/lib/libcrypto/sha/sha_dgst.c | 2 | ||||
-rw-r--r-- | src/lib/libcrypto/sha/sha_locl.h | 5 | ||||
-rw-r--r-- | src/lib/libcrypto/sha/sha_one.c | 2 | ||||
-rw-r--r-- | src/lib/libcrypto/sha/shatest.c | 16 |
9 files changed, 51 insertions, 38 deletions
diff --git a/src/lib/libcrypto/sha/Makefile.ssl b/src/lib/libcrypto/sha/Makefile.ssl index 790e572fa2..f203ad7681 100644 --- a/src/lib/libcrypto/sha/Makefile.ssl +++ b/src/lib/libcrypto/sha/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 | ||
@@ -42,8 +43,7 @@ all: lib | |||
42 | 43 | ||
43 | lib: $(LIBOBJ) | 44 | lib: $(LIBOBJ) |
44 | $(AR) $(LIB) $(LIBOBJ) | 45 | $(AR) $(LIB) $(LIBOBJ) |
45 | @echo You may get an error following this line. Please ignore. | 46 | $(RANLIB) $(LIB) || echo Never mind. |
46 | - $(RANLIB) $(LIB) | ||
47 | @touch lib | 47 | @touch lib |
48 | 48 | ||
49 | # elf | 49 | # elf |
@@ -103,11 +103,13 @@ clean: | |||
103 | 103 | ||
104 | # DO NOT DELETE THIS LINE -- make depend depends on it. | 104 | # DO NOT DELETE THIS LINE -- make depend depends on it. |
105 | 105 | ||
106 | sha1_one.o: ../../include/openssl/sha.h | 106 | sha1_one.o: ../../include/openssl/e_os2.h ../../include/openssl/opensslconf.h |
107 | sha1dgst.o: ../../include/openssl/opensslconf.h | 107 | sha1_one.o: ../../include/openssl/sha.h sha1_one.c |
108 | sha1dgst.o: ../../include/openssl/e_os2.h ../../include/openssl/opensslconf.h | ||
108 | sha1dgst.o: ../../include/openssl/opensslv.h ../../include/openssl/sha.h | 109 | sha1dgst.o: ../../include/openssl/opensslv.h ../../include/openssl/sha.h |
109 | sha1dgst.o: ../md32_common.h sha_locl.h | 110 | sha1dgst.o: ../md32_common.h sha1dgst.c sha_locl.h |
110 | sha_dgst.o: ../../include/openssl/opensslconf.h | 111 | sha_dgst.o: ../../include/openssl/e_os2.h ../../include/openssl/opensslconf.h |
111 | sha_dgst.o: ../../include/openssl/opensslv.h ../../include/openssl/sha.h | 112 | sha_dgst.o: ../../include/openssl/opensslv.h ../../include/openssl/sha.h |
112 | sha_dgst.o: ../md32_common.h sha_locl.h | 113 | sha_dgst.o: ../md32_common.h sha_dgst.c sha_locl.h |
113 | sha_one.o: ../../include/openssl/sha.h | 114 | sha_one.o: ../../include/openssl/e_os2.h ../../include/openssl/opensslconf.h |
115 | sha_one.o: ../../include/openssl/sha.h sha_one.c | ||
diff --git a/src/lib/libcrypto/sha/sha.h b/src/lib/libcrypto/sha/sha.h index 77f6d9695e..3fd54a10cc 100644 --- a/src/lib/libcrypto/sha/sha.h +++ b/src/lib/libcrypto/sha/sha.h | |||
@@ -59,11 +59,13 @@ | |||
59 | #ifndef HEADER_SHA_H | 59 | #ifndef HEADER_SHA_H |
60 | #define HEADER_SHA_H | 60 | #define HEADER_SHA_H |
61 | 61 | ||
62 | #include <openssl/e_os2.h> | ||
63 | |||
62 | #ifdef __cplusplus | 64 | #ifdef __cplusplus |
63 | extern "C" { | 65 | extern "C" { |
64 | #endif | 66 | #endif |
65 | 67 | ||
66 | #if defined(NO_SHA) || (defined(NO_SHA0) && defined(NO_SHA1)) | 68 | #if defined(OPENSSL_NO_SHA) || (defined(OPENSSL_NO_SHA0) && defined(OPENSSL_NO_SHA1)) |
67 | #error SHA is disabled. | 69 | #error SHA is disabled. |
68 | #endif | 70 | #endif |
69 | 71 | ||
@@ -74,9 +76,9 @@ extern "C" { | |||
74 | * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | 76 | * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
75 | */ | 77 | */ |
76 | 78 | ||
77 | #if defined(WIN16) || defined(__LP32__) | 79 | #if defined(OPENSSL_SYS_WIN16) || defined(__LP32__) |
78 | #define SHA_LONG unsigned long | 80 | #define SHA_LONG unsigned long |
79 | #elif defined(_CRAY) || defined(__ILP64__) | 81 | #elif defined(OPENSSL_SYS_CRAY) || defined(__ILP64__) |
80 | #define SHA_LONG unsigned long | 82 | #define SHA_LONG unsigned long |
81 | #define SHA_LONG_LOG2 3 | 83 | #define SHA_LONG_LOG2 3 |
82 | #else | 84 | #else |
@@ -98,17 +100,17 @@ typedef struct SHAstate_st | |||
98 | int num; | 100 | int num; |
99 | } SHA_CTX; | 101 | } SHA_CTX; |
100 | 102 | ||
101 | #ifndef NO_SHA0 | 103 | #ifndef OPENSSL_NO_SHA0 |
102 | void SHA_Init(SHA_CTX *c); | 104 | int SHA_Init(SHA_CTX *c); |
103 | void SHA_Update(SHA_CTX *c, const void *data, unsigned long len); | 105 | int SHA_Update(SHA_CTX *c, const void *data, unsigned long len); |
104 | void SHA_Final(unsigned char *md, SHA_CTX *c); | 106 | int SHA_Final(unsigned char *md, SHA_CTX *c); |
105 | unsigned char *SHA(const unsigned char *d, unsigned long n,unsigned char *md); | 107 | unsigned char *SHA(const unsigned char *d, unsigned long n,unsigned char *md); |
106 | void SHA_Transform(SHA_CTX *c, const unsigned char *data); | 108 | void SHA_Transform(SHA_CTX *c, const unsigned char *data); |
107 | #endif | 109 | #endif |
108 | #ifndef NO_SHA1 | 110 | #ifndef OPENSSL_NO_SHA1 |
109 | void SHA1_Init(SHA_CTX *c); | 111 | int SHA1_Init(SHA_CTX *c); |
110 | void SHA1_Update(SHA_CTX *c, const void *data, unsigned long len); | 112 | int SHA1_Update(SHA_CTX *c, const void *data, unsigned long len); |
111 | void SHA1_Final(unsigned char *md, SHA_CTX *c); | 113 | int SHA1_Final(unsigned char *md, SHA_CTX *c); |
112 | unsigned char *SHA1(const unsigned char *d, unsigned long n,unsigned char *md); | 114 | unsigned char *SHA1(const unsigned char *d, unsigned long n,unsigned char *md); |
113 | void SHA1_Transform(SHA_CTX *c, const unsigned char *data); | 115 | void SHA1_Transform(SHA_CTX *c, const unsigned char *data); |
114 | #endif | 116 | #endif |
diff --git a/src/lib/libcrypto/sha/sha1_one.c b/src/lib/libcrypto/sha/sha1_one.c index 861752eaa7..e6a24888ed 100644 --- a/src/lib/libcrypto/sha/sha1_one.c +++ b/src/lib/libcrypto/sha/sha1_one.c | |||
@@ -60,7 +60,7 @@ | |||
60 | #include <string.h> | 60 | #include <string.h> |
61 | #include <openssl/sha.h> | 61 | #include <openssl/sha.h> |
62 | 62 | ||
63 | #ifndef NO_SHA1 | 63 | #ifndef OPENSSL_NO_SHA1 |
64 | unsigned char *SHA1(const unsigned char *d, unsigned long n, unsigned char *md) | 64 | unsigned char *SHA1(const unsigned char *d, unsigned long n, unsigned char *md) |
65 | { | 65 | { |
66 | SHA_CTX c; | 66 | SHA_CTX c; |
diff --git a/src/lib/libcrypto/sha/sha1dgst.c b/src/lib/libcrypto/sha/sha1dgst.c index c09edb4cd7..182f65982a 100644 --- a/src/lib/libcrypto/sha/sha1dgst.c +++ b/src/lib/libcrypto/sha/sha1dgst.c | |||
@@ -56,7 +56,7 @@ | |||
56 | * [including the GNU Public Licence.] | 56 | * [including the GNU Public Licence.] |
57 | */ | 57 | */ |
58 | 58 | ||
59 | #if !defined(NO_SHA1) && !defined(NO_SHA) | 59 | #if !defined(OPENSSL_NO_SHA1) && !defined(OPENSSL_NO_SHA) |
60 | 60 | ||
61 | #undef SHA_0 | 61 | #undef SHA_0 |
62 | #define SHA_1 | 62 | #define SHA_1 |
diff --git a/src/lib/libcrypto/sha/sha1test.c b/src/lib/libcrypto/sha/sha1test.c index 688d06c637..499a1cf5af 100644 --- a/src/lib/libcrypto/sha/sha1test.c +++ b/src/lib/libcrypto/sha/sha1test.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_SHA | 63 | #ifdef OPENSSL_NO_SHA |
64 | int main(int argc, char *argv[]) | 64 | int main(int argc, char *argv[]) |
65 | { | 65 | { |
66 | printf("No SHA support\n"); | 66 | printf("No SHA support\n"); |
67 | return(0); | 67 | return(0); |
68 | } | 68 | } |
69 | #else | 69 | #else |
70 | #include <openssl/evp.h> | ||
70 | #include <openssl/sha.h> | 71 | #include <openssl/sha.h> |
71 | 72 | ||
72 | #ifdef CHARSET_EBCDIC | 73 | #ifdef CHARSET_EBCDIC |
@@ -106,7 +107,7 @@ int main(int argc, char *argv[]) | |||
106 | unsigned char **P,**R; | 107 | unsigned char **P,**R; |
107 | static unsigned char buf[1000]; | 108 | static unsigned char buf[1000]; |
108 | char *p,*r; | 109 | char *p,*r; |
109 | SHA_CTX c; | 110 | EVP_MD_CTX c; |
110 | unsigned char md[SHA_DIGEST_LENGTH]; | 111 | unsigned char md[SHA_DIGEST_LENGTH]; |
111 | 112 | ||
112 | #ifdef CHARSET_EBCDIC | 113 | #ifdef CHARSET_EBCDIC |
@@ -114,12 +115,14 @@ int main(int argc, char *argv[]) | |||
114 | ebcdic2ascii(test[1], test[1], strlen(test[1])); | 115 | ebcdic2ascii(test[1], test[1], strlen(test[1])); |
115 | #endif | 116 | #endif |
116 | 117 | ||
118 | EVP_MD_CTX_init(&c); | ||
117 | P=(unsigned char **)test; | 119 | P=(unsigned char **)test; |
118 | R=(unsigned char **)ret; | 120 | R=(unsigned char **)ret; |
119 | i=1; | 121 | i=1; |
120 | while (*P != NULL) | 122 | while (*P != NULL) |
121 | { | 123 | { |
122 | p=pt(SHA1(*P,(unsigned long)strlen((char *)*P),NULL)); | 124 | EVP_Digest(*P,(unsigned long)strlen((char *)*P),md,NULL,EVP_sha1(), NULL); |
125 | p=pt(md); | ||
123 | if (strcmp(p,(char *)*R) != 0) | 126 | if (strcmp(p,(char *)*R) != 0) |
124 | { | 127 | { |
125 | printf("error calculating SHA1 on '%s'\n",*P); | 128 | printf("error calculating SHA1 on '%s'\n",*P); |
@@ -137,10 +140,10 @@ int main(int argc, char *argv[]) | |||
137 | #ifdef CHARSET_EBCDIC | 140 | #ifdef CHARSET_EBCDIC |
138 | ebcdic2ascii(buf, buf, 1000); | 141 | ebcdic2ascii(buf, buf, 1000); |
139 | #endif /*CHARSET_EBCDIC*/ | 142 | #endif /*CHARSET_EBCDIC*/ |
140 | SHA1_Init(&c); | 143 | EVP_DigestInit_ex(&c,EVP_sha1(), NULL); |
141 | for (i=0; i<1000; i++) | 144 | for (i=0; i<1000; i++) |
142 | SHA1_Update(&c,buf,1000); | 145 | EVP_DigestUpdate(&c,buf,1000); |
143 | SHA1_Final(md,&c); | 146 | EVP_DigestFinal_ex(&c,md,NULL); |
144 | p=pt(md); | 147 | p=pt(md); |
145 | 148 | ||
146 | r=bigret; | 149 | r=bigret; |
@@ -153,6 +156,7 @@ int main(int argc, char *argv[]) | |||
153 | else | 156 | else |
154 | printf("test 3 ok\n"); | 157 | printf("test 3 ok\n"); |
155 | exit(err); | 158 | exit(err); |
159 | EVP_MD_CTX_cleanup(&c); | ||
156 | return(0); | 160 | return(0); |
157 | } | 161 | } |
158 | 162 | ||
diff --git a/src/lib/libcrypto/sha/sha_dgst.c b/src/lib/libcrypto/sha/sha_dgst.c index 894a96274a..5a4b3ab204 100644 --- a/src/lib/libcrypto/sha/sha_dgst.c +++ b/src/lib/libcrypto/sha/sha_dgst.c | |||
@@ -56,7 +56,7 @@ | |||
56 | * [including the GNU Public Licence.] | 56 | * [including the GNU Public Licence.] |
57 | */ | 57 | */ |
58 | 58 | ||
59 | #if !defined(NO_SHA0) && !defined(NO_SHA) | 59 | #if !defined(OPENSSL_NO_SHA0) && !defined(OPENSSL_NO_SHA) |
60 | 60 | ||
61 | #undef SHA_1 | 61 | #undef SHA_1 |
62 | #define SHA_0 | 62 | #define SHA_0 |
diff --git a/src/lib/libcrypto/sha/sha_locl.h b/src/lib/libcrypto/sha/sha_locl.h index 2f8aef83f3..471dfb9f8f 100644 --- a/src/lib/libcrypto/sha/sha_locl.h +++ b/src/lib/libcrypto/sha/sha_locl.h | |||
@@ -115,7 +115,7 @@ | |||
115 | # endif | 115 | # endif |
116 | 116 | ||
117 | # ifdef SHA1_ASM | 117 | # ifdef SHA1_ASM |
118 | # if defined(__i386) || defined(_M_IX86) || defined(__INTEL__) | 118 | # if defined(__i386) || defined(__i386__) || defined(_M_IX86) || defined(__INTEL__) |
119 | # define sha1_block_host_order sha1_block_asm_host_order | 119 | # define sha1_block_host_order sha1_block_asm_host_order |
120 | # define DONT_IMPLEMENT_BLOCK_HOST_ORDER | 120 | # define DONT_IMPLEMENT_BLOCK_HOST_ORDER |
121 | # define sha1_block_data_order sha1_block_asm_data_order | 121 | # define sha1_block_data_order sha1_block_asm_data_order |
@@ -138,7 +138,7 @@ | |||
138 | #define INIT_DATA_h3 0x10325476UL | 138 | #define INIT_DATA_h3 0x10325476UL |
139 | #define INIT_DATA_h4 0xc3d2e1f0UL | 139 | #define INIT_DATA_h4 0xc3d2e1f0UL |
140 | 140 | ||
141 | void HASH_INIT (SHA_CTX *c) | 141 | int HASH_INIT (SHA_CTX *c) |
142 | { | 142 | { |
143 | c->h0=INIT_DATA_h0; | 143 | c->h0=INIT_DATA_h0; |
144 | c->h1=INIT_DATA_h1; | 144 | c->h1=INIT_DATA_h1; |
@@ -148,6 +148,7 @@ void HASH_INIT (SHA_CTX *c) | |||
148 | c->Nl=0; | 148 | c->Nl=0; |
149 | c->Nh=0; | 149 | c->Nh=0; |
150 | c->num=0; | 150 | c->num=0; |
151 | return 1; | ||
151 | } | 152 | } |
152 | 153 | ||
153 | #define K_00_19 0x5a827999UL | 154 | #define K_00_19 0x5a827999UL |
diff --git a/src/lib/libcrypto/sha/sha_one.c b/src/lib/libcrypto/sha/sha_one.c index 2d955de162..5426faae4a 100644 --- a/src/lib/libcrypto/sha/sha_one.c +++ b/src/lib/libcrypto/sha/sha_one.c | |||
@@ -60,7 +60,7 @@ | |||
60 | #include <string.h> | 60 | #include <string.h> |
61 | #include <openssl/sha.h> | 61 | #include <openssl/sha.h> |
62 | 62 | ||
63 | #ifndef NO_SHA0 | 63 | #ifndef OPENSSL_NO_SHA0 |
64 | unsigned char *SHA(const unsigned char *d, unsigned long n, unsigned char *md) | 64 | unsigned char *SHA(const unsigned char *d, unsigned long n, unsigned char *md) |
65 | { | 65 | { |
66 | SHA_CTX c; | 66 | SHA_CTX c; |
diff --git a/src/lib/libcrypto/sha/shatest.c b/src/lib/libcrypto/sha/shatest.c index a5786bbf76..331294a74f 100644 --- a/src/lib/libcrypto/sha/shatest.c +++ b/src/lib/libcrypto/sha/shatest.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_SHA | 63 | #ifdef OPENSSL_NO_SHA |
64 | int main(int argc, char *argv[]) | 64 | int main(int argc, char *argv[]) |
65 | { | 65 | { |
66 | printf("No SHA support\n"); | 66 | printf("No SHA support\n"); |
67 | return(0); | 67 | return(0); |
68 | } | 68 | } |
69 | #else | 69 | #else |
70 | #include <openssl/evp.h> | ||
70 | #include <openssl/sha.h> | 71 | #include <openssl/sha.h> |
71 | 72 | ||
72 | #ifdef CHARSET_EBCDIC | 73 | #ifdef CHARSET_EBCDIC |
@@ -106,7 +107,7 @@ int main(int argc, char *argv[]) | |||
106 | unsigned char **P,**R; | 107 | unsigned char **P,**R; |
107 | static unsigned char buf[1000]; | 108 | static unsigned char buf[1000]; |
108 | char *p,*r; | 109 | char *p,*r; |
109 | SHA_CTX c; | 110 | EVP_MD_CTX c; |
110 | unsigned char md[SHA_DIGEST_LENGTH]; | 111 | unsigned char md[SHA_DIGEST_LENGTH]; |
111 | 112 | ||
112 | #ifdef CHARSET_EBCDIC | 113 | #ifdef CHARSET_EBCDIC |
@@ -114,12 +115,14 @@ int main(int argc, char *argv[]) | |||
114 | ebcdic2ascii(test[1], test[1], strlen(test[1])); | 115 | ebcdic2ascii(test[1], test[1], strlen(test[1])); |
115 | #endif | 116 | #endif |
116 | 117 | ||
118 | EVP_MD_CTX_init(&c); | ||
117 | P=(unsigned char **)test; | 119 | P=(unsigned char **)test; |
118 | R=(unsigned char **)ret; | 120 | R=(unsigned char **)ret; |
119 | i=1; | 121 | i=1; |
120 | while (*P != NULL) | 122 | while (*P != NULL) |
121 | { | 123 | { |
122 | p=pt(SHA(*P,(unsigned long)strlen((char *)*P),NULL)); | 124 | EVP_Digest(*P,(unsigned long)strlen((char *)*P),md,NULL,EVP_sha(), NULL); |
125 | p=pt(md); | ||
123 | if (strcmp(p,(char *)*R) != 0) | 126 | if (strcmp(p,(char *)*R) != 0) |
124 | { | 127 | { |
125 | printf("error calculating SHA on '%s'\n",*P); | 128 | printf("error calculating SHA on '%s'\n",*P); |
@@ -137,10 +140,10 @@ int main(int argc, char *argv[]) | |||
137 | #ifdef CHARSET_EBCDIC | 140 | #ifdef CHARSET_EBCDIC |
138 | ebcdic2ascii(buf, buf, 1000); | 141 | ebcdic2ascii(buf, buf, 1000); |
139 | #endif /*CHARSET_EBCDIC*/ | 142 | #endif /*CHARSET_EBCDIC*/ |
140 | SHA_Init(&c); | 143 | EVP_DigestInit_ex(&c,EVP_sha(), NULL); |
141 | for (i=0; i<1000; i++) | 144 | for (i=0; i<1000; i++) |
142 | SHA_Update(&c,buf,1000); | 145 | EVP_DigestUpdate(&c,buf,1000); |
143 | SHA_Final(md,&c); | 146 | EVP_DigestFinal_ex(&c,md,NULL); |
144 | p=pt(md); | 147 | p=pt(md); |
145 | 148 | ||
146 | r=bigret; | 149 | r=bigret; |
@@ -152,6 +155,7 @@ int main(int argc, char *argv[]) | |||
152 | } | 155 | } |
153 | else | 156 | else |
154 | printf("test 3 ok\n"); | 157 | printf("test 3 ok\n"); |
158 | EVP_MD_CTX_cleanup(&c); | ||
155 | exit(err); | 159 | exit(err); |
156 | return(0); | 160 | return(0); |
157 | } | 161 | } |