early-access version 2698
This commit is contained in:
14
externals/libressl/crypto/rsa/rsa_chk.c
vendored
14
externals/libressl/crypto/rsa/rsa_chk.c
vendored
@@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: rsa_chk.c,v 1.13 2017/01/29 17:49:23 beck Exp $ */
|
||||
/* $OpenBSD: rsa_chk.c,v 1.16 2022/01/20 11:08:12 inoguchi Exp $ */
|
||||
/* ====================================================================
|
||||
* Copyright (c) 1999 The OpenSSL Project. All rights reserved.
|
||||
*
|
||||
@@ -53,6 +53,7 @@
|
||||
#include <openssl/rsa.h>
|
||||
|
||||
#include "bn_lcl.h"
|
||||
#include "rsa_locl.h"
|
||||
|
||||
int
|
||||
RSA_check_key(const RSA *key)
|
||||
@@ -80,6 +81,15 @@ RSA_check_key(const RSA *key)
|
||||
goto err;
|
||||
}
|
||||
|
||||
if (BN_is_one(key->e)) {
|
||||
ret = 0;
|
||||
RSAerror(RSA_R_BAD_E_VALUE);
|
||||
}
|
||||
if (!BN_is_odd(key->e)) {
|
||||
ret = 0;
|
||||
RSAerror(RSA_R_BAD_E_VALUE);
|
||||
}
|
||||
|
||||
/* p prime? */
|
||||
r = BN_is_prime_ex(key->p, BN_prime_checks, NULL, NULL);
|
||||
if (r != 1) {
|
||||
@@ -189,7 +199,7 @@ RSA_check_key(const RSA *key)
|
||||
}
|
||||
|
||||
/* iqmp = q^-1 mod p? */
|
||||
if (!BN_mod_inverse_ct(i, key->q, key->p, ctx)) {
|
||||
if (BN_mod_inverse_ct(i, key->q, key->p, ctx) == NULL) {
|
||||
ret = -1;
|
||||
goto err;
|
||||
}
|
||||
|
Reference in New Issue
Block a user