summaryrefslogtreecommitdiffstats
path: root/lib/libcrypto/rsa
diff options
context:
space:
mode:
authorjsing <jsing@openbsd.org>2017-08-28 17:41:59 +0000
committerjsing <jsing@openbsd.org>2017-08-28 17:41:59 +0000
commite60f121cde2cf72092a917d9a75ccd9bc78ea5d7 (patch)
tree81717b082188b7cd579adf560e83559a13e65da8 /lib/libcrypto/rsa
parentDefine OPENSSL_NO_NEXTPROTONEG since there is no longer any NPN. (diff)
downloadwireguard-openbsd-e60f121cde2cf72092a917d9a75ccd9bc78ea5d7.tar.xz
wireguard-openbsd-e60f121cde2cf72092a917d9a75ccd9bc78ea5d7.zip
Remove RSA_padding_add_SSLv23()/RSA_padding_check_SSLv23() and related
code. We removed SSLv2/SSLv3 a long time ago... Discussed with doug@
Diffstat (limited to 'lib/libcrypto/rsa')
-rw-r--r--lib/libcrypto/rsa/rsa.h9
-rw-r--r--lib/libcrypto/rsa/rsa_eay.c9
-rw-r--r--lib/libcrypto/rsa/rsa_pmeth.c4
-rw-r--r--lib/libcrypto/rsa/rsa_ssl.c147
4 files changed, 3 insertions, 166 deletions
diff --git a/lib/libcrypto/rsa/rsa.h b/lib/libcrypto/rsa/rsa.h
index febeb297d00..777f2fed9eb 100644
--- a/lib/libcrypto/rsa/rsa.h
+++ b/lib/libcrypto/rsa/rsa.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: rsa.h,v 1.29 2016/09/04 17:25:27 jsing Exp $ */
+/* $OpenBSD: rsa.h,v 1.30 2017/08/28 17:41:59 jsing Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@@ -242,7 +242,6 @@ struct rsa_st {
#define EVP_PKEY_CTRL_GET_RSA_MGF1_MD (EVP_PKEY_ALG_CTRL + 8)
#define RSA_PKCS1_PADDING 1
-#define RSA_SSLV23_PADDING 2
#define RSA_NO_PADDING 3
#define RSA_PKCS1_OAEP_PADDING 4
#define RSA_X931_PADDING 5
@@ -367,10 +366,6 @@ int RSA_padding_add_PKCS1_OAEP(unsigned char *to, int tlen,
int RSA_padding_check_PKCS1_OAEP(unsigned char *to, int tlen,
const unsigned char *f, int fl, int rsa_len,
const unsigned char *p, int pl);
-int RSA_padding_add_SSLv23(unsigned char *to, int tlen,
- const unsigned char *f, int fl);
-int RSA_padding_check_SSLv23(unsigned char *to, int tlen,
- const unsigned char *f, int fl, int rsa_len);
int RSA_padding_add_none(unsigned char *to, int tlen,
const unsigned char *f, int fl);
int RSA_padding_check_none(unsigned char *to, int tlen,
@@ -464,13 +459,11 @@ void ERR_load_RSA_strings(void);
#define RSA_F_RSA_PADDING_ADD_PKCS1_PSS_MGF1 148
#define RSA_F_RSA_PADDING_ADD_PKCS1_TYPE_1 108
#define RSA_F_RSA_PADDING_ADD_PKCS1_TYPE_2 109
-#define RSA_F_RSA_PADDING_ADD_SSLV23 110
#define RSA_F_RSA_PADDING_ADD_X931 127
#define RSA_F_RSA_PADDING_CHECK_NONE 111
#define RSA_F_RSA_PADDING_CHECK_PKCS1_OAEP 122
#define RSA_F_RSA_PADDING_CHECK_PKCS1_TYPE_1 112
#define RSA_F_RSA_PADDING_CHECK_PKCS1_TYPE_2 113
-#define RSA_F_RSA_PADDING_CHECK_SSLV23 114
#define RSA_F_RSA_PADDING_CHECK_X931 128
#define RSA_F_RSA_PRINT 115
#define RSA_F_RSA_PRINT_FP 116
diff --git a/lib/libcrypto/rsa/rsa_eay.c b/lib/libcrypto/rsa/rsa_eay.c
index 6c3da0d6562..8e8c6d520d9 100644
--- a/lib/libcrypto/rsa/rsa_eay.c
+++ b/lib/libcrypto/rsa/rsa_eay.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rsa_eay.c,v 1.49 2017/05/02 03:59:45 deraadt Exp $ */
+/* $OpenBSD: rsa_eay.c,v 1.50 2017/08/28 17:41:59 jsing Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@@ -200,9 +200,6 @@ RSA_eay_public_encrypt(int flen, const unsigned char *from, unsigned char *to,
i = RSA_padding_add_PKCS1_OAEP(buf, num, from, flen, NULL, 0);
break;
#endif
- case RSA_SSLV23_PADDING:
- i = RSA_padding_add_SSLv23(buf, num, from, flen);
- break;
case RSA_NO_PADDING:
i = RSA_padding_add_none(buf, num, from, flen);
break;
@@ -383,7 +380,6 @@ RSA_eay_private_encrypt(int flen, const unsigned char *from, unsigned char *to,
case RSA_NO_PADDING:
i = RSA_padding_add_none(buf, num, from, flen);
break;
- case RSA_SSLV23_PADDING:
default:
RSAerror(RSA_R_UNKNOWN_PADDING_TYPE);
goto err;
@@ -573,9 +569,6 @@ RSA_eay_private_decrypt(int flen, const unsigned char *from, unsigned char *to,
r = RSA_padding_check_PKCS1_OAEP(to, num, buf, j, num, NULL, 0);
break;
#endif
- case RSA_SSLV23_PADDING:
- r = RSA_padding_check_SSLv23(to, num, buf, j, num);
- break;
case RSA_NO_PADDING:
r = RSA_padding_check_none(to, num, buf, j, num);
break;
diff --git a/lib/libcrypto/rsa/rsa_pmeth.c b/lib/libcrypto/rsa/rsa_pmeth.c
index 2ef1f3c64ad..b4a4e730c01 100644
--- a/lib/libcrypto/rsa/rsa_pmeth.c
+++ b/lib/libcrypto/rsa/rsa_pmeth.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rsa_pmeth.c,v 1.19 2017/01/29 17:49:23 beck Exp $ */
+/* $OpenBSD: rsa_pmeth.c,v 1.20 2017/08/28 17:41:59 jsing Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
* project 2006.
*/
@@ -466,8 +466,6 @@ pkey_rsa_ctrl_str(EVP_PKEY_CTX *ctx, const char *type, const char *value)
int pm;
if (!strcmp(value, "pkcs1"))
pm = RSA_PKCS1_PADDING;
- else if (!strcmp(value, "sslv23"))
- pm = RSA_SSLV23_PADDING;
else if (!strcmp(value, "none"))
pm = RSA_NO_PADDING;
else if (!strcmp(value, "oeap"))
diff --git a/lib/libcrypto/rsa/rsa_ssl.c b/lib/libcrypto/rsa/rsa_ssl.c
deleted file mode 100644
index 60fc8ec94f8..00000000000
--- a/lib/libcrypto/rsa/rsa_ssl.c
+++ /dev/null
@@ -1,147 +0,0 @@
-/* $OpenBSD: rsa_ssl.c,v 1.15 2017/01/29 17:49:23 beck Exp $ */
-/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
- * All rights reserved.
- *
- * This package is an SSL implementation written
- * by Eric Young (eay@cryptsoft.com).
- * The implementation was written so as to conform with Netscapes SSL.
- *
- * This library is free for commercial and non-commercial use as long as
- * the following conditions are aheared to. The following conditions
- * apply to all code found in this distribution, be it the RC4, RSA,
- * lhash, DES, etc., code; not just the SSL code. The SSL documentation
- * included with this distribution is covered by the same copyright terms
- * except that the holder is Tim Hudson (tjh@cryptsoft.com).
- *
- * Copyright remains Eric Young's, and as such any Copyright notices in
- * the code are not to be removed.
- * If this package is used in a product, Eric Young should be given attribution
- * as the author of the parts of the library used.
- * This can be in the form of a textual message at program startup or
- * in documentation (online or textual) provided with the package.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * "This product includes cryptographic software written by
- * Eric Young (eay@cryptsoft.com)"
- * The word 'cryptographic' can be left out if the rouines from the library
- * being used are not cryptographic related :-).
- * 4. If you include any Windows specific code (or a derivative thereof) from
- * the apps directory (application code) you must include an acknowledgement:
- * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
- *
- * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * The licence and distribution terms for any publically available version or
- * derivative of this code cannot be changed. i.e. this code cannot simply be
- * copied and put under another distribution licence
- * [including the GNU Public Licence.]
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include <openssl/bn.h>
-#include <openssl/err.h>
-#include <openssl/rsa.h>
-
-int
-RSA_padding_add_SSLv23(unsigned char *to, int tlen, const unsigned char *from,
- int flen)
-{
- int i, j;
- unsigned char *p;
-
- if (flen > tlen - 11) {
- RSAerror(RSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE);
- return 0;
- }
-
- p = (unsigned char *)to;
-
- *(p++) = 0;
- *(p++) = 2; /* Public Key BT (Block Type) */
-
- /* pad out with non-zero random data */
- j = tlen - 3 - 8 - flen;
-
- arc4random_buf(p, j);
- for (i = 0; i < j; i++) {
- while (*p == '\0')
- arc4random_buf(p, 1);
- p++;
- }
-
- memset(p, 3, 8);
- p += 8;
- *(p++) = '\0';
-
- memcpy(p, from, flen);
- return 1;
-}
-
-int
-RSA_padding_check_SSLv23(unsigned char *to, int tlen, const unsigned char *from,
- int flen, int num)
-{
- int i, j, k;
- const unsigned char *p;
-
- p = from;
- if (flen < 10) {
- RSAerror(RSA_R_DATA_TOO_SMALL);
- return -1;
- }
- if (num != flen + 1 || *(p++) != 02) {
- RSAerror(RSA_R_BLOCK_TYPE_IS_NOT_02);
- return -1;
- }
-
- /* scan over padding data */
- j = flen - 1; /* one for type */
- for (i = 0; i < j; i++)
- if (*(p++) == 0)
- break;
-
- if (i == j || i < 8) {
- RSAerror(RSA_R_NULL_BEFORE_BLOCK_MISSING);
- return -1;
- }
- for (k = -9; k < -1; k++) {
- if (p[k] != 0x03)
- break;
- }
- if (k == -1) {
- RSAerror(RSA_R_SSLV3_ROLLBACK_ATTACK);
- return -1;
- }
-
- i++; /* Skip over the '\0' */
- j -= i;
- if (j > tlen) {
- RSAerror(RSA_R_DATA_TOO_LARGE);
- return -1;
- }
- memcpy(to, p, j);
-
- return j;
-}