summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authortb <>2022-01-10 00:03:02 +0000
committertb <>2022-01-10 00:03:02 +0000
commit527922248e66627df0b9ecef2c588946239b180e (patch)
tree1c6cfc1fe3b6c3bd18ba1e97aee7d9c1277e26fe /src
parent491113ed39660975d5cf2c9ba2b26f8b3a4d8d4a (diff)
downloadopenbsd-527922248e66627df0b9ecef2c588946239b180e.tar.gz
openbsd-527922248e66627df0b9ecef2c588946239b180e.tar.bz2
openbsd-527922248e66627df0b9ecef2c588946239b180e.zip
Check that the RSA exponent is neither even nor 1 in RSA_check_key()
Part of OpenSSL commit 464d59a5 ok inoguchi jsing
Diffstat (limited to 'src')
-rw-r--r--src/lib/libcrypto/rsa/rsa_chk.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/lib/libcrypto/rsa/rsa_chk.c b/src/lib/libcrypto/rsa/rsa_chk.c
index 337728d61e..807eae084e 100644
--- a/src/lib/libcrypto/rsa/rsa_chk.c
+++ b/src/lib/libcrypto/rsa/rsa_chk.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: rsa_chk.c,v 1.14 2022/01/07 09:55:32 tb Exp $ */ 1/* $OpenBSD: rsa_chk.c,v 1.15 2022/01/10 00:03:02 tb Exp $ */
2/* ==================================================================== 2/* ====================================================================
3 * Copyright (c) 1999 The OpenSSL Project. All rights reserved. 3 * Copyright (c) 1999 The OpenSSL Project. All rights reserved.
4 * 4 *
@@ -81,6 +81,15 @@ RSA_check_key(const RSA *key)
81 goto err; 81 goto err;
82 } 82 }
83 83
84 if (BN_is_one(key->e)) {
85 ret = 0;
86 RSAerror(RSA_R_BAD_E_VALUE);
87 }
88 if (!BN_is_odd(key->e)) {
89 ret = 0;
90 RSAerror(RSA_R_BAD_E_VALUE);
91 }
92
84 /* p prime? */ 93 /* p prime? */
85 r = BN_is_prime_ex(key->p, BN_prime_checks, NULL, NULL); 94 r = BN_is_prime_ex(key->p, BN_prime_checks, NULL, NULL);
86 if (r != 1) { 95 if (r != 1) {