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 /src/lib/libcrypto/sha | |
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@
Diffstat (limited to 'src/lib/libcrypto/sha')
-rw-r--r-- | src/lib/libcrypto/sha/sha.h | 13 | ||||
-rw-r--r-- | src/lib/libcrypto/sha/sha1dgst.c | 5 | ||||
-rw-r--r-- | src/lib/libcrypto/sha/sha_dgst.c | 74 | ||||
-rw-r--r-- | src/lib/libcrypto/sha/sha_locl.h | 27 | ||||
-rw-r--r-- | src/lib/libcrypto/sha/sha_one.c | 81 |
5 files changed, 6 insertions, 194 deletions
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 | ||