Skip to content

Commit 815eee1

Browse files
Add null check on RSA key checks (#2727)
Was running into segfaults with this with some internal builds switching over to AWS-LC. By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license and the ISC license.
1 parent 4eb8aca commit 815eee1

File tree

1 file changed

+3
-0
lines changed
  • crypto/fipsmodule/rsa

1 file changed

+3
-0
lines changed

crypto/fipsmodule/rsa/rsa.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1270,6 +1270,8 @@ static enum rsa_key_type_for_checking determine_key_type_for_checking(const RSA
12701270
// the function can work with.
12711271
int RSA_check_key(const RSA *key) {
12721272
SET_DIT_AUTO_RESET;
1273+
GUARD_PTR(key);
1274+
12731275
enum rsa_key_type_for_checking key_type = determine_key_type_for_checking(key);
12741276
if (key_type == RSA_KEY_TYPE_FOR_CHECKING_INVALID) {
12751277
OPENSSL_PUT_ERROR(RSA, RSA_R_BAD_RSA_PARAMETERS);
@@ -1501,6 +1503,7 @@ DEFINE_LOCAL_DATA(BIGNUM, g_small_factors) {
15011503
// approved FIPS services.
15021504
int RSA_check_fips(RSA *key) {
15031505
SET_DIT_AUTO_RESET;
1506+
GUARD_PTR(key);
15041507

15051508
enum rsa_key_type_for_checking key_type = determine_key_type_for_checking(key);
15061509
// In addition to invalid key type, stripped private keys can not be checked

0 commit comments

Comments
 (0)