1 |
diff -up openssl-3.0.1/providers/implementations/kem/rsa_kem.c.encap openssl-3.0.1/providers/implementations/kem/rsa_kem.c |
2 |
--- openssl-3.0.1/providers/implementations/kem/rsa_kem.c.encap 2022-11-22 12:27:30.994530801 +0100 |
3 |
+++ openssl-3.0.1/providers/implementations/kem/rsa_kem.c 2022-11-22 12:32:15.916875495 +0100 |
4 |
@@ -264,6 +264,14 @@ static int rsasve_generate(PROV_RSA_CTX |
5 |
*secretlen = nlen; |
6 |
return 1; |
7 |
} |
8 |
+ |
9 |
+#ifdef FIPS_MODULE |
10 |
+ if (nlen < OPENSSL_RSA_FIPS_MIN_MODULUS_BITS/8) { |
11 |
+ ERR_raise(ERR_LIB_PROV, PROV_R_KEY_SIZE_TOO_SMALL); |
12 |
+ return 0; |
13 |
+ } |
14 |
+#endif |
15 |
+ |
16 |
/* |
17 |
* Step (2): Generate a random byte string z of nlen bytes where |
18 |
* 1 < z < n - 1 |
19 |
@@ -307,6 +315,13 @@ static int rsasve_recover(PROV_RSA_CTX * |
20 |
return 1; |
21 |
} |
22 |
|
23 |
+#ifdef FIPS_MODULE |
24 |
+ if (nlen < OPENSSL_RSA_FIPS_MIN_MODULUS_BITS/8) { |
25 |
+ ERR_raise(ERR_LIB_PROV, PROV_R_KEY_SIZE_TOO_SMALL); |
26 |
+ return 0; |
27 |
+ } |
28 |
+#endif |
29 |
+ |
30 |
/* Step (2): check the input ciphertext 'inlen' matches the nlen */ |
31 |
if (inlen != nlen) { |
32 |
ERR_raise(ERR_LIB_PROV, PROV_R_BAD_LENGTH); |