diff options
author | jsing <> | 2017-08-28 17:41:59 +0000 |
---|---|---|
committer | jsing <> | 2017-08-28 17:41:59 +0000 |
commit | 437b7aac4231ead6a94ceec52527723a4251d08f (patch) | |
tree | e8ae027147094ed282883c2e3f0c3fa11dca43e3 | |
parent | 5733d30e24c718396f0cb7a581715068ef000d42 (diff) | |
download | openbsd-437b7aac4231ead6a94ceec52527723a4251d08f.tar.gz openbsd-437b7aac4231ead6a94ceec52527723a4251d08f.tar.bz2 openbsd-437b7aac4231ead6a94ceec52527723a4251d08f.zip |
Remove RSA_padding_add_SSLv23()/RSA_padding_check_SSLv23() and related
code. We removed SSLv2/SSLv3 a long time ago...
Discussed with doug@
-rw-r--r-- | src/lib/libcrypto/Makefile | 4 | ||||
-rw-r--r-- | src/lib/libcrypto/Symbols.list | 2 | ||||
-rw-r--r-- | src/lib/libcrypto/man/EVP_PKEY_CTX_ctrl.3 | 6 | ||||
-rw-r--r-- | src/lib/libcrypto/man/RSA_padding_add_PKCS1_type_1.3 | 25 | ||||
-rw-r--r-- | src/lib/libcrypto/man/RSA_public_encrypt.3 | 7 | ||||
-rw-r--r-- | src/lib/libcrypto/rsa/rsa.h | 9 | ||||
-rw-r--r-- | src/lib/libcrypto/rsa/rsa_eay.c | 9 | ||||
-rw-r--r-- | src/lib/libcrypto/rsa/rsa_pmeth.c | 4 | ||||
-rw-r--r-- | src/lib/libcrypto/rsa/rsa_ssl.c | 147 |
9 files changed, 11 insertions, 202 deletions
diff --git a/src/lib/libcrypto/Makefile b/src/lib/libcrypto/Makefile index 7ad76c881a..5432bab176 100644 --- a/src/lib/libcrypto/Makefile +++ b/src/lib/libcrypto/Makefile | |||
@@ -1,4 +1,4 @@ | |||
1 | # $OpenBSD: Makefile,v 1.22 2017/08/20 17:53:12 espie Exp $ | 1 | # $OpenBSD: Makefile,v 1.23 2017/08/28 17:41:59 jsing Exp $ |
2 | 2 | ||
3 | LIB= crypto | 3 | LIB= crypto |
4 | LIBREBUILD=y | 4 | LIBREBUILD=y |
@@ -225,7 +225,7 @@ SRCS+= rmd_dgst.c rmd_one.c | |||
225 | 225 | ||
226 | # rsa/ | 226 | # rsa/ |
227 | SRCS+= rsa_eay.c rsa_gen.c rsa_lib.c rsa_sign.c rsa_saos.c rsa_err.c | 227 | SRCS+= rsa_eay.c rsa_gen.c rsa_lib.c rsa_sign.c rsa_saos.c rsa_err.c |
228 | SRCS+= rsa_pk1.c rsa_ssl.c rsa_none.c rsa_oaep.c rsa_chk.c | 228 | SRCS+= rsa_pk1.c rsa_none.c rsa_oaep.c rsa_chk.c |
229 | SRCS+= rsa_pss.c rsa_x931.c rsa_asn1.c rsa_depr.c rsa_ameth.c rsa_prn.c | 229 | SRCS+= rsa_pss.c rsa_x931.c rsa_asn1.c rsa_depr.c rsa_ameth.c rsa_prn.c |
230 | SRCS+= rsa_pmeth.c rsa_crpt.c | 230 | SRCS+= rsa_pmeth.c rsa_crpt.c |
231 | 231 | ||
diff --git a/src/lib/libcrypto/Symbols.list b/src/lib/libcrypto/Symbols.list index 94442cc5e3..53aa96939a 100644 --- a/src/lib/libcrypto/Symbols.list +++ b/src/lib/libcrypto/Symbols.list | |||
@@ -2193,13 +2193,11 @@ RSA_padding_add_PKCS1_PSS | |||
2193 | RSA_padding_add_PKCS1_PSS_mgf1 | 2193 | RSA_padding_add_PKCS1_PSS_mgf1 |
2194 | RSA_padding_add_PKCS1_type_1 | 2194 | RSA_padding_add_PKCS1_type_1 |
2195 | RSA_padding_add_PKCS1_type_2 | 2195 | RSA_padding_add_PKCS1_type_2 |
2196 | RSA_padding_add_SSLv23 | ||
2197 | RSA_padding_add_X931 | 2196 | RSA_padding_add_X931 |
2198 | RSA_padding_add_none | 2197 | RSA_padding_add_none |
2199 | RSA_padding_check_PKCS1_OAEP | 2198 | RSA_padding_check_PKCS1_OAEP |
2200 | RSA_padding_check_PKCS1_type_1 | 2199 | RSA_padding_check_PKCS1_type_1 |
2201 | RSA_padding_check_PKCS1_type_2 | 2200 | RSA_padding_check_PKCS1_type_2 |
2202 | RSA_padding_check_SSLv23 | ||
2203 | RSA_padding_check_X931 | 2201 | RSA_padding_check_X931 |
2204 | RSA_padding_check_none | 2202 | RSA_padding_check_none |
2205 | RSA_print | 2203 | RSA_print |
diff --git a/src/lib/libcrypto/man/EVP_PKEY_CTX_ctrl.3 b/src/lib/libcrypto/man/EVP_PKEY_CTX_ctrl.3 index 2ceae6ee20..b65ea0d5d3 100644 --- a/src/lib/libcrypto/man/EVP_PKEY_CTX_ctrl.3 +++ b/src/lib/libcrypto/man/EVP_PKEY_CTX_ctrl.3 | |||
@@ -1,4 +1,4 @@ | |||
1 | .\" $OpenBSD: EVP_PKEY_CTX_ctrl.3,v 1.7 2017/08/20 18:51:58 schwarze Exp $ | 1 | .\" $OpenBSD: EVP_PKEY_CTX_ctrl.3,v 1.8 2017/08/28 17:41:59 jsing Exp $ |
2 | .\" OpenSSL EVP_PKEY_CTX_ctrl.pod 1722496f Jun 8 15:18:38 2017 -0400 | 2 | .\" OpenSSL EVP_PKEY_CTX_ctrl.pod 1722496f Jun 8 15:18:38 2017 -0400 |
3 | .\" OpenSSL EVP_PKEY_CTX_ctrl.pod e03af178 Dec 11 17:05:57 2014 -0500 | 3 | .\" OpenSSL EVP_PKEY_CTX_ctrl.pod e03af178 Dec 11 17:05:57 2014 -0500 |
4 | .\" | 4 | .\" |
@@ -50,7 +50,7 @@ | |||
50 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 50 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
51 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 51 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
52 | .\" | 52 | .\" |
53 | .Dd $Mdocdate: August 20 2017 $ | 53 | .Dd $Mdocdate: August 28 2017 $ |
54 | .Dt EVP_PKEY_CTX_CTRL 3 | 54 | .Dt EVP_PKEY_CTX_CTRL 3 |
55 | .Os | 55 | .Os |
56 | .Sh NAME | 56 | .Sh NAME |
@@ -191,8 +191,6 @@ The | |||
191 | parameter can take the value | 191 | parameter can take the value |
192 | .Dv RSA_PKCS1_PADDING | 192 | .Dv RSA_PKCS1_PADDING |
193 | for PKCS#1 padding, | 193 | for PKCS#1 padding, |
194 | .Dv RSA_SSLV23_PADDING | ||
195 | for SSLv23 padding, | ||
196 | .Dv RSA_NO_PADDING | 194 | .Dv RSA_NO_PADDING |
197 | for no padding, | 195 | for no padding, |
198 | .Dv RSA_PKCS1_OAEP_PADDING | 196 | .Dv RSA_PKCS1_OAEP_PADDING |
diff --git a/src/lib/libcrypto/man/RSA_padding_add_PKCS1_type_1.3 b/src/lib/libcrypto/man/RSA_padding_add_PKCS1_type_1.3 index 29a0eae1b4..2d67440355 100644 --- a/src/lib/libcrypto/man/RSA_padding_add_PKCS1_type_1.3 +++ b/src/lib/libcrypto/man/RSA_padding_add_PKCS1_type_1.3 | |||
@@ -1,4 +1,4 @@ | |||
1 | .\" $OpenBSD: RSA_padding_add_PKCS1_type_1.3,v 1.5 2017/08/20 20:45:18 schwarze Exp $ | 1 | .\" $OpenBSD: RSA_padding_add_PKCS1_type_1.3,v 1.6 2017/08/28 17:41:59 jsing Exp $ |
2 | .\" OpenSSL 1e3f62a3 Jul 17 16:47:13 2017 +0200 | 2 | .\" OpenSSL 1e3f62a3 Jul 17 16:47:13 2017 +0200 |
3 | .\" | 3 | .\" |
4 | .\" This file was written by Ulf Moeller <ulf@openssl.org>. | 4 | .\" This file was written by Ulf Moeller <ulf@openssl.org>. |
@@ -48,7 +48,7 @@ | |||
48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
50 | .\" | 50 | .\" |
51 | .Dd $Mdocdate: August 20 2017 $ | 51 | .Dd $Mdocdate: August 28 2017 $ |
52 | .Dt RSA_PADDING_ADD_PKCS1_TYPE_1 3 | 52 | .Dt RSA_PADDING_ADD_PKCS1_TYPE_1 3 |
53 | .Os | 53 | .Os |
54 | .Sh NAME | 54 | .Sh NAME |
@@ -58,8 +58,6 @@ | |||
58 | .Nm RSA_padding_check_PKCS1_type_2 , | 58 | .Nm RSA_padding_check_PKCS1_type_2 , |
59 | .Nm RSA_padding_add_PKCS1_OAEP , | 59 | .Nm RSA_padding_add_PKCS1_OAEP , |
60 | .Nm RSA_padding_check_PKCS1_OAEP , | 60 | .Nm RSA_padding_check_PKCS1_OAEP , |
61 | .Nm RSA_padding_add_SSLv23 , | ||
62 | .Nm RSA_padding_check_SSLv23 , | ||
63 | .Nm RSA_padding_add_none , | 61 | .Nm RSA_padding_add_none , |
64 | .Nm RSA_padding_check_none | 62 | .Nm RSA_padding_check_none |
65 | .Nd asymmetric encryption padding | 63 | .Nd asymmetric encryption padding |
@@ -115,21 +113,6 @@ | |||
115 | .Fa "int pl" | 113 | .Fa "int pl" |
116 | .Fc | 114 | .Fc |
117 | .Ft int | 115 | .Ft int |
118 | .Fo RSA_padding_add_SSLv23 | ||
119 | .Fa "unsigned char *to" | ||
120 | .Fa "int tlen" | ||
121 | .Fa "unsigned char *f" | ||
122 | .Fa "int fl" | ||
123 | .Fc | ||
124 | .Ft int | ||
125 | .Fo RSA_padding_check_SSLv23 | ||
126 | .Fa "unsigned char *to" | ||
127 | .Fa "int tlen" | ||
128 | .Fa "unsigned char *f" | ||
129 | .Fa "int fl" | ||
130 | .Fa "int rsa_len" | ||
131 | .Fc | ||
132 | .Ft int | ||
133 | .Fo RSA_padding_add_none | 116 | .Fo RSA_padding_add_none |
134 | .Fa "unsigned char *to" | 117 | .Fa "unsigned char *to" |
135 | .Fa "int tlen" | 118 | .Fa "int tlen" |
@@ -181,8 +164,6 @@ used for signatures | |||
181 | PKCS #1 v2.0 EME-PKCS1-v1_5 (PKCS #1 v1.5 block type 2) | 164 | PKCS #1 v2.0 EME-PKCS1-v1_5 (PKCS #1 v1.5 block type 2) |
182 | .It PKCS1_OAEP | 165 | .It PKCS1_OAEP |
183 | PKCS #1 v2.0 EME-OAEP | 166 | PKCS #1 v2.0 EME-OAEP |
184 | .It SSLv23 | ||
185 | PKCS #1 EME-PKCS1-v1_5 with SSL-specific modification | ||
186 | .It none | 167 | .It none |
187 | simply copy the data | 168 | simply copy the data |
188 | .El | 169 | .El |
@@ -235,8 +216,6 @@ Error codes can be obtained by calling | |||
235 | .Fn RSA_padding_check_PKCS1_type_1 , | 216 | .Fn RSA_padding_check_PKCS1_type_1 , |
236 | .Fn RSA_padding_add_PKCS1_type_2 , | 217 | .Fn RSA_padding_add_PKCS1_type_2 , |
237 | .Fn RSA_padding_check_PKCS1_type_2 , | 218 | .Fn RSA_padding_check_PKCS1_type_2 , |
238 | .Fn RSA_padding_add_SSLv23 , | ||
239 | .Fn RSA_padding_check_SSLv23 , | ||
240 | .Fn RSA_padding_add_none , | 219 | .Fn RSA_padding_add_none , |
241 | and | 220 | and |
242 | .Fn RSA_padding_check_none | 221 | .Fn RSA_padding_check_none |
diff --git a/src/lib/libcrypto/man/RSA_public_encrypt.3 b/src/lib/libcrypto/man/RSA_public_encrypt.3 index c830d5d767..be90fb12d8 100644 --- a/src/lib/libcrypto/man/RSA_public_encrypt.3 +++ b/src/lib/libcrypto/man/RSA_public_encrypt.3 | |||
@@ -1,4 +1,4 @@ | |||
1 | .\" $OpenBSD: RSA_public_encrypt.3,v 1.7 2017/08/20 20:53:04 schwarze Exp $ | 1 | .\" $OpenBSD: RSA_public_encrypt.3,v 1.8 2017/08/28 17:41:59 jsing Exp $ |
2 | .\" OpenSSL RSA_public_encrypt.pod 1e3f62a3 Jul 17 16:47:13 2017 +0200 | 2 | .\" OpenSSL RSA_public_encrypt.pod 1e3f62a3 Jul 17 16:47:13 2017 +0200 |
3 | .\" | 3 | .\" |
4 | .\" This file was written by Ulf Moeller <ulf@openssl.org>. | 4 | .\" This file was written by Ulf Moeller <ulf@openssl.org>. |
@@ -48,7 +48,7 @@ | |||
48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
50 | .\" | 50 | .\" |
51 | .Dd $Mdocdate: August 20 2017 $ | 51 | .Dd $Mdocdate: August 28 2017 $ |
52 | .Dt RSA_PUBLIC_ENCRYPT 3 | 52 | .Dt RSA_PUBLIC_ENCRYPT 3 |
53 | .Os | 53 | .Os |
54 | .Sh NAME | 54 | .Sh NAME |
@@ -98,9 +98,6 @@ This currently is the most widely used mode. | |||
98 | EME-OAEP as defined in PKCS #1 v2.0 with SHA-1, MGF1 and an empty | 98 | EME-OAEP as defined in PKCS #1 v2.0 with SHA-1, MGF1 and an empty |
99 | encoding parameter. | 99 | encoding parameter. |
100 | This mode is recommended for all new applications. | 100 | This mode is recommended for all new applications. |
101 | .It Dv RSA_SSLV23_PADDING | ||
102 | PKCS #1 v1.5 padding with an SSL-specific modification that denotes that | ||
103 | the server is SSL3 capable. | ||
104 | .It Dv RSA_NO_PADDING | 101 | .It Dv RSA_NO_PADDING |
105 | Raw RSA encryption. | 102 | Raw RSA encryption. |
106 | This mode should only be used to implement cryptographically sound | 103 | This mode should only be used to implement cryptographically sound |
diff --git a/src/lib/libcrypto/rsa/rsa.h b/src/lib/libcrypto/rsa/rsa.h index febeb297d0..777f2fed9e 100644 --- a/src/lib/libcrypto/rsa/rsa.h +++ b/src/lib/libcrypto/rsa/rsa.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: rsa.h,v 1.29 2016/09/04 17:25:27 jsing Exp $ */ | 1 | /* $OpenBSD: rsa.h,v 1.30 2017/08/28 17:41:59 jsing 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 | * |
@@ -242,7 +242,6 @@ struct rsa_st { | |||
242 | #define EVP_PKEY_CTRL_GET_RSA_MGF1_MD (EVP_PKEY_ALG_CTRL + 8) | 242 | #define EVP_PKEY_CTRL_GET_RSA_MGF1_MD (EVP_PKEY_ALG_CTRL + 8) |
243 | 243 | ||
244 | #define RSA_PKCS1_PADDING 1 | 244 | #define RSA_PKCS1_PADDING 1 |
245 | #define RSA_SSLV23_PADDING 2 | ||
246 | #define RSA_NO_PADDING 3 | 245 | #define RSA_NO_PADDING 3 |
247 | #define RSA_PKCS1_OAEP_PADDING 4 | 246 | #define RSA_PKCS1_OAEP_PADDING 4 |
248 | #define RSA_X931_PADDING 5 | 247 | #define RSA_X931_PADDING 5 |
@@ -367,10 +366,6 @@ int RSA_padding_add_PKCS1_OAEP(unsigned char *to, int tlen, | |||
367 | int RSA_padding_check_PKCS1_OAEP(unsigned char *to, int tlen, | 366 | int RSA_padding_check_PKCS1_OAEP(unsigned char *to, int tlen, |
368 | const unsigned char *f, int fl, int rsa_len, | 367 | const unsigned char *f, int fl, int rsa_len, |
369 | const unsigned char *p, int pl); | 368 | const unsigned char *p, int pl); |
370 | int RSA_padding_add_SSLv23(unsigned char *to, int tlen, | ||
371 | const unsigned char *f, int fl); | ||
372 | int RSA_padding_check_SSLv23(unsigned char *to, int tlen, | ||
373 | const unsigned char *f, int fl, int rsa_len); | ||
374 | int RSA_padding_add_none(unsigned char *to, int tlen, | 369 | int RSA_padding_add_none(unsigned char *to, int tlen, |
375 | const unsigned char *f, int fl); | 370 | const unsigned char *f, int fl); |
376 | int RSA_padding_check_none(unsigned char *to, int tlen, | 371 | int RSA_padding_check_none(unsigned char *to, int tlen, |
@@ -464,13 +459,11 @@ void ERR_load_RSA_strings(void); | |||
464 | #define RSA_F_RSA_PADDING_ADD_PKCS1_PSS_MGF1 148 | 459 | #define RSA_F_RSA_PADDING_ADD_PKCS1_PSS_MGF1 148 |
465 | #define RSA_F_RSA_PADDING_ADD_PKCS1_TYPE_1 108 | 460 | #define RSA_F_RSA_PADDING_ADD_PKCS1_TYPE_1 108 |
466 | #define RSA_F_RSA_PADDING_ADD_PKCS1_TYPE_2 109 | 461 | #define RSA_F_RSA_PADDING_ADD_PKCS1_TYPE_2 109 |
467 | #define RSA_F_RSA_PADDING_ADD_SSLV23 110 | ||
468 | #define RSA_F_RSA_PADDING_ADD_X931 127 | 462 | #define RSA_F_RSA_PADDING_ADD_X931 127 |
469 | #define RSA_F_RSA_PADDING_CHECK_NONE 111 | 463 | #define RSA_F_RSA_PADDING_CHECK_NONE 111 |
470 | #define RSA_F_RSA_PADDING_CHECK_PKCS1_OAEP 122 | 464 | #define RSA_F_RSA_PADDING_CHECK_PKCS1_OAEP 122 |
471 | #define RSA_F_RSA_PADDING_CHECK_PKCS1_TYPE_1 112 | 465 | #define RSA_F_RSA_PADDING_CHECK_PKCS1_TYPE_1 112 |
472 | #define RSA_F_RSA_PADDING_CHECK_PKCS1_TYPE_2 113 | 466 | #define RSA_F_RSA_PADDING_CHECK_PKCS1_TYPE_2 113 |
473 | #define RSA_F_RSA_PADDING_CHECK_SSLV23 114 | ||
474 | #define RSA_F_RSA_PADDING_CHECK_X931 128 | 467 | #define RSA_F_RSA_PADDING_CHECK_X931 128 |
475 | #define RSA_F_RSA_PRINT 115 | 468 | #define RSA_F_RSA_PRINT 115 |
476 | #define RSA_F_RSA_PRINT_FP 116 | 469 | #define RSA_F_RSA_PRINT_FP 116 |
diff --git a/src/lib/libcrypto/rsa/rsa_eay.c b/src/lib/libcrypto/rsa/rsa_eay.c index 6c3da0d656..8e8c6d520d 100644 --- a/src/lib/libcrypto/rsa/rsa_eay.c +++ b/src/lib/libcrypto/rsa/rsa_eay.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: rsa_eay.c,v 1.49 2017/05/02 03:59:45 deraadt Exp $ */ | 1 | /* $OpenBSD: rsa_eay.c,v 1.50 2017/08/28 17:41:59 jsing 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 | * |
@@ -200,9 +200,6 @@ RSA_eay_public_encrypt(int flen, const unsigned char *from, unsigned char *to, | |||
200 | i = RSA_padding_add_PKCS1_OAEP(buf, num, from, flen, NULL, 0); | 200 | i = RSA_padding_add_PKCS1_OAEP(buf, num, from, flen, NULL, 0); |
201 | break; | 201 | break; |
202 | #endif | 202 | #endif |
203 | case RSA_SSLV23_PADDING: | ||
204 | i = RSA_padding_add_SSLv23(buf, num, from, flen); | ||
205 | break; | ||
206 | case RSA_NO_PADDING: | 203 | case RSA_NO_PADDING: |
207 | i = RSA_padding_add_none(buf, num, from, flen); | 204 | i = RSA_padding_add_none(buf, num, from, flen); |
208 | break; | 205 | break; |
@@ -383,7 +380,6 @@ RSA_eay_private_encrypt(int flen, const unsigned char *from, unsigned char *to, | |||
383 | case RSA_NO_PADDING: | 380 | case RSA_NO_PADDING: |
384 | i = RSA_padding_add_none(buf, num, from, flen); | 381 | i = RSA_padding_add_none(buf, num, from, flen); |
385 | break; | 382 | break; |
386 | case RSA_SSLV23_PADDING: | ||
387 | default: | 383 | default: |
388 | RSAerror(RSA_R_UNKNOWN_PADDING_TYPE); | 384 | RSAerror(RSA_R_UNKNOWN_PADDING_TYPE); |
389 | goto err; | 385 | goto err; |
@@ -573,9 +569,6 @@ RSA_eay_private_decrypt(int flen, const unsigned char *from, unsigned char *to, | |||
573 | r = RSA_padding_check_PKCS1_OAEP(to, num, buf, j, num, NULL, 0); | 569 | r = RSA_padding_check_PKCS1_OAEP(to, num, buf, j, num, NULL, 0); |
574 | break; | 570 | break; |
575 | #endif | 571 | #endif |
576 | case RSA_SSLV23_PADDING: | ||
577 | r = RSA_padding_check_SSLv23(to, num, buf, j, num); | ||
578 | break; | ||
579 | case RSA_NO_PADDING: | 572 | case RSA_NO_PADDING: |
580 | r = RSA_padding_check_none(to, num, buf, j, num); | 573 | r = RSA_padding_check_none(to, num, buf, j, num); |
581 | break; | 574 | break; |
diff --git a/src/lib/libcrypto/rsa/rsa_pmeth.c b/src/lib/libcrypto/rsa/rsa_pmeth.c index 2ef1f3c64a..b4a4e730c0 100644 --- a/src/lib/libcrypto/rsa/rsa_pmeth.c +++ b/src/lib/libcrypto/rsa/rsa_pmeth.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: rsa_pmeth.c,v 1.19 2017/01/29 17:49:23 beck Exp $ */ | 1 | /* $OpenBSD: rsa_pmeth.c,v 1.20 2017/08/28 17:41:59 jsing Exp $ */ |
2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
3 | * project 2006. | 3 | * project 2006. |
4 | */ | 4 | */ |
@@ -466,8 +466,6 @@ pkey_rsa_ctrl_str(EVP_PKEY_CTX *ctx, const char *type, const char *value) | |||
466 | int pm; | 466 | int pm; |
467 | if (!strcmp(value, "pkcs1")) | 467 | if (!strcmp(value, "pkcs1")) |
468 | pm = RSA_PKCS1_PADDING; | 468 | pm = RSA_PKCS1_PADDING; |
469 | else if (!strcmp(value, "sslv23")) | ||
470 | pm = RSA_SSLV23_PADDING; | ||
471 | else if (!strcmp(value, "none")) | 469 | else if (!strcmp(value, "none")) |
472 | pm = RSA_NO_PADDING; | 470 | pm = RSA_NO_PADDING; |
473 | else if (!strcmp(value, "oeap")) | 471 | else if (!strcmp(value, "oeap")) |
diff --git a/src/lib/libcrypto/rsa/rsa_ssl.c b/src/lib/libcrypto/rsa/rsa_ssl.c deleted file mode 100644 index 60fc8ec94f..0000000000 --- a/src/lib/libcrypto/rsa/rsa_ssl.c +++ /dev/null | |||
@@ -1,147 +0,0 @@ | |||
1 | /* $OpenBSD: rsa_ssl.c,v 1.15 2017/01/29 17:49:23 beck 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 <stdlib.h> | ||
61 | #include <string.h> | ||
62 | |||
63 | #include <openssl/bn.h> | ||
64 | #include <openssl/err.h> | ||
65 | #include <openssl/rsa.h> | ||
66 | |||
67 | int | ||
68 | RSA_padding_add_SSLv23(unsigned char *to, int tlen, const unsigned char *from, | ||
69 | int flen) | ||
70 | { | ||
71 | int i, j; | ||
72 | unsigned char *p; | ||
73 | |||
74 | if (flen > tlen - 11) { | ||
75 | RSAerror(RSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE); | ||
76 | return 0; | ||
77 | } | ||
78 | |||
79 | p = (unsigned char *)to; | ||
80 | |||
81 | *(p++) = 0; | ||
82 | *(p++) = 2; /* Public Key BT (Block Type) */ | ||
83 | |||
84 | /* pad out with non-zero random data */ | ||
85 | j = tlen - 3 - 8 - flen; | ||
86 | |||
87 | arc4random_buf(p, j); | ||
88 | for (i = 0; i < j; i++) { | ||
89 | while (*p == '\0') | ||
90 | arc4random_buf(p, 1); | ||
91 | p++; | ||
92 | } | ||
93 | |||
94 | memset(p, 3, 8); | ||
95 | p += 8; | ||
96 | *(p++) = '\0'; | ||
97 | |||
98 | memcpy(p, from, flen); | ||
99 | return 1; | ||
100 | } | ||
101 | |||
102 | int | ||
103 | RSA_padding_check_SSLv23(unsigned char *to, int tlen, const unsigned char *from, | ||
104 | int flen, int num) | ||
105 | { | ||
106 | int i, j, k; | ||
107 | const unsigned char *p; | ||
108 | |||
109 | p = from; | ||
110 | if (flen < 10) { | ||
111 | RSAerror(RSA_R_DATA_TOO_SMALL); | ||
112 | return -1; | ||
113 | } | ||
114 | if (num != flen + 1 || *(p++) != 02) { | ||
115 | RSAerror(RSA_R_BLOCK_TYPE_IS_NOT_02); | ||
116 | return -1; | ||
117 | } | ||
118 | |||
119 | /* scan over padding data */ | ||
120 | j = flen - 1; /* one for type */ | ||
121 | for (i = 0; i < j; i++) | ||
122 | if (*(p++) == 0) | ||
123 | break; | ||
124 | |||
125 | if (i == j || i < 8) { | ||
126 | RSAerror(RSA_R_NULL_BEFORE_BLOCK_MISSING); | ||
127 | return -1; | ||
128 | } | ||
129 | for (k = -9; k < -1; k++) { | ||
130 | if (p[k] != 0x03) | ||
131 | break; | ||
132 | } | ||
133 | if (k == -1) { | ||
134 | RSAerror(RSA_R_SSLV3_ROLLBACK_ATTACK); | ||
135 | return -1; | ||
136 | } | ||
137 | |||
138 | i++; /* Skip over the '\0' */ | ||
139 | j -= i; | ||
140 | if (j > tlen) { | ||
141 | RSAerror(RSA_R_DATA_TOO_LARGE); | ||
142 | return -1; | ||
143 | } | ||
144 | memcpy(to, p, j); | ||
145 | |||
146 | return j; | ||
147 | } | ||