diff options
author | doug <> | 2015-09-13 21:09:56 +0000 |
---|---|---|
committer | doug <> | 2015-09-13 21:09:56 +0000 |
commit | 3a95df64bde1592af373f6d58178d0314908dbbd (patch) | |
tree | 982a180264ee66bd2bae30aea737ff5770b8509b | |
parent | dcd4d5509d6bf753588a993688daf1132f50a7ed (diff) | |
download | openbsd-3a95df64bde1592af373f6d58178d0314908dbbd.tar.gz openbsd-3a95df64bde1592af373f6d58178d0314908dbbd.tar.bz2 openbsd-3a95df64bde1592af373f6d58178d0314908dbbd.zip |
Remove SHA-0 support.
SHA-0 was withdrawn shortly after publication 20 years ago and replaced
with SHA-1. This will require a major crank.
ok bcook@, jsing@
25 files changed, 36 insertions, 825 deletions
diff --git a/src/lib/libcrypto/crypto/Makefile b/src/lib/libcrypto/crypto/Makefile index 410511fd60..76a099cd5b 100644 --- a/src/lib/libcrypto/crypto/Makefile +++ b/src/lib/libcrypto/crypto/Makefile | |||
@@ -1,4 +1,4 @@ | |||
1 | # $OpenBSD: Makefile,v 1.62 2015/09/13 12:27:14 jsing Exp $ | 1 | # $OpenBSD: Makefile,v 1.63 2015/09/13 21:09:56 doug Exp $ |
2 | 2 | ||
3 | LIB= crypto | 3 | LIB= crypto |
4 | 4 | ||
@@ -144,7 +144,7 @@ SRCS+= encode.c digest.c evp_enc.c evp_key.c | |||
144 | SRCS+= e_des.c e_bf.c e_idea.c e_des3.c e_camellia.c | 144 | SRCS+= e_des.c e_bf.c e_idea.c e_des3.c e_camellia.c |
145 | SRCS+= e_rc4.c e_aes.c names.c | 145 | SRCS+= e_rc4.c e_aes.c names.c |
146 | SRCS+= e_xcbc_d.c e_rc2.c e_cast.c | 146 | SRCS+= e_xcbc_d.c e_rc2.c e_cast.c |
147 | SRCS+= m_null.c m_md4.c m_md5.c m_sha.c m_sha1.c m_wp.c | 147 | SRCS+= m_null.c m_md4.c m_md5.c m_sha1.c m_wp.c |
148 | SRCS+= m_dss.c m_dss1.c m_ripemd.c m_ecdsa.c | 148 | SRCS+= m_dss.c m_dss1.c m_ripemd.c m_ecdsa.c |
149 | SRCS+= p_open.c p_seal.c p_sign.c p_verify.c p_lib.c p_enc.c p_dec.c | 149 | SRCS+= p_open.c p_seal.c p_sign.c p_verify.c p_lib.c p_enc.c p_dec.c |
150 | SRCS+= bio_md.c bio_b64.c bio_enc.c evp_err.c e_null.c | 150 | SRCS+= bio_md.c bio_b64.c bio_enc.c evp_err.c e_null.c |
@@ -221,7 +221,7 @@ SRCS+= rsa_pss.c rsa_x931.c rsa_asn1.c rsa_depr.c rsa_ameth.c rsa_prn.c | |||
221 | SRCS+= rsa_pmeth.c rsa_crpt.c | 221 | SRCS+= rsa_pmeth.c rsa_crpt.c |
222 | 222 | ||
223 | # sha/ | 223 | # sha/ |
224 | SRCS+= sha_dgst.c sha1dgst.c sha_one.c sha1_one.c sha256.c sha512.c | 224 | SRCS+= sha1dgst.c sha1_one.c sha256.c sha512.c |
225 | 225 | ||
226 | # stack/ | 226 | # stack/ |
227 | SRCS+= stack.c | 227 | SRCS+= stack.c |
diff --git a/src/lib/libcrypto/doc/EVP_DigestInit.pod b/src/lib/libcrypto/doc/EVP_DigestInit.pod index ccb19fc0a7..0d2c2e03b9 100644 --- a/src/lib/libcrypto/doc/EVP_DigestInit.pod +++ b/src/lib/libcrypto/doc/EVP_DigestInit.pod | |||
@@ -6,7 +6,7 @@ EVP_MD_CTX_init, EVP_MD_CTX_create, EVP_DigestInit_ex, EVP_DigestUpdate, | |||
6 | EVP_DigestFinal_ex, EVP_MD_CTX_cleanup, EVP_MD_CTX_destroy, EVP_MAX_MD_SIZE, | 6 | EVP_DigestFinal_ex, EVP_MD_CTX_cleanup, EVP_MD_CTX_destroy, EVP_MAX_MD_SIZE, |
7 | EVP_MD_CTX_copy_ex, EVP_MD_CTX_copy, EVP_MD_type, EVP_MD_pkey_type, | 7 | EVP_MD_CTX_copy_ex, EVP_MD_CTX_copy, EVP_MD_type, EVP_MD_pkey_type, |
8 | EVP_MD_size, EVP_MD_block_size, EVP_MD_CTX_md, EVP_MD_CTX_size, | 8 | EVP_MD_size, EVP_MD_block_size, EVP_MD_CTX_md, EVP_MD_CTX_size, |
9 | EVP_MD_CTX_block_size, EVP_MD_CTX_type, EVP_md_null, EVP_md2, EVP_md5, EVP_sha, | 9 | EVP_MD_CTX_block_size, EVP_MD_CTX_type, EVP_md_null, EVP_md2, EVP_md5 |
10 | EVP_sha1, EVP_sha224, EVP_sha256, EVP_sha384, EVP_sha512, EVP_dss, EVP_dss1, | 10 | EVP_sha1, EVP_sha224, EVP_sha256, EVP_sha384, EVP_sha512, EVP_dss, EVP_dss1, |
11 | EVP_ripemd160, EVP_get_digestbyname, EVP_get_digestbynid, | 11 | EVP_ripemd160, EVP_get_digestbyname, EVP_get_digestbynid, |
12 | EVP_get_digestbyobj - EVP digest routines | 12 | EVP_get_digestbyobj - EVP digest routines |
@@ -49,7 +49,6 @@ EVP_get_digestbyobj - EVP digest routines | |||
49 | const EVP_MD *EVP_md_null(void); | 49 | const EVP_MD *EVP_md_null(void); |
50 | const EVP_MD *EVP_md2(void); | 50 | const EVP_MD *EVP_md2(void); |
51 | const EVP_MD *EVP_md5(void); | 51 | const EVP_MD *EVP_md5(void); |
52 | const EVP_MD *EVP_sha(void); | ||
53 | const EVP_MD *EVP_sha1(void); | 52 | const EVP_MD *EVP_sha1(void); |
54 | const EVP_MD *EVP_dss(void); | 53 | const EVP_MD *EVP_dss(void); |
55 | const EVP_MD *EVP_dss1(void); | 54 | const EVP_MD *EVP_dss1(void); |
@@ -132,12 +131,12 @@ this will return B<NID_sha1WithRSAEncryption>. Since digests and signature | |||
132 | algorithms are no longer linked this function is only retained for | 131 | algorithms are no longer linked this function is only retained for |
133 | compatibility reasons. | 132 | compatibility reasons. |
134 | 133 | ||
135 | EVP_md2(), EVP_md5(), EVP_sha(), EVP_sha1(), EVP_sha224(), EVP_sha256(), | 134 | EVP_md2(), EVP_md5(), EVP_sha1(), EVP_sha224(), EVP_sha256(), EVP_sha384(), |
136 | EVP_sha384(), EVP_sha512() and EVP_ripemd160() return B<EVP_MD> | 135 | EVP_sha512() and EVP_ripemd160() return B<EVP_MD> structures for the MD2, MD5, |
137 | structures for the MD2, MD5, SHA, SHA1, SHA224, SHA256, SHA384, SHA512 | 136 | SHA1, SHA224, SHA256, SHA384, SHA512 and RIPEMD160 digest algorithms |
138 | and RIPEMD160 digest algorithms respectively. | 137 | respectively. |
139 | 138 | ||
140 | EVP_dss() and EVP_dss1() return B<EVP_MD> structures for SHA and SHA1 digest | 139 | EVP_dss() and EVP_dss1() return B<EVP_MD> structures for SHA1 digest |
141 | algorithms but using DSS (DSA) for the signature algorithm. Note: there is | 140 | algorithms but using DSS (DSA) for the signature algorithm. Note: there is |
142 | no need to use these pseudo-digests in OpenSSL 1.0.0 and later, they are | 141 | no need to use these pseudo-digests in OpenSSL 1.0.0 and later, they are |
143 | however retained for compatibility. | 142 | however retained for compatibility. |
diff --git a/src/lib/libcrypto/evp/c_all.c b/src/lib/libcrypto/evp/c_all.c index 5f9df3a7ad..6568f2ba5a 100644 --- a/src/lib/libcrypto/evp/c_all.c +++ b/src/lib/libcrypto/evp/c_all.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: c_all.c,v 1.17 2015/06/20 01:07:24 doug Exp $ */ | 1 | /* $OpenBSD: c_all.c,v 1.18 2015/09/13 21:09:56 doug Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -238,8 +238,7 @@ OpenSSL_add_all_digests(void) | |||
238 | EVP_add_digest_alias(SN_md5, "ssl3-md5"); | 238 | EVP_add_digest_alias(SN_md5, "ssl3-md5"); |
239 | #endif | 239 | #endif |
240 | 240 | ||
241 | #if !defined(OPENSSL_NO_SHA) && !defined(OPENSSL_NO_SHA0) | 241 | #if !defined(OPENSSL_NO_SHA) |
242 | EVP_add_digest(EVP_sha()); | ||
243 | #ifndef OPENSSL_NO_DSA | 242 | #ifndef OPENSSL_NO_DSA |
244 | EVP_add_digest(EVP_dss()); | 243 | EVP_add_digest(EVP_dss()); |
245 | #endif | 244 | #endif |
diff --git a/src/lib/libcrypto/evp/evp.h b/src/lib/libcrypto/evp/evp.h index 57f8753ced..c9a11c3a5f 100644 --- a/src/lib/libcrypto/evp/evp.h +++ b/src/lib/libcrypto/evp/evp.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: evp.h,v 1.45 2015/06/20 01:07:24 doug Exp $ */ | 1 | /* $OpenBSD: evp.h,v 1.46 2015/09/13 21:09:56 doug Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -655,7 +655,6 @@ const EVP_MD *EVP_md4(void); | |||
655 | const EVP_MD *EVP_md5(void); | 655 | const EVP_MD *EVP_md5(void); |
656 | #endif | 656 | #endif |
657 | #ifndef OPENSSL_NO_SHA | 657 | #ifndef OPENSSL_NO_SHA |
658 | const EVP_MD *EVP_sha(void); | ||
659 | const EVP_MD *EVP_sha1(void); | 658 | const EVP_MD *EVP_sha1(void); |
660 | const EVP_MD *EVP_dss(void); | 659 | const EVP_MD *EVP_dss(void); |
661 | const EVP_MD *EVP_dss1(void); | 660 | const EVP_MD *EVP_dss1(void); |
diff --git a/src/lib/libcrypto/evp/m_sha.c b/src/lib/libcrypto/evp/m_sha.c deleted file mode 100644 index c8de337839..0000000000 --- a/src/lib/libcrypto/evp/m_sha.c +++ /dev/null | |||
@@ -1,117 +0,0 @@ | |||
1 | /* $OpenBSD: m_sha.c,v 1.16 2014/07/13 09:30:02 miod Exp $ */ | ||
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
3 | * All rights reserved. | ||
4 | * | ||
5 | * This package is an SSL implementation written | ||
6 | * by Eric Young (eay@cryptsoft.com). | ||
7 | * The implementation was written so as to conform with Netscapes SSL. | ||
8 | * | ||
9 | * This library is free for commercial and non-commercial use as long as | ||
10 | * the following conditions are aheared to. The following conditions | ||
11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
13 | * included with this distribution is covered by the same copyright terms | ||
14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
15 | * | ||
16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
17 | * the code are not to be removed. | ||
18 | * If this package is used in a product, Eric Young should be given attribution | ||
19 | * as the author of the parts of the library used. | ||
20 | * This can be in the form of a textual message at program startup or | ||
21 | * in documentation (online or textual) provided with the package. | ||
22 | * | ||
23 | * Redistribution and use in source and binary forms, with or without | ||
24 | * modification, are permitted provided that the following conditions | ||
25 | * are met: | ||
26 | * 1. Redistributions of source code must retain the copyright | ||
27 | * notice, this list of conditions and the following disclaimer. | ||
28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
29 | * notice, this list of conditions and the following disclaimer in the | ||
30 | * documentation and/or other materials provided with the distribution. | ||
31 | * 3. All advertising materials mentioning features or use of this software | ||
32 | * must display the following acknowledgement: | ||
33 | * "This product includes cryptographic software written by | ||
34 | * Eric Young (eay@cryptsoft.com)" | ||
35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
36 | * being used are not cryptographic related :-). | ||
37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
38 | * the apps directory (application code) you must include an acknowledgement: | ||
39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
40 | * | ||
41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
51 | * SUCH DAMAGE. | ||
52 | * | ||
53 | * The licence and distribution terms for any publically available version or | ||
54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
55 | * copied and put under another distribution licence | ||
56 | * [including the GNU Public Licence.] | ||
57 | */ | ||
58 | |||
59 | #include <stdio.h> | ||
60 | |||
61 | #include <openssl/opensslconf.h> | ||
62 | |||
63 | #if !defined(OPENSSL_NO_SHA) && !defined(OPENSSL_NO_SHA0) | ||
64 | |||
65 | #include <openssl/evp.h> | ||
66 | #include <openssl/objects.h> | ||
67 | #include <openssl/x509.h> | ||
68 | |||
69 | #ifndef OPENSSL_NO_RSA | ||
70 | #include <openssl/rsa.h> | ||
71 | #endif | ||
72 | |||
73 | static int | ||
74 | init(EVP_MD_CTX *ctx) | ||
75 | { | ||
76 | return SHA_Init(ctx->md_data); | ||
77 | } | ||
78 | |||
79 | static int | ||
80 | update(EVP_MD_CTX *ctx, const void *data, size_t count) | ||
81 | { | ||
82 | return SHA_Update(ctx->md_data, data, count); | ||
83 | } | ||
84 | |||
85 | static int | ||
86 | final(EVP_MD_CTX *ctx, unsigned char *md) | ||
87 | { | ||
88 | return SHA_Final(md, ctx->md_data); | ||
89 | } | ||
90 | |||
91 | static const EVP_MD sha_md = { | ||
92 | .type = NID_sha, | ||
93 | .pkey_type = NID_shaWithRSAEncryption, | ||
94 | .md_size = SHA_DIGEST_LENGTH, | ||
95 | .flags = 0, | ||
96 | .init = init, | ||
97 | .update = update, | ||
98 | .final = final, | ||
99 | .copy = NULL, | ||
100 | .cleanup = NULL, | ||
101 | #ifndef OPENSSL_NO_RSA | ||
102 | .sign = (evp_sign_method *)RSA_sign, | ||
103 | .verify = (evp_verify_method *)RSA_verify, | ||
104 | .required_pkey_type = { | ||
105 | EVP_PKEY_RSA, EVP_PKEY_RSA2, 0, 0, | ||
106 | }, | ||
107 | #endif | ||
108 | .block_size = SHA_CBLOCK, | ||
109 | .ctx_size = sizeof(EVP_MD *) + sizeof(SHA_CTX), | ||
110 | }; | ||
111 | |||
112 | const EVP_MD * | ||
113 | EVP_sha(void) | ||
114 | { | ||
115 | return (&sha_md); | ||
116 | } | ||
117 | #endif | ||
diff --git a/src/lib/libcrypto/opensslfeatures.h b/src/lib/libcrypto/opensslfeatures.h index 6b6784754d..ba4dbba959 100644 --- a/src/lib/libcrypto/opensslfeatures.h +++ b/src/lib/libcrypto/opensslfeatures.h | |||
@@ -13,6 +13,7 @@ | |||
13 | # define OPENSSL_NO_RSAX | 13 | # define OPENSSL_NO_RSAX |
14 | # define OPENSSL_NO_SCTP | 14 | # define OPENSSL_NO_SCTP |
15 | # define OPENSSL_NO_SEED | 15 | # define OPENSSL_NO_SEED |
16 | # define OPENSSL_NO_SHA0 | ||
16 | # define OPENSSL_NO_SRP | 17 | # define OPENSSL_NO_SRP |
17 | # define OPENSSL_NO_SSL2 | 18 | # define OPENSSL_NO_SSL2 |
18 | # define OPENSSL_NO_SSL3 | 19 | # define OPENSSL_NO_SSL3 |
diff --git a/src/lib/libcrypto/sha/sha.h b/src/lib/libcrypto/sha/sha.h index d890175159..87fdf8d186 100644 --- a/src/lib/libcrypto/sha/sha.h +++ b/src/lib/libcrypto/sha/sha.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: sha.h,v 1.20 2014/10/20 13:06:54 bcook Exp $ */ | 1 | /* $OpenBSD: sha.h,v 1.21 2015/09/13 21:09:56 doug Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -70,7 +70,7 @@ | |||
70 | extern "C" { | 70 | extern "C" { |
71 | #endif | 71 | #endif |
72 | 72 | ||
73 | #if defined(OPENSSL_NO_SHA) || (defined(OPENSSL_NO_SHA0) && defined(OPENSSL_NO_SHA1)) | 73 | #if defined(OPENSSL_NO_SHA) || defined(OPENSSL_NO_SHA1) |
74 | #error SHA is disabled. | 74 | #error SHA is disabled. |
75 | #endif | 75 | #endif |
76 | 76 | ||
@@ -97,15 +97,6 @@ typedef struct SHAstate_st | |||
97 | unsigned int num; | 97 | unsigned int num; |
98 | } SHA_CTX; | 98 | } SHA_CTX; |
99 | 99 | ||
100 | #ifndef OPENSSL_NO_SHA0 | ||
101 | int SHA_Init(SHA_CTX *c); | ||
102 | int SHA_Update(SHA_CTX *c, const void *data, size_t len) | ||
103 | __attribute__ ((__bounded__(__buffer__,2,3))); | ||
104 | int SHA_Final(unsigned char *md, SHA_CTX *c); | ||
105 | unsigned char *SHA(const unsigned char *d, size_t n, unsigned char *md) | ||
106 | __attribute__ ((__bounded__(__buffer__,1,2))); | ||
107 | void SHA_Transform(SHA_CTX *c, const unsigned char *data); | ||
108 | #endif | ||
109 | #ifndef OPENSSL_NO_SHA1 | 100 | #ifndef OPENSSL_NO_SHA1 |
110 | int SHA1_Init(SHA_CTX *c); | 101 | int SHA1_Init(SHA_CTX *c); |
111 | int SHA1_Update(SHA_CTX *c, const void *data, size_t len) | 102 | int SHA1_Update(SHA_CTX *c, const void *data, size_t len) |
diff --git a/src/lib/libcrypto/sha/sha1dgst.c b/src/lib/libcrypto/sha/sha1dgst.c index aac27bdd2d..583d1068ba 100644 --- a/src/lib/libcrypto/sha/sha1dgst.c +++ b/src/lib/libcrypto/sha/sha1dgst.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: sha1dgst.c,v 1.13 2014/07/10 22:45:58 jsing Exp $ */ | 1 | /* $OpenBSD: sha1dgst.c,v 1.14 2015/09/13 21:09:56 doug Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -62,9 +62,6 @@ | |||
62 | 62 | ||
63 | #if !defined(OPENSSL_NO_SHA1) && !defined(OPENSSL_NO_SHA) | 63 | #if !defined(OPENSSL_NO_SHA1) && !defined(OPENSSL_NO_SHA) |
64 | 64 | ||
65 | #undef SHA_0 | ||
66 | #define SHA_1 | ||
67 | |||
68 | #include <openssl/opensslv.h> | 65 | #include <openssl/opensslv.h> |
69 | 66 | ||
70 | /* The implementation is in ../md32_common.h */ | 67 | /* The implementation is in ../md32_common.h */ |
diff --git a/src/lib/libcrypto/sha/sha_dgst.c b/src/lib/libcrypto/sha/sha_dgst.c deleted file mode 100644 index bb8c0c244f..0000000000 --- a/src/lib/libcrypto/sha/sha_dgst.c +++ /dev/null | |||
@@ -1,74 +0,0 @@ | |||
1 | /* $OpenBSD: sha_dgst.c,v 1.12 2014/07/10 22:45:58 jsing Exp $ */ | ||
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
3 | * All rights reserved. | ||
4 | * | ||
5 | * This package is an SSL implementation written | ||
6 | * by Eric Young (eay@cryptsoft.com). | ||
7 | * The implementation was written so as to conform with Netscapes SSL. | ||
8 | * | ||
9 | * This library is free for commercial and non-commercial use as long as | ||
10 | * the following conditions are aheared to. The following conditions | ||
11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
13 | * included with this distribution is covered by the same copyright terms | ||
14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
15 | * | ||
16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
17 | * the code are not to be removed. | ||
18 | * If this package is used in a product, Eric Young should be given attribution | ||
19 | * as the author of the parts of the library used. | ||
20 | * This can be in the form of a textual message at program startup or | ||
21 | * in documentation (online or textual) provided with the package. | ||
22 | * | ||
23 | * Redistribution and use in source and binary forms, with or without | ||
24 | * modification, are permitted provided that the following conditions | ||
25 | * are met: | ||
26 | * 1. Redistributions of source code must retain the copyright | ||
27 | * notice, this list of conditions and the following disclaimer. | ||
28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
29 | * notice, this list of conditions and the following disclaimer in the | ||
30 | * documentation and/or other materials provided with the distribution. | ||
31 | * 3. All advertising materials mentioning features or use of this software | ||
32 | * must display the following acknowledgement: | ||
33 | * "This product includes cryptographic software written by | ||
34 | * Eric Young (eay@cryptsoft.com)" | ||
35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
36 | * being used are not cryptographic related :-). | ||
37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
38 | * the apps directory (application code) you must include an acknowledgement: | ||
39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
40 | * | ||
41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
51 | * SUCH DAMAGE. | ||
52 | * | ||
53 | * The licence and distribution terms for any publically available version or | ||
54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
55 | * copied and put under another distribution licence | ||
56 | * [including the GNU Public Licence.] | ||
57 | */ | ||
58 | |||
59 | #include <openssl/opensslconf.h> | ||
60 | |||
61 | #include <openssl/crypto.h> | ||
62 | |||
63 | #if !defined(OPENSSL_NO_SHA0) && !defined(OPENSSL_NO_SHA) | ||
64 | |||
65 | #undef SHA_1 | ||
66 | #define SHA_0 | ||
67 | |||
68 | #include <openssl/opensslv.h> | ||
69 | |||
70 | /* The implementation is in ../md32_common.h */ | ||
71 | |||
72 | #include "sha_locl.h" | ||
73 | |||
74 | #endif | ||
diff --git a/src/lib/libcrypto/sha/sha_locl.h b/src/lib/libcrypto/sha/sha_locl.h index f2f9a31ee7..f56ac5b9b7 100644 --- a/src/lib/libcrypto/sha/sha_locl.h +++ b/src/lib/libcrypto/sha/sha_locl.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: sha_locl.h,v 1.19 2014/10/28 07:35:59 jsg Exp $ */ | 1 | /* $OpenBSD: sha_locl.h,v 1.20 2015/09/13 21:09:56 doug Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -76,19 +76,6 @@ | |||
76 | ll=(c)->h4; HOST_l2c(ll,(s)); \ | 76 | ll=(c)->h4; HOST_l2c(ll,(s)); \ |
77 | } while (0) | 77 | } while (0) |
78 | 78 | ||
79 | #if defined(SHA_0) | ||
80 | |||
81 | # define HASH_UPDATE SHA_Update | ||
82 | # define HASH_TRANSFORM SHA_Transform | ||
83 | # define HASH_FINAL SHA_Final | ||
84 | # define HASH_INIT SHA_Init | ||
85 | # define HASH_BLOCK_DATA_ORDER sha_block_data_order | ||
86 | # define Xupdate(a,ix,ia,ib,ic,id) (ix=(a)=(ia^ib^ic^id)) | ||
87 | |||
88 | static void sha_block_data_order (SHA_CTX *c, const void *p,size_t num); | ||
89 | |||
90 | #elif defined(SHA_1) | ||
91 | |||
92 | # define HASH_UPDATE SHA1_Update | 79 | # define HASH_UPDATE SHA1_Update |
93 | # define HASH_TRANSFORM SHA1_Transform | 80 | # define HASH_TRANSFORM SHA1_Transform |
94 | # define HASH_FINAL SHA1_Final | 81 | # define HASH_FINAL SHA1_Final |
@@ -103,10 +90,6 @@ static | |||
103 | #endif | 90 | #endif |
104 | void sha1_block_data_order (SHA_CTX *c, const void *p,size_t num); | 91 | void sha1_block_data_order (SHA_CTX *c, const void *p,size_t num); |
105 | 92 | ||
106 | #else | ||
107 | # error "Either SHA_0 or SHA_1 must be defined." | ||
108 | #endif | ||
109 | |||
110 | #include "md32_common.h" | 93 | #include "md32_common.h" |
111 | 94 | ||
112 | #define INIT_DATA_h0 0x67452301UL | 95 | #define INIT_DATA_h0 0x67452301UL |
@@ -115,11 +98,7 @@ void sha1_block_data_order (SHA_CTX *c, const void *p,size_t num); | |||
115 | #define INIT_DATA_h3 0x10325476UL | 98 | #define INIT_DATA_h3 0x10325476UL |
116 | #define INIT_DATA_h4 0xc3d2e1f0UL | 99 | #define INIT_DATA_h4 0xc3d2e1f0UL |
117 | 100 | ||
118 | #ifdef SHA_0 | ||
119 | int SHA_Init(SHA_CTX *c) | ||
120 | #else | ||
121 | int SHA1_Init(SHA_CTX *c) | 101 | int SHA1_Init(SHA_CTX *c) |
122 | #endif | ||
123 | { | 102 | { |
124 | memset (c,0,sizeof(*c)); | 103 | memset (c,0,sizeof(*c)); |
125 | c->h0=INIT_DATA_h0; | 104 | c->h0=INIT_DATA_h0; |
@@ -201,7 +180,7 @@ int SHA1_Init(SHA_CTX *c) | |||
201 | # define X(i) XX[i] | 180 | # define X(i) XX[i] |
202 | #endif | 181 | #endif |
203 | 182 | ||
204 | #if !defined(SHA_1) || !defined(SHA1_ASM) | 183 | #if !defined(SHA1_ASM) |
205 | #include <machine/endian.h> | 184 | #include <machine/endian.h> |
206 | static void HASH_BLOCK_DATA_ORDER (SHA_CTX *c, const void *p, size_t num) | 185 | static void HASH_BLOCK_DATA_ORDER (SHA_CTX *c, const void *p, size_t num) |
207 | { | 186 | { |
@@ -387,7 +366,7 @@ static void HASH_BLOCK_DATA_ORDER (SHA_CTX *c, const void *p, size_t num) | |||
387 | E=D, D=C, C=ROTATE(B,30), B=A; \ | 366 | E=D, D=C, C=ROTATE(B,30), B=A; \ |
388 | A=ROTATE(A,5)+T+xa; } while(0) | 367 | A=ROTATE(A,5)+T+xa; } while(0) |
389 | 368 | ||
390 | #if !defined(SHA_1) || !defined(SHA1_ASM) | 369 | #if !defined(SHA1_ASM) |
391 | static void HASH_BLOCK_DATA_ORDER (SHA_CTX *c, const void *p, size_t num) | 370 | static void HASH_BLOCK_DATA_ORDER (SHA_CTX *c, const void *p, size_t num) |
392 | { | 371 | { |
393 | const unsigned char *data=p; | 372 | const unsigned char *data=p; |
diff --git a/src/lib/libcrypto/sha/sha_one.c b/src/lib/libcrypto/sha/sha_one.c deleted file mode 100644 index ad04021eb1..0000000000 --- a/src/lib/libcrypto/sha/sha_one.c +++ /dev/null | |||
@@ -1,81 +0,0 @@ | |||
1 | /* $OpenBSD: sha_one.c,v 1.9 2015/09/10 15:56:26 jsing Exp $ */ | ||
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
3 | * All rights reserved. | ||
4 | * | ||
5 | * This package is an SSL implementation written | ||
6 | * by Eric Young (eay@cryptsoft.com). | ||
7 | * The implementation was written so as to conform with Netscapes SSL. | ||
8 | * | ||
9 | * This library is free for commercial and non-commercial use as long as | ||
10 | * the following conditions are aheared to. The following conditions | ||
11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
13 | * included with this distribution is covered by the same copyright terms | ||
14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
15 | * | ||
16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
17 | * the code are not to be removed. | ||
18 | * If this package is used in a product, Eric Young should be given attribution | ||
19 | * as the author of the parts of the library used. | ||
20 | * This can be in the form of a textual message at program startup or | ||
21 | * in documentation (online or textual) provided with the package. | ||
22 | * | ||
23 | * Redistribution and use in source and binary forms, with or without | ||
24 | * modification, are permitted provided that the following conditions | ||
25 | * are met: | ||
26 | * 1. Redistributions of source code must retain the copyright | ||
27 | * notice, this list of conditions and the following disclaimer. | ||
28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
29 | * notice, this list of conditions and the following disclaimer in the | ||
30 | * documentation and/or other materials provided with the distribution. | ||
31 | * 3. All advertising materials mentioning features or use of this software | ||
32 | * must display the following acknowledgement: | ||
33 | * "This product includes cryptographic software written by | ||
34 | * Eric Young (eay@cryptsoft.com)" | ||
35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
36 | * being used are not cryptographic related :-). | ||
37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
38 | * the apps directory (application code) you must include an acknowledgement: | ||
39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
40 | * | ||
41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
51 | * SUCH DAMAGE. | ||
52 | * | ||
53 | * The licence and distribution terms for any publically available version or | ||
54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
55 | * copied and put under another distribution licence | ||
56 | * [including the GNU Public Licence.] | ||
57 | */ | ||
58 | |||
59 | #include <stdio.h> | ||
60 | #include <string.h> | ||
61 | |||
62 | #include <openssl/opensslconf.h> | ||
63 | |||
64 | #include <openssl/crypto.h> | ||
65 | #include <openssl/sha.h> | ||
66 | |||
67 | #ifndef OPENSSL_NO_SHA0 | ||
68 | unsigned char *SHA(const unsigned char *d, size_t n, unsigned char *md) | ||
69 | { | ||
70 | SHA_CTX c; | ||
71 | static unsigned char m[SHA_DIGEST_LENGTH]; | ||
72 | |||
73 | if (md == NULL) md=m; | ||
74 | if (!SHA_Init(&c)) | ||
75 | return NULL; | ||
76 | SHA_Update(&c,d,n); | ||
77 | SHA_Final(md,&c); | ||
78 | explicit_bzero(&c,sizeof(c)); | ||
79 | return(md); | ||
80 | } | ||
81 | #endif | ||
diff --git a/src/lib/libssl/src/crypto/evp/c_all.c b/src/lib/libssl/src/crypto/evp/c_all.c index 5f9df3a7ad..6568f2ba5a 100644 --- a/src/lib/libssl/src/crypto/evp/c_all.c +++ b/src/lib/libssl/src/crypto/evp/c_all.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: c_all.c,v 1.17 2015/06/20 01:07:24 doug Exp $ */ | 1 | /* $OpenBSD: c_all.c,v 1.18 2015/09/13 21:09:56 doug Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -238,8 +238,7 @@ OpenSSL_add_all_digests(void) | |||
238 | EVP_add_digest_alias(SN_md5, "ssl3-md5"); | 238 | EVP_add_digest_alias(SN_md5, "ssl3-md5"); |
239 | #endif | 239 | #endif |
240 | 240 | ||
241 | #if !defined(OPENSSL_NO_SHA) && !defined(OPENSSL_NO_SHA0) | 241 | #if !defined(OPENSSL_NO_SHA) |
242 | EVP_add_digest(EVP_sha()); | ||
243 | #ifndef OPENSSL_NO_DSA | 242 | #ifndef OPENSSL_NO_DSA |
244 | EVP_add_digest(EVP_dss()); | 243 | EVP_add_digest(EVP_dss()); |
245 | #endif | 244 | #endif |
diff --git a/src/lib/libssl/src/crypto/evp/evp.h b/src/lib/libssl/src/crypto/evp/evp.h index 57f8753ced..c9a11c3a5f 100644 --- a/src/lib/libssl/src/crypto/evp/evp.h +++ b/src/lib/libssl/src/crypto/evp/evp.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: evp.h,v 1.45 2015/06/20 01:07:24 doug Exp $ */ | 1 | /* $OpenBSD: evp.h,v 1.46 2015/09/13 21:09:56 doug Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -655,7 +655,6 @@ const EVP_MD *EVP_md4(void); | |||
655 | const EVP_MD *EVP_md5(void); | 655 | const EVP_MD *EVP_md5(void); |
656 | #endif | 656 | #endif |
657 | #ifndef OPENSSL_NO_SHA | 657 | #ifndef OPENSSL_NO_SHA |
658 | const EVP_MD *EVP_sha(void); | ||
659 | const EVP_MD *EVP_sha1(void); | 658 | const EVP_MD *EVP_sha1(void); |
660 | const EVP_MD *EVP_dss(void); | 659 | const EVP_MD *EVP_dss(void); |
661 | const EVP_MD *EVP_dss1(void); | 660 | const EVP_MD *EVP_dss1(void); |
diff --git a/src/lib/libssl/src/crypto/evp/m_sha.c b/src/lib/libssl/src/crypto/evp/m_sha.c deleted file mode 100644 index c8de337839..0000000000 --- a/src/lib/libssl/src/crypto/evp/m_sha.c +++ /dev/null | |||
@@ -1,117 +0,0 @@ | |||
1 | /* $OpenBSD: m_sha.c,v 1.16 2014/07/13 09:30:02 miod Exp $ */ | ||
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
3 | * All rights reserved. | ||
4 | * | ||
5 | * This package is an SSL implementation written | ||
6 | * by Eric Young (eay@cryptsoft.com). | ||
7 | * The implementation was written so as to conform with Netscapes SSL. | ||
8 | * | ||
9 | * This library is free for commercial and non-commercial use as long as | ||
10 | * the following conditions are aheared to. The following conditions | ||
11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
13 | * included with this distribution is covered by the same copyright terms | ||
14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
15 | * | ||
16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
17 | * the code are not to be removed. | ||
18 | * If this package is used in a product, Eric Young should be given attribution | ||
19 | * as the author of the parts of the library used. | ||
20 | * This can be in the form of a textual message at program startup or | ||
21 | * in documentation (online or textual) provided with the package. | ||
22 | * | ||
23 | * Redistribution and use in source and binary forms, with or without | ||
24 | * modification, are permitted provided that the following conditions | ||
25 | * are met: | ||
26 | * 1. Redistributions of source code must retain the copyright | ||
27 | * notice, this list of conditions and the following disclaimer. | ||
28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
29 | * notice, this list of conditions and the following disclaimer in the | ||
30 | * documentation and/or other materials provided with the distribution. | ||
31 | * 3. All advertising materials mentioning features or use of this software | ||
32 | * must display the following acknowledgement: | ||
33 | * "This product includes cryptographic software written by | ||
34 | * Eric Young (eay@cryptsoft.com)" | ||
35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
36 | * being used are not cryptographic related :-). | ||
37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
38 | * the apps directory (application code) you must include an acknowledgement: | ||
39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
40 | * | ||
41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
51 | * SUCH DAMAGE. | ||
52 | * | ||
53 | * The licence and distribution terms for any publically available version or | ||
54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
55 | * copied and put under another distribution licence | ||
56 | * [including the GNU Public Licence.] | ||
57 | */ | ||
58 | |||
59 | #include <stdio.h> | ||
60 | |||
61 | #include <openssl/opensslconf.h> | ||
62 | |||
63 | #if !defined(OPENSSL_NO_SHA) && !defined(OPENSSL_NO_SHA0) | ||
64 | |||
65 | #include <openssl/evp.h> | ||
66 | #include <openssl/objects.h> | ||
67 | #include <openssl/x509.h> | ||
68 | |||
69 | #ifndef OPENSSL_NO_RSA | ||
70 | #include <openssl/rsa.h> | ||
71 | #endif | ||
72 | |||
73 | static int | ||
74 | init(EVP_MD_CTX *ctx) | ||
75 | { | ||
76 | return SHA_Init(ctx->md_data); | ||
77 | } | ||
78 | |||
79 | static int | ||
80 | update(EVP_MD_CTX *ctx, const void *data, size_t count) | ||
81 | { | ||
82 | return SHA_Update(ctx->md_data, data, count); | ||
83 | } | ||
84 | |||
85 | static int | ||
86 | final(EVP_MD_CTX *ctx, unsigned char *md) | ||
87 | { | ||
88 | return SHA_Final(md, ctx->md_data); | ||
89 | } | ||
90 | |||
91 | static const EVP_MD sha_md = { | ||
92 | .type = NID_sha, | ||
93 | .pkey_type = NID_shaWithRSAEncryption, | ||
94 | .md_size = SHA_DIGEST_LENGTH, | ||
95 | .flags = 0, | ||
96 | .init = init, | ||
97 | .update = update, | ||
98 | .final = final, | ||
99 | .copy = NULL, | ||
100 | .cleanup = NULL, | ||
101 | #ifndef OPENSSL_NO_RSA | ||
102 | .sign = (evp_sign_method *)RSA_sign, | ||
103 | .verify = (evp_verify_method *)RSA_verify, | ||
104 | .required_pkey_type = { | ||
105 | EVP_PKEY_RSA, EVP_PKEY_RSA2, 0, 0, | ||
106 | }, | ||
107 | #endif | ||
108 | .block_size = SHA_CBLOCK, | ||
109 | .ctx_size = sizeof(EVP_MD *) + sizeof(SHA_CTX), | ||
110 | }; | ||
111 | |||
112 | const EVP_MD * | ||
113 | EVP_sha(void) | ||
114 | { | ||
115 | return (&sha_md); | ||
116 | } | ||
117 | #endif | ||
diff --git a/src/lib/libssl/src/crypto/opensslfeatures.h b/src/lib/libssl/src/crypto/opensslfeatures.h index 6b6784754d..ba4dbba959 100644 --- a/src/lib/libssl/src/crypto/opensslfeatures.h +++ b/src/lib/libssl/src/crypto/opensslfeatures.h | |||
@@ -13,6 +13,7 @@ | |||
13 | # define OPENSSL_NO_RSAX | 13 | # define OPENSSL_NO_RSAX |
14 | # define OPENSSL_NO_SCTP | 14 | # define OPENSSL_NO_SCTP |
15 | # define OPENSSL_NO_SEED | 15 | # define OPENSSL_NO_SEED |
16 | # define OPENSSL_NO_SHA0 | ||
16 | # define OPENSSL_NO_SRP | 17 | # define OPENSSL_NO_SRP |
17 | # define OPENSSL_NO_SSL2 | 18 | # define OPENSSL_NO_SSL2 |
18 | # define OPENSSL_NO_SSL3 | 19 | # define OPENSSL_NO_SSL3 |
diff --git a/src/lib/libssl/src/crypto/sha/sha.h b/src/lib/libssl/src/crypto/sha/sha.h index d890175159..87fdf8d186 100644 --- a/src/lib/libssl/src/crypto/sha/sha.h +++ b/src/lib/libssl/src/crypto/sha/sha.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: sha.h,v 1.20 2014/10/20 13:06:54 bcook Exp $ */ | 1 | /* $OpenBSD: sha.h,v 1.21 2015/09/13 21:09:56 doug Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -70,7 +70,7 @@ | |||
70 | extern "C" { | 70 | extern "C" { |
71 | #endif | 71 | #endif |
72 | 72 | ||
73 | #if defined(OPENSSL_NO_SHA) || (defined(OPENSSL_NO_SHA0) && defined(OPENSSL_NO_SHA1)) | 73 | #if defined(OPENSSL_NO_SHA) || defined(OPENSSL_NO_SHA1) |
74 | #error SHA is disabled. | 74 | #error SHA is disabled. |
75 | #endif | 75 | #endif |
76 | 76 | ||
@@ -97,15 +97,6 @@ typedef struct SHAstate_st | |||
97 | unsigned int num; | 97 | unsigned int num; |
98 | } SHA_CTX; | 98 | } SHA_CTX; |
99 | 99 | ||
100 | #ifndef OPENSSL_NO_SHA0 | ||
101 | int SHA_Init(SHA_CTX *c); | ||
102 | int SHA_Update(SHA_CTX *c, const void *data, size_t len) | ||
103 | __attribute__ ((__bounded__(__buffer__,2,3))); | ||
104 | int SHA_Final(unsigned char *md, SHA_CTX *c); | ||
105 | unsigned char *SHA(const unsigned char *d, size_t n, unsigned char *md) | ||
106 | __attribute__ ((__bounded__(__buffer__,1,2))); | ||
107 | void SHA_Transform(SHA_CTX *c, const unsigned char *data); | ||
108 | #endif | ||
109 | #ifndef OPENSSL_NO_SHA1 | 100 | #ifndef OPENSSL_NO_SHA1 |
110 | int SHA1_Init(SHA_CTX *c); | 101 | int SHA1_Init(SHA_CTX *c); |
111 | int SHA1_Update(SHA_CTX *c, const void *data, size_t len) | 102 | int SHA1_Update(SHA_CTX *c, const void *data, size_t len) |
diff --git a/src/lib/libssl/src/crypto/sha/sha1dgst.c b/src/lib/libssl/src/crypto/sha/sha1dgst.c index aac27bdd2d..583d1068ba 100644 --- a/src/lib/libssl/src/crypto/sha/sha1dgst.c +++ b/src/lib/libssl/src/crypto/sha/sha1dgst.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: sha1dgst.c,v 1.13 2014/07/10 22:45:58 jsing Exp $ */ | 1 | /* $OpenBSD: sha1dgst.c,v 1.14 2015/09/13 21:09:56 doug Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -62,9 +62,6 @@ | |||
62 | 62 | ||
63 | #if !defined(OPENSSL_NO_SHA1) && !defined(OPENSSL_NO_SHA) | 63 | #if !defined(OPENSSL_NO_SHA1) && !defined(OPENSSL_NO_SHA) |
64 | 64 | ||
65 | #undef SHA_0 | ||
66 | #define SHA_1 | ||
67 | |||
68 | #include <openssl/opensslv.h> | 65 | #include <openssl/opensslv.h> |
69 | 66 | ||
70 | /* The implementation is in ../md32_common.h */ | 67 | /* The implementation is in ../md32_common.h */ |
diff --git a/src/lib/libssl/src/crypto/sha/sha_dgst.c b/src/lib/libssl/src/crypto/sha/sha_dgst.c deleted file mode 100644 index bb8c0c244f..0000000000 --- a/src/lib/libssl/src/crypto/sha/sha_dgst.c +++ /dev/null | |||
@@ -1,74 +0,0 @@ | |||
1 | /* $OpenBSD: sha_dgst.c,v 1.12 2014/07/10 22:45:58 jsing Exp $ */ | ||
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
3 | * All rights reserved. | ||
4 | * | ||
5 | * This package is an SSL implementation written | ||
6 | * by Eric Young (eay@cryptsoft.com). | ||
7 | * The implementation was written so as to conform with Netscapes SSL. | ||
8 | * | ||
9 | * This library is free for commercial and non-commercial use as long as | ||
10 | * the following conditions are aheared to. The following conditions | ||
11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
13 | * included with this distribution is covered by the same copyright terms | ||
14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
15 | * | ||
16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
17 | * the code are not to be removed. | ||
18 | * If this package is used in a product, Eric Young should be given attribution | ||
19 | * as the author of the parts of the library used. | ||
20 | * This can be in the form of a textual message at program startup or | ||
21 | * in documentation (online or textual) provided with the package. | ||
22 | * | ||
23 | * Redistribution and use in source and binary forms, with or without | ||
24 | * modification, are permitted provided that the following conditions | ||
25 | * are met: | ||
26 | * 1. Redistributions of source code must retain the copyright | ||
27 | * notice, this list of conditions and the following disclaimer. | ||
28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
29 | * notice, this list of conditions and the following disclaimer in the | ||
30 | * documentation and/or other materials provided with the distribution. | ||
31 | * 3. All advertising materials mentioning features or use of this software | ||
32 | * must display the following acknowledgement: | ||
33 | * "This product includes cryptographic software written by | ||
34 | * Eric Young (eay@cryptsoft.com)" | ||
35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
36 | * being used are not cryptographic related :-). | ||
37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
38 | * the apps directory (application code) you must include an acknowledgement: | ||
39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
40 | * | ||
41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
51 | * SUCH DAMAGE. | ||
52 | * | ||
53 | * The licence and distribution terms for any publically available version or | ||
54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
55 | * copied and put under another distribution licence | ||
56 | * [including the GNU Public Licence.] | ||
57 | */ | ||
58 | |||
59 | #include <openssl/opensslconf.h> | ||
60 | |||
61 | #include <openssl/crypto.h> | ||
62 | |||
63 | #if !defined(OPENSSL_NO_SHA0) && !defined(OPENSSL_NO_SHA) | ||
64 | |||
65 | #undef SHA_1 | ||
66 | #define SHA_0 | ||
67 | |||
68 | #include <openssl/opensslv.h> | ||
69 | |||
70 | /* The implementation is in ../md32_common.h */ | ||
71 | |||
72 | #include "sha_locl.h" | ||
73 | |||
74 | #endif | ||
diff --git a/src/lib/libssl/src/crypto/sha/sha_locl.h b/src/lib/libssl/src/crypto/sha/sha_locl.h index f2f9a31ee7..f56ac5b9b7 100644 --- a/src/lib/libssl/src/crypto/sha/sha_locl.h +++ b/src/lib/libssl/src/crypto/sha/sha_locl.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: sha_locl.h,v 1.19 2014/10/28 07:35:59 jsg Exp $ */ | 1 | /* $OpenBSD: sha_locl.h,v 1.20 2015/09/13 21:09:56 doug Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -76,19 +76,6 @@ | |||
76 | ll=(c)->h4; HOST_l2c(ll,(s)); \ | 76 | ll=(c)->h4; HOST_l2c(ll,(s)); \ |
77 | } while (0) | 77 | } while (0) |
78 | 78 | ||
79 | #if defined(SHA_0) | ||
80 | |||
81 | # define HASH_UPDATE SHA_Update | ||
82 | # define HASH_TRANSFORM SHA_Transform | ||
83 | # define HASH_FINAL SHA_Final | ||
84 | # define HASH_INIT SHA_Init | ||
85 | # define HASH_BLOCK_DATA_ORDER sha_block_data_order | ||
86 | # define Xupdate(a,ix,ia,ib,ic,id) (ix=(a)=(ia^ib^ic^id)) | ||
87 | |||
88 | static void sha_block_data_order (SHA_CTX *c, const void *p,size_t num); | ||
89 | |||
90 | #elif defined(SHA_1) | ||
91 | |||
92 | # define HASH_UPDATE SHA1_Update | 79 | # define HASH_UPDATE SHA1_Update |
93 | # define HASH_TRANSFORM SHA1_Transform | 80 | # define HASH_TRANSFORM SHA1_Transform |
94 | # define HASH_FINAL SHA1_Final | 81 | # define HASH_FINAL SHA1_Final |
@@ -103,10 +90,6 @@ static | |||
103 | #endif | 90 | #endif |
104 | void sha1_block_data_order (SHA_CTX *c, const void *p,size_t num); | 91 | void sha1_block_data_order (SHA_CTX *c, const void *p,size_t num); |
105 | 92 | ||
106 | #else | ||
107 | # error "Either SHA_0 or SHA_1 must be defined." | ||
108 | #endif | ||
109 | |||
110 | #include "md32_common.h" | 93 | #include "md32_common.h" |
111 | 94 | ||
112 | #define INIT_DATA_h0 0x67452301UL | 95 | #define INIT_DATA_h0 0x67452301UL |
@@ -115,11 +98,7 @@ void sha1_block_data_order (SHA_CTX *c, const void *p,size_t num); | |||
115 | #define INIT_DATA_h3 0x10325476UL | 98 | #define INIT_DATA_h3 0x10325476UL |
116 | #define INIT_DATA_h4 0xc3d2e1f0UL | 99 | #define INIT_DATA_h4 0xc3d2e1f0UL |
117 | 100 | ||
118 | #ifdef SHA_0 | ||
119 | int SHA_Init(SHA_CTX *c) | ||
120 | #else | ||
121 | int SHA1_Init(SHA_CTX *c) | 101 | int SHA1_Init(SHA_CTX *c) |
122 | #endif | ||
123 | { | 102 | { |
124 | memset (c,0,sizeof(*c)); | 103 | memset (c,0,sizeof(*c)); |
125 | c->h0=INIT_DATA_h0; | 104 | c->h0=INIT_DATA_h0; |
@@ -201,7 +180,7 @@ int SHA1_Init(SHA_CTX *c) | |||
201 | # define X(i) XX[i] | 180 | # define X(i) XX[i] |
202 | #endif | 181 | #endif |
203 | 182 | ||
204 | #if !defined(SHA_1) || !defined(SHA1_ASM) | 183 | #if !defined(SHA1_ASM) |
205 | #include <machine/endian.h> | 184 | #include <machine/endian.h> |
206 | static void HASH_BLOCK_DATA_ORDER (SHA_CTX *c, const void *p, size_t num) | 185 | static void HASH_BLOCK_DATA_ORDER (SHA_CTX *c, const void *p, size_t num) |
207 | { | 186 | { |
@@ -387,7 +366,7 @@ static void HASH_BLOCK_DATA_ORDER (SHA_CTX *c, const void *p, size_t num) | |||
387 | E=D, D=C, C=ROTATE(B,30), B=A; \ | 366 | E=D, D=C, C=ROTATE(B,30), B=A; \ |
388 | A=ROTATE(A,5)+T+xa; } while(0) | 367 | A=ROTATE(A,5)+T+xa; } while(0) |
389 | 368 | ||
390 | #if !defined(SHA_1) || !defined(SHA1_ASM) | 369 | #if !defined(SHA1_ASM) |
391 | static void HASH_BLOCK_DATA_ORDER (SHA_CTX *c, const void *p, size_t num) | 370 | static void HASH_BLOCK_DATA_ORDER (SHA_CTX *c, const void *p, size_t num) |
392 | { | 371 | { |
393 | const unsigned char *data=p; | 372 | const unsigned char *data=p; |
diff --git a/src/lib/libssl/src/crypto/sha/sha_one.c b/src/lib/libssl/src/crypto/sha/sha_one.c deleted file mode 100644 index ad04021eb1..0000000000 --- a/src/lib/libssl/src/crypto/sha/sha_one.c +++ /dev/null | |||
@@ -1,81 +0,0 @@ | |||
1 | /* $OpenBSD: sha_one.c,v 1.9 2015/09/10 15:56:26 jsing Exp $ */ | ||
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
3 | * All rights reserved. | ||
4 | * | ||
5 | * This package is an SSL implementation written | ||
6 | * by Eric Young (eay@cryptsoft.com). | ||
7 | * The implementation was written so as to conform with Netscapes SSL. | ||
8 | * | ||
9 | * This library is free for commercial and non-commercial use as long as | ||
10 | * the following conditions are aheared to. The following conditions | ||
11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
13 | * included with this distribution is covered by the same copyright terms | ||
14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
15 | * | ||
16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
17 | * the code are not to be removed. | ||
18 | * If this package is used in a product, Eric Young should be given attribution | ||
19 | * as the author of the parts of the library used. | ||
20 | * This can be in the form of a textual message at program startup or | ||
21 | * in documentation (online or textual) provided with the package. | ||
22 | * | ||
23 | * Redistribution and use in source and binary forms, with or without | ||
24 | * modification, are permitted provided that the following conditions | ||
25 | * are met: | ||
26 | * 1. Redistributions of source code must retain the copyright | ||
27 | * notice, this list of conditions and the following disclaimer. | ||
28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
29 | * notice, this list of conditions and the following disclaimer in the | ||
30 | * documentation and/or other materials provided with the distribution. | ||
31 | * 3. All advertising materials mentioning features or use of this software | ||
32 | * must display the following acknowledgement: | ||
33 | * "This product includes cryptographic software written by | ||
34 | * Eric Young (eay@cryptsoft.com)" | ||
35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
36 | * being used are not cryptographic related :-). | ||
37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
38 | * the apps directory (application code) you must include an acknowledgement: | ||
39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
40 | * | ||
41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
51 | * SUCH DAMAGE. | ||
52 | * | ||
53 | * The licence and distribution terms for any publically available version or | ||
54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
55 | * copied and put under another distribution licence | ||
56 | * [including the GNU Public Licence.] | ||
57 | */ | ||
58 | |||
59 | #include <stdio.h> | ||
60 | #include <string.h> | ||
61 | |||
62 | #include <openssl/opensslconf.h> | ||
63 | |||
64 | #include <openssl/crypto.h> | ||
65 | #include <openssl/sha.h> | ||
66 | |||
67 | #ifndef OPENSSL_NO_SHA0 | ||
68 | unsigned char *SHA(const unsigned char *d, size_t n, unsigned char *md) | ||
69 | { | ||
70 | SHA_CTX c; | ||
71 | static unsigned char m[SHA_DIGEST_LENGTH]; | ||
72 | |||
73 | if (md == NULL) md=m; | ||
74 | if (!SHA_Init(&c)) | ||
75 | return NULL; | ||
76 | SHA_Update(&c,d,n); | ||
77 | SHA_Final(md,&c); | ||
78 | explicit_bzero(&c,sizeof(c)); | ||
79 | return(md); | ||
80 | } | ||
81 | #endif | ||
diff --git a/src/lib/libssl/src/doc/crypto/EVP_DigestInit.pod b/src/lib/libssl/src/doc/crypto/EVP_DigestInit.pod index ccb19fc0a7..0d2c2e03b9 100644 --- a/src/lib/libssl/src/doc/crypto/EVP_DigestInit.pod +++ b/src/lib/libssl/src/doc/crypto/EVP_DigestInit.pod | |||
@@ -6,7 +6,7 @@ EVP_MD_CTX_init, EVP_MD_CTX_create, EVP_DigestInit_ex, EVP_DigestUpdate, | |||
6 | EVP_DigestFinal_ex, EVP_MD_CTX_cleanup, EVP_MD_CTX_destroy, EVP_MAX_MD_SIZE, | 6 | EVP_DigestFinal_ex, EVP_MD_CTX_cleanup, EVP_MD_CTX_destroy, EVP_MAX_MD_SIZE, |
7 | EVP_MD_CTX_copy_ex, EVP_MD_CTX_copy, EVP_MD_type, EVP_MD_pkey_type, | 7 | EVP_MD_CTX_copy_ex, EVP_MD_CTX_copy, EVP_MD_type, EVP_MD_pkey_type, |
8 | EVP_MD_size, EVP_MD_block_size, EVP_MD_CTX_md, EVP_MD_CTX_size, | 8 | EVP_MD_size, EVP_MD_block_size, EVP_MD_CTX_md, EVP_MD_CTX_size, |
9 | EVP_MD_CTX_block_size, EVP_MD_CTX_type, EVP_md_null, EVP_md2, EVP_md5, EVP_sha, | 9 | EVP_MD_CTX_block_size, EVP_MD_CTX_type, EVP_md_null, EVP_md2, EVP_md5 |
10 | EVP_sha1, EVP_sha224, EVP_sha256, EVP_sha384, EVP_sha512, EVP_dss, EVP_dss1, | 10 | EVP_sha1, EVP_sha224, EVP_sha256, EVP_sha384, EVP_sha512, EVP_dss, EVP_dss1, |
11 | EVP_ripemd160, EVP_get_digestbyname, EVP_get_digestbynid, | 11 | EVP_ripemd160, EVP_get_digestbyname, EVP_get_digestbynid, |
12 | EVP_get_digestbyobj - EVP digest routines | 12 | EVP_get_digestbyobj - EVP digest routines |
@@ -49,7 +49,6 @@ EVP_get_digestbyobj - EVP digest routines | |||
49 | const EVP_MD *EVP_md_null(void); | 49 | const EVP_MD *EVP_md_null(void); |
50 | const EVP_MD *EVP_md2(void); | 50 | const EVP_MD *EVP_md2(void); |
51 | const EVP_MD *EVP_md5(void); | 51 | const EVP_MD *EVP_md5(void); |
52 | const EVP_MD *EVP_sha(void); | ||
53 | const EVP_MD *EVP_sha1(void); | 52 | const EVP_MD *EVP_sha1(void); |
54 | const EVP_MD *EVP_dss(void); | 53 | const EVP_MD *EVP_dss(void); |
55 | const EVP_MD *EVP_dss1(void); | 54 | const EVP_MD *EVP_dss1(void); |
@@ -132,12 +131,12 @@ this will return B<NID_sha1WithRSAEncryption>. Since digests and signature | |||
132 | algorithms are no longer linked this function is only retained for | 131 | algorithms are no longer linked this function is only retained for |
133 | compatibility reasons. | 132 | compatibility reasons. |
134 | 133 | ||
135 | EVP_md2(), EVP_md5(), EVP_sha(), EVP_sha1(), EVP_sha224(), EVP_sha256(), | 134 | EVP_md2(), EVP_md5(), EVP_sha1(), EVP_sha224(), EVP_sha256(), EVP_sha384(), |
136 | EVP_sha384(), EVP_sha512() and EVP_ripemd160() return B<EVP_MD> | 135 | EVP_sha512() and EVP_ripemd160() return B<EVP_MD> structures for the MD2, MD5, |
137 | structures for the MD2, MD5, SHA, SHA1, SHA224, SHA256, SHA384, SHA512 | 136 | SHA1, SHA224, SHA256, SHA384, SHA512 and RIPEMD160 digest algorithms |
138 | and RIPEMD160 digest algorithms respectively. | 137 | respectively. |
139 | 138 | ||
140 | EVP_dss() and EVP_dss1() return B<EVP_MD> structures for SHA and SHA1 digest | 139 | EVP_dss() and EVP_dss1() return B<EVP_MD> structures for SHA1 digest |
141 | algorithms but using DSS (DSA) for the signature algorithm. Note: there is | 140 | algorithms but using DSS (DSA) for the signature algorithm. Note: there is |
142 | no need to use these pseudo-digests in OpenSSL 1.0.0 and later, they are | 141 | no need to use these pseudo-digests in OpenSSL 1.0.0 and later, they are |
143 | however retained for compatibility. | 142 | however retained for compatibility. |
diff --git a/src/regress/lib/libcrypto/Makefile b/src/regress/lib/libcrypto/Makefile index b2247a7b29..a6c1bbffd3 100644 --- a/src/regress/lib/libcrypto/Makefile +++ b/src/regress/lib/libcrypto/Makefile | |||
@@ -1,4 +1,4 @@ | |||
1 | # $OpenBSD: Makefile,v 1.18 2015/06/20 01:07:25 doug Exp $ | 1 | # $OpenBSD: Makefile,v 1.19 2015/09/13 21:09:56 doug Exp $ |
2 | 2 | ||
3 | SUBDIR= \ | 3 | SUBDIR= \ |
4 | aead \ | 4 | aead \ |
@@ -34,7 +34,6 @@ SUBDIR= \ | |||
34 | rc2 \ | 34 | rc2 \ |
35 | rc4 \ | 35 | rc4 \ |
36 | rmd \ | 36 | rmd \ |
37 | sha \ | ||
38 | sha1 \ | 37 | sha1 \ |
39 | sha2 \ | 38 | sha2 \ |
40 | sha256 \ | 39 | sha256 \ |
diff --git a/src/regress/lib/libcrypto/sha/Makefile b/src/regress/lib/libcrypto/sha/Makefile deleted file mode 100644 index 249fb9956e..0000000000 --- a/src/regress/lib/libcrypto/sha/Makefile +++ /dev/null | |||
@@ -1,9 +0,0 @@ | |||
1 | # $OpenBSD: Makefile,v 1.3 2014/07/08 15:53:53 jsing Exp $ | ||
2 | |||
3 | PROG= shatest | ||
4 | LDADD= -lcrypto | ||
5 | DPADD= ${LIBCRYPTO} | ||
6 | WARNINGS= Yes | ||
7 | CFLAGS+= -DLIBRESSL_INTERNAL -Werror | ||
8 | |||
9 | .include <bsd.regress.mk> | ||
diff --git a/src/regress/lib/libcrypto/sha/shatest.c b/src/regress/lib/libcrypto/sha/shatest.c deleted file mode 100644 index d04e6ac6aa..0000000000 --- a/src/regress/lib/libcrypto/sha/shatest.c +++ /dev/null | |||
@@ -1,152 +0,0 @@ | |||
1 | /* crypto/sha/shatest.c */ | ||
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
3 | * All rights reserved. | ||
4 | * | ||
5 | * This package is an SSL implementation written | ||
6 | * by Eric Young (eay@cryptsoft.com). | ||
7 | * The implementation was written so as to conform with Netscapes SSL. | ||
8 | * | ||
9 | * This library is free for commercial and non-commercial use as long as | ||
10 | * the following conditions are aheared to. The following conditions | ||
11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
13 | * included with this distribution is covered by the same copyright terms | ||
14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
15 | * | ||
16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
17 | * the code are not to be removed. | ||
18 | * If this package is used in a product, Eric Young should be given attribution | ||
19 | * as the author of the parts of the library used. | ||
20 | * This can be in the form of a textual message at program startup or | ||
21 | * in documentation (online or textual) provided with the package. | ||
22 | * | ||
23 | * Redistribution and use in source and binary forms, with or without | ||
24 | * modification, are permitted provided that the following conditions | ||
25 | * are met: | ||
26 | * 1. Redistributions of source code must retain the copyright | ||
27 | * notice, this list of conditions and the following disclaimer. | ||
28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
29 | * notice, this list of conditions and the following disclaimer in the | ||
30 | * documentation and/or other materials provided with the distribution. | ||
31 | * 3. All advertising materials mentioning features or use of this software | ||
32 | * must display the following acknowledgement: | ||
33 | * "This product includes cryptographic software written by | ||
34 | * Eric Young (eay@cryptsoft.com)" | ||
35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
36 | * being used are not cryptographic related :-). | ||
37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
38 | * the apps directory (application code) you must include an acknowledgement: | ||
39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
40 | * | ||
41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
51 | * SUCH DAMAGE. | ||
52 | * | ||
53 | * The licence and distribution terms for any publically available version or | ||
54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
55 | * copied and put under another distribution licence | ||
56 | * [including the GNU Public Licence.] | ||
57 | */ | ||
58 | |||
59 | #include <stdio.h> | ||
60 | #include <string.h> | ||
61 | #include <stdlib.h> | ||
62 | |||
63 | #include <openssl/evp.h> | ||
64 | #include <openssl/sha.h> | ||
65 | |||
66 | #define SHA_0 /* FIPS 180 */ | ||
67 | #undef SHA_1 /* FIPS 180-1 */ | ||
68 | |||
69 | static char *test[]={ | ||
70 | "abc", | ||
71 | "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq", | ||
72 | NULL, | ||
73 | }; | ||
74 | |||
75 | #ifdef SHA_0 | ||
76 | static char *ret[]={ | ||
77 | "0164b8a914cd2a5e74c4f7ff082c4d97f1edf880", | ||
78 | "d2516ee1acfa5baf33dfc1c471e438449ef134c8", | ||
79 | }; | ||
80 | static char *bigret= | ||
81 | "3232affa48628a26653b5aaa44541fd90d690603"; | ||
82 | #endif | ||
83 | #ifdef SHA_1 | ||
84 | static char *ret[]={ | ||
85 | "a9993e364706816aba3e25717850c26c9cd0d89d", | ||
86 | "84983e441c3bd26ebaae4aa1f95129e5e54670f1", | ||
87 | }; | ||
88 | static char *bigret= | ||
89 | "34aa973cd4c4daa4f61eeb2bdbad27316534016f"; | ||
90 | #endif | ||
91 | |||
92 | static char *pt(unsigned char *md); | ||
93 | int main(int argc, char *argv[]) | ||
94 | { | ||
95 | int i,err=0; | ||
96 | char **P,**R; | ||
97 | static unsigned char buf[1000]; | ||
98 | char *p,*r; | ||
99 | EVP_MD_CTX c; | ||
100 | unsigned char md[SHA_DIGEST_LENGTH]; | ||
101 | |||
102 | EVP_MD_CTX_init(&c); | ||
103 | P=test; | ||
104 | R=ret; | ||
105 | i=1; | ||
106 | while (*P != NULL) | ||
107 | { | ||
108 | EVP_Digest(*P,strlen(*P),md,NULL,EVP_sha(), NULL); | ||
109 | p=pt(md); | ||
110 | if (strcmp(p,*R) != 0) | ||
111 | { | ||
112 | printf("error calculating SHA on '%s'\n",*P); | ||
113 | printf("got %s instead of %s\n",p,*R); | ||
114 | err++; | ||
115 | } | ||
116 | else | ||
117 | printf("test %d ok\n",i); | ||
118 | i++; | ||
119 | R++; | ||
120 | P++; | ||
121 | } | ||
122 | |||
123 | memset(buf,'a',1000); | ||
124 | EVP_DigestInit_ex(&c,EVP_sha(), NULL); | ||
125 | for (i=0; i<1000; i++) | ||
126 | EVP_DigestUpdate(&c,buf,1000); | ||
127 | EVP_DigestFinal_ex(&c,md,NULL); | ||
128 | p=pt(md); | ||
129 | |||
130 | r=bigret; | ||
131 | if (strcmp(p,r) != 0) | ||
132 | { | ||
133 | printf("error calculating SHA on '%s'\n",p); | ||
134 | printf("got %s instead of %s\n",p,r); | ||
135 | err++; | ||
136 | } | ||
137 | else | ||
138 | printf("test 3 ok\n"); | ||
139 | |||
140 | EVP_MD_CTX_cleanup(&c); | ||
141 | exit(err); | ||
142 | } | ||
143 | |||
144 | static char *pt(unsigned char *md) | ||
145 | { | ||
146 | int i; | ||
147 | static char buf[80]; | ||
148 | |||
149 | for (i=0; i<SHA_DIGEST_LENGTH; i++) | ||
150 | snprintf(buf + i*2, sizeof(buf) - i*2, "%02x",md[i]); | ||
151 | return(buf); | ||
152 | } | ||
diff --git a/src/regress/lib/libcrypto/sha1/sha1test.c b/src/regress/lib/libcrypto/sha1/sha1test.c index 4a18a31459..b7251b31dc 100644 --- a/src/regress/lib/libcrypto/sha1/sha1test.c +++ b/src/regress/lib/libcrypto/sha1/sha1test.c | |||
@@ -63,31 +63,18 @@ | |||
63 | #include <openssl/evp.h> | 63 | #include <openssl/evp.h> |
64 | #include <openssl/sha.h> | 64 | #include <openssl/sha.h> |
65 | 65 | ||
66 | #undef SHA_0 /* FIPS 180 */ | ||
67 | #define SHA_1 /* FIPS 180-1 */ | ||
68 | |||
69 | static char *test[]={ | 66 | static char *test[]={ |
70 | "abc", | 67 | "abc", |
71 | "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq", | 68 | "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq", |
72 | NULL, | 69 | NULL, |
73 | }; | 70 | }; |
74 | 71 | ||
75 | #ifdef SHA_0 | ||
76 | static char *ret[]={ | ||
77 | "0164b8a914cd2a5e74c4f7ff082c4d97f1edf880", | ||
78 | "d2516ee1acfa5baf33dfc1c471e438449ef134c8", | ||
79 | }; | ||
80 | static char *bigret= | ||
81 | "3232affa48628a26653b5aaa44541fd90d690603"; | ||
82 | #endif | ||
83 | #ifdef SHA_1 | ||
84 | static char *ret[]={ | 72 | static char *ret[]={ |
85 | "a9993e364706816aba3e25717850c26c9cd0d89d", | 73 | "a9993e364706816aba3e25717850c26c9cd0d89d", |
86 | "84983e441c3bd26ebaae4aa1f95129e5e54670f1", | 74 | "84983e441c3bd26ebaae4aa1f95129e5e54670f1", |
87 | }; | 75 | }; |
88 | static char *bigret= | 76 | static char *bigret= |
89 | "34aa973cd4c4daa4f61eeb2bdbad27316534016f"; | 77 | "34aa973cd4c4daa4f61eeb2bdbad27316534016f"; |
90 | #endif | ||
91 | 78 | ||
92 | static char *pt(unsigned char *md); | 79 | static char *pt(unsigned char *md); |
93 | int main(int argc, char *argv[]) | 80 | int main(int argc, char *argv[]) |