Blame SOURCES/nss-3.79-rhel-8-fips-signature-policy.patch

dc0051
diff -up ./cmd/crmftest/testcrmf.c.sign_policy ./cmd/crmftest/testcrmf.c
dc0051
--- ./cmd/crmftest/testcrmf.c.sign_policy	2022-05-26 02:54:33.000000000 -0700
dc0051
+++ ./cmd/crmftest/testcrmf.c	2022-06-20 16:47:35.023785628 -0700
dc0051
@@ -85,7 +85,7 @@
dc0051
 #include "sechash.h"
dc0051
 #endif
dc0051
 
dc0051
-#define MAX_KEY_LEN 512
dc0051
+#define MAX_KEY_LEN 1024
dc0051
 #define PATH_LEN 150
dc0051
 #define BUFF_SIZE 150
dc0051
 #define UID_BITS 800
dc0051
diff -up ./gtests/pk11_gtest/pk11_rsapkcs1_unittest.cc.sign_policy ./gtests/pk11_gtest/pk11_rsapkcs1_unittest.cc
dc0051
--- ./gtests/pk11_gtest/pk11_rsapkcs1_unittest.cc.sign_policy	2022-05-26 02:54:33.000000000 -0700
dc0051
+++ ./gtests/pk11_gtest/pk11_rsapkcs1_unittest.cc	2022-06-20 16:47:35.024785635 -0700
dc0051
@@ -16,6 +16,7 @@
dc0051
 #include "secerr.h"
dc0051
 #include "sechash.h"
dc0051
 #include "pk11_signature_test.h"
dc0051
+#include "blapit.h"
dc0051
 
dc0051
 #include "testvectors/rsa_signature_2048_sha224-vectors.h"
dc0051
 #include "testvectors/rsa_signature_2048_sha256-vectors.h"
dc0051
@@ -109,7 +110,11 @@ class Pkcs11RsaPkcs1WycheproofTest
dc0051
  * Use 6 as the invalid value since modLen % 16 must be zero.
dc0051
  */
dc0051
 TEST(RsaPkcs1Test, Pkcs1MinimumPadding) {
dc0051
-  const size_t kRsaShortKeyBits = 736;
dc0051
+#define RSA_SHORT_KEY_LENGTH 736
dc0051
+/* if our minimum supported key length is big enough to handle
dc0051
+ * our largest Hash function, we can't test a short length */
dc0051
+#if RSA_MIN_MODULUS_BITS < RSA_SHORT_KEY_LENGTH
dc0051
+  const size_t kRsaShortKeyBits = RSA_SHORT_KEY_LENGTH;
dc0051
   const size_t kRsaKeyBits = 752;
dc0051
   static const std::vector<uint8_t> kMsg{'T', 'E', 'S', 'T'};
dc0051
   static const std::vector<uint8_t> kSha512DigestInfo{
dc0051
@@ -209,6 +214,9 @@ TEST(RsaPkcs1Test, Pkcs1MinimumPadding)
dc0051
                               SEC_OID_PKCS1_RSA_ENCRYPTION, SEC_OID_SHA512,
dc0051
                               nullptr);
dc0051
   EXPECT_EQ(SECSuccess, rv);
dc0051
+#else
dc0051
+  GTEST_SKIP();
dc0051
+#endif
dc0051
 }
dc0051
 
dc0051
 TEST(RsaPkcs1Test, RequireNullParameter) {
dc0051
diff -up ./gtests/ssl_gtest/tls_subcerts_unittest.cc.sign_policy ./gtests/ssl_gtest/tls_subcerts_unittest.cc
dc0051
--- ./gtests/ssl_gtest/tls_subcerts_unittest.cc.sign_policy	2022-05-26 02:54:33.000000000 -0700
dc0051
+++ ./gtests/ssl_gtest/tls_subcerts_unittest.cc	2022-06-20 16:47:35.024785635 -0700
dc0051
@@ -9,6 +9,8 @@
dc0051
 #include "prtime.h"
dc0051
 #include "secerr.h"
dc0051
 #include "ssl.h"
dc0051
+#include "nss.h"
dc0051
+#include "blapit.h"
dc0051
 
dc0051
 #include "gtest_utils.h"
dc0051
 #include "tls_agent.h"
dc0051
@@ -348,9 +350,14 @@ static void GenerateWeakRsaKey(ScopedSEC
dc0051
   ScopedPK11SlotInfo slot(PK11_GetInternalSlot());
dc0051
   ASSERT_TRUE(slot);
dc0051
   PK11RSAGenParams rsaparams;
dc0051
-  // The absolute minimum size of RSA key that we can use with SHA-256 is
dc0051
-  // 256bit (hash) + 256bit (salt) + 8 (start byte) + 8 (end byte) = 528.
dc0051
+// The absolute minimum size of RSA key that we can use with SHA-256 is
dc0051
+// 256bit (hash) + 256bit (salt) + 8 (start byte) + 8 (end byte) = 528.
dc0051
+#define RSA_WEAK_KEY 528
dc0051
+#if RSA_MIN_MODULUS_BITS < RSA_WEAK_KEY
dc0051
   rsaparams.keySizeInBits = 528;
dc0051
+#else
dc0051
+  rsaparams.keySizeInBits = RSA_MIN_MODULUS_BITS + 1;
dc0051
+#endif
dc0051
   rsaparams.pe = 65537;
dc0051
 
dc0051
   // Bug 1012786: PK11_GenerateKeyPair can fail if there is insufficient
dc0051
@@ -390,6 +397,18 @@ TEST_P(TlsConnectTls13, DCWeakKey) {
dc0051
                                                 ssl_sig_rsa_pss_pss_sha256};
dc0051
   client_->SetSignatureSchemes(kSchemes, PR_ARRAY_SIZE(kSchemes));
dc0051
   server_->SetSignatureSchemes(kSchemes, PR_ARRAY_SIZE(kSchemes));
dc0051
+#if RSA_MIN_MODULUS_BITS > RSA_WEAK_KEY
dc0051
+  // save the MIN POLICY length.
dc0051
+  PRInt32 minRsa;
dc0051
+
dc0051
+  ASSERT_EQ(SECSuccess, NSS_OptionGet(NSS_RSA_MIN_KEY_SIZE, &minRsa));
dc0051
+#if RSA_MIN_MODULUS_BITS >= 2048
dc0051
+  ASSERT_EQ(SECSuccess,
dc0051
+            NSS_OptionSet(NSS_RSA_MIN_KEY_SIZE, RSA_MIN_MODULUS_BITS + 1024));
dc0051
+#else
dc0051
+  ASSERT_EQ(SECSuccess, NSS_OptionSet(NSS_RSA_MIN_KEY_SIZE, 2048));
dc0051
+#endif
dc0051
+#endif
dc0051
 
dc0051
   ScopedSECKEYPrivateKey dc_priv;
dc0051
   ScopedSECKEYPublicKey dc_pub;
dc0051
@@ -412,6 +431,9 @@ TEST_P(TlsConnectTls13, DCWeakKey) {
dc0051
   auto cfilter = MakeTlsFilter<TlsExtensionCapture>(
dc0051
       client_, ssl_delegated_credentials_xtn);
dc0051
   ConnectExpectAlert(client_, kTlsAlertInsufficientSecurity);
dc0051
+#if RSA_MIN_MODULUS_BITS > RSA_WEAK_KEY
dc0051
+  ASSERT_EQ(SECSuccess, NSS_OptionSet(NSS_RSA_MIN_KEY_SIZE, minRsa));
dc0051
+#endif
dc0051
 }
dc0051
 
dc0051
 class ReplaceDCSigScheme : public TlsHandshakeFilter {
dc0051
diff -up ./lib/cryptohi/keyhi.h.sign_policy ./lib/cryptohi/keyhi.h
dc0051
--- ./lib/cryptohi/keyhi.h.sign_policy	2022-05-26 02:54:33.000000000 -0700
dc0051
+++ ./lib/cryptohi/keyhi.h	2022-06-20 16:47:35.024785635 -0700
dc0051
@@ -53,6 +53,11 @@ extern unsigned SECKEY_PublicKeyStrength
dc0051
 extern unsigned SECKEY_PublicKeyStrengthInBits(const SECKEYPublicKey *pubk);
dc0051
 
dc0051
 /*
dc0051
+** Return the strength of the private key in bits
dc0051
+*/
dc0051
+extern unsigned SECKEY_PrivateKeyStrengthInBits(const SECKEYPrivateKey *privk);
dc0051
+
dc0051
+/*
dc0051
 ** Return the length of the signature in bytes
dc0051
 */
dc0051
 extern unsigned SECKEY_SignatureLen(const SECKEYPublicKey *pubk);
dc0051
diff -up ./lib/cryptohi/keyi.h.sign_policy ./lib/cryptohi/keyi.h
dc0051
--- ./lib/cryptohi/keyi.h.sign_policy	2022-05-26 02:54:33.000000000 -0700
dc0051
+++ ./lib/cryptohi/keyi.h	2022-06-20 16:47:35.024785635 -0700
dc0051
@@ -4,6 +4,7 @@
dc0051
 
dc0051
 #ifndef _KEYI_H_
dc0051
 #define _KEYI_H_
dc0051
+#include "secerr.h"
dc0051
 
dc0051
 SEC_BEGIN_PROTOS
dc0051
 /* NSS private functions */
dc0051
@@ -36,6 +37,9 @@ SECStatus sec_DecodeRSAPSSParamsToMechan
dc0051
                                             const SECItem *params,
dc0051
                                             CK_RSA_PKCS_PSS_PARAMS *mech);
dc0051
 
dc0051
+/* make sure the key length matches the policy for keyType */
dc0051
+SECStatus seckey_EnforceKeySize(KeyType keyType, unsigned keyLength,
dc0051
+                                SECErrorCodes error);
dc0051
 SEC_END_PROTOS
dc0051
 
dc0051
 #endif /* _KEYHI_H_ */
dc0051
diff -up ./lib/cryptohi/seckey.c.sign_policy ./lib/cryptohi/seckey.c
dc0051
--- ./lib/cryptohi/seckey.c.sign_policy	2022-05-26 02:54:33.000000000 -0700
dc0051
+++ ./lib/cryptohi/seckey.c	2022-06-20 16:47:35.025785641 -0700
dc0051
@@ -14,6 +14,7 @@
dc0051
 #include "secdig.h"
dc0051
 #include "prtime.h"
dc0051
 #include "keyi.h"
dc0051
+#include "nss.h"
dc0051
 
dc0051
 SEC_ASN1_MKSUB(SECOID_AlgorithmIDTemplate)
dc0051
 SEC_ASN1_MKSUB(SEC_IntegerTemplate)
dc0051
@@ -1042,6 +1043,62 @@ SECKEY_PublicKeyStrengthInBits(const SEC
dc0051
     return bitSize;
dc0051
 }
dc0051
 
dc0051
+unsigned
dc0051
+SECKEY_PrivateKeyStrengthInBits(const SECKEYPrivateKey *privk)
dc0051
+{
dc0051
+    unsigned bitSize = 0;
dc0051
+    CK_ATTRIBUTE_TYPE attribute = CKT_INVALID_TYPE;
dc0051
+    SECItem params;
dc0051
+    SECStatus rv;
dc0051
+
dc0051
+    if (!privk) {
dc0051
+        PORT_SetError(SEC_ERROR_INVALID_KEY);
dc0051
+        return 0;
dc0051
+    }
dc0051
+
dc0051
+    /* interpret modulus length as key strength */
dc0051
+    switch (privk->keyType) {
dc0051
+        case rsaKey:
dc0051
+        case rsaPssKey:
dc0051
+        case rsaOaepKey:
dc0051
+            /* some tokens don't export CKA_MODULUS on the private key,
dc0051
+             * PK11_SignatureLen works around this if necessary */
dc0051
+            bitSize = PK11_SignatureLen((SECKEYPrivateKey *)privk) * PR_BITS_PER_BYTE;
dc0051
+            if (bitSize == -1) {
dc0051
+                bitSize = 0;
dc0051
+            }
dc0051
+            return bitSize;
dc0051
+        case dsaKey:
dc0051
+        case fortezzaKey:
dc0051
+        case dhKey:
dc0051
+        case keaKey:
dc0051
+            attribute = CKA_PRIME;
dc0051
+            break;
dc0051
+        case ecKey:
dc0051
+            rv = PK11_ReadAttribute(privk->pkcs11Slot, privk->pkcs11ID,
dc0051
+                                    CKA_EC_PARAMS, NULL, &params);
dc0051
+            if ((rv != SECSuccess) || (params.data == NULL)) {
dc0051
+                return 0;
dc0051
+            }
dc0051
+            bitSize = SECKEY_ECParamsToKeySize(&params);
dc0051
+            PORT_Free(params.data);
dc0051
+            return bitSize;
dc0051
+        default:
dc0051
+            PORT_SetError(SEC_ERROR_INVALID_KEY);
dc0051
+            return 0;
dc0051
+    }
dc0051
+    PORT_Assert(attribute != CKT_INVALID_TYPE);
dc0051
+    rv = PK11_ReadAttribute(privk->pkcs11Slot, privk->pkcs11ID,
dc0051
+                            attribute, NULL, &params);
dc0051
+    if ((rv != SECSuccess) || (params.data == NULL)) {
dc0051
+        PORT_SetError(SEC_ERROR_INVALID_KEY);
dc0051
+        return 0;
dc0051
+    }
dc0051
+    bitSize = SECKEY_BigIntegerBitLength(&params);
dc0051
+    PORT_Free(params.data);
dc0051
+    return bitSize;
dc0051
+}
dc0051
+
dc0051
 /* returns signature length in bytes (not bits) */
dc0051
 unsigned
dc0051
 SECKEY_SignatureLen(const SECKEYPublicKey *pubk)
dc0051
@@ -1212,6 +1269,51 @@ SECKEY_CopyPublicKey(const SECKEYPublicK
dc0051
 }
dc0051
 
dc0051
 /*
dc0051
+ * Check that a given key meets the policy limits for the given key
dc0051
+ * size.
dc0051
+ */
dc0051
+SECStatus
dc0051
+seckey_EnforceKeySize(KeyType keyType, unsigned keyLength, SECErrorCodes error)
dc0051
+{
dc0051
+    PRInt32 opt = -1;
dc0051
+    PRInt32 optVal;
dc0051
+    SECStatus rv;
dc0051
+
dc0051
+    switch (keyType) {
dc0051
+        case rsaKey:
dc0051
+        case rsaPssKey:
dc0051
+        case rsaOaepKey:
dc0051
+            opt = NSS_RSA_MIN_KEY_SIZE;
dc0051
+            break;
dc0051
+        case dsaKey:
dc0051
+        case fortezzaKey:
dc0051
+            opt = NSS_DSA_MIN_KEY_SIZE;
dc0051
+            break;
dc0051
+        case dhKey:
dc0051
+        case keaKey:
dc0051
+            opt = NSS_DH_MIN_KEY_SIZE;
dc0051
+            break;
dc0051
+        case ecKey:
dc0051
+            opt = NSS_ECC_MIN_KEY_SIZE;
dc0051
+            break;
dc0051
+        case nullKey:
dc0051
+        default:
dc0051
+            PORT_SetError(SEC_ERROR_INVALID_KEY);
dc0051
+            return SECFailure;
dc0051
+    }
dc0051
+    PORT_Assert(opt != -1);
dc0051
+    rv = NSS_OptionGet(opt, &optVal);
dc0051
+    if (rv != SECSuccess) {
dc0051
+        return rv;
dc0051
+    }
dc0051
+    if (optVal < keyLength) {
dc0051
+        PORT_SetError(error);
dc0051
+        return SECFailure;
dc0051
+    }
dc0051
+    return SECSuccess;
dc0051
+}
dc0051
+
dc0051
+/*
dc0051
  * Use the private key to find a public key handle. The handle will be on
dc0051
  * the same slot as the private key.
dc0051
  */
dc0051
diff -up ./lib/cryptohi/secsign.c.sign_policy ./lib/cryptohi/secsign.c
dc0051
--- ./lib/cryptohi/secsign.c.sign_policy	2022-05-26 02:54:33.000000000 -0700
dc0051
+++ ./lib/cryptohi/secsign.c	2022-06-20 16:47:35.025785641 -0700
dc0051
@@ -15,6 +15,7 @@
dc0051
 #include "pk11func.h"
dc0051
 #include "secerr.h"
dc0051
 #include "keyi.h"
dc0051
+#include "nss.h"
dc0051
 
dc0051
 struct SGNContextStr {
dc0051
     SECOidTag signalg;
dc0051
@@ -32,6 +33,7 @@ sgn_NewContext(SECOidTag alg, SECItem *p
dc0051
     SECOidTag hashalg, signalg;
dc0051
     KeyType keyType;
dc0051
     PRUint32 policyFlags;
dc0051
+    PRInt32 optFlags;
dc0051
     SECStatus rv;
dc0051
 
dc0051
     /* OK, map a PKCS #7 hash and encrypt algorithm into
dc0051
@@ -56,6 +58,16 @@ sgn_NewContext(SECOidTag alg, SECItem *p
dc0051
         PORT_SetError(SEC_ERROR_INVALID_ALGORITHM);
dc0051
         return NULL;
dc0051
     }
dc0051
+    if (NSS_OptionGet(NSS_KEY_SIZE_POLICY_FLAGS, &optFlags) != SECFailure) {
dc0051
+        if (optFlags & NSS_KEY_SIZE_POLICY_SIGN_FLAG) {
dc0051
+            rv = seckey_EnforceKeySize(key->keyType,
dc0051
+                                       SECKEY_PrivateKeyStrengthInBits(key),
dc0051
+                                       SEC_ERROR_SIGNATURE_ALGORITHM_DISABLED);
dc0051
+            if (rv != SECSuccess) {
dc0051
+                return NULL;
dc0051
+            }
dc0051
+        }
dc0051
+    }
dc0051
     /* check the policy on the hash algorithm */
dc0051
     if ((NSS_GetAlgorithmPolicy(hashalg, &policyFlags) == SECFailure) ||
dc0051
         !(policyFlags & NSS_USE_ALG_IN_ANY_SIGNATURE)) {
dc0051
@@ -467,9 +479,20 @@ SGN_Digest(SECKEYPrivateKey *privKey,
dc0051
     SGNDigestInfo *di = 0;
dc0051
     SECOidTag enctag;
dc0051
     PRUint32 policyFlags;
dc0051
+    PRInt32 optFlags;
dc0051
 
dc0051
     result->data = 0;
dc0051
 
dc0051
+    if (NSS_OptionGet(NSS_KEY_SIZE_POLICY_FLAGS, &optFlags) != SECFailure) {
dc0051
+        if (optFlags & NSS_KEY_SIZE_POLICY_SIGN_FLAG) {
dc0051
+            rv = seckey_EnforceKeySize(privKey->keyType,
dc0051
+                                       SECKEY_PrivateKeyStrengthInBits(privKey),
dc0051
+                                       SEC_ERROR_SIGNATURE_ALGORITHM_DISABLED);
dc0051
+            if (rv != SECSuccess) {
dc0051
+                return SECFailure;
dc0051
+            }
dc0051
+        }
dc0051
+    }
dc0051
     /* check the policy on the hash algorithm */
dc0051
     if ((NSS_GetAlgorithmPolicy(algtag, &policyFlags) == SECFailure) ||
dc0051
         !(policyFlags & NSS_USE_ALG_IN_ANY_SIGNATURE)) {
dc0051
diff -up ./lib/cryptohi/secvfy.c.sign_policy ./lib/cryptohi/secvfy.c
dc0051
--- ./lib/cryptohi/secvfy.c.sign_policy	2022-05-26 02:54:33.000000000 -0700
dc0051
+++ ./lib/cryptohi/secvfy.c	2022-06-20 16:47:35.025785641 -0700
dc0051
@@ -16,6 +16,7 @@
dc0051
 #include "secdig.h"
dc0051
 #include "secerr.h"
dc0051
 #include "keyi.h"
dc0051
+#include "nss.h"
dc0051
 
dc0051
 /*
dc0051
 ** Recover the DigestInfo from an RSA PKCS#1 signature.
dc0051
@@ -467,6 +468,7 @@ vfy_CreateContext(const SECKEYPublicKey
dc0051
     unsigned int sigLen;
dc0051
     KeyType type;
dc0051
     PRUint32 policyFlags;
dc0051
+    PRInt32 optFlags;
dc0051
 
dc0051
     /* make sure the encryption algorithm matches the key type */
dc0051
     /* RSA-PSS algorithm can be used with both rsaKey and rsaPssKey */
dc0051
@@ -476,7 +478,16 @@ vfy_CreateContext(const SECKEYPublicKey
dc0051
         PORT_SetError(SEC_ERROR_PKCS7_KEYALG_MISMATCH);
dc0051
         return NULL;
dc0051
     }
dc0051
-
dc0051
+    if (NSS_OptionGet(NSS_KEY_SIZE_POLICY_FLAGS, &optFlags) != SECFailure) {
dc0051
+        if (optFlags & NSS_KEY_SIZE_POLICY_VERIFY_FLAG) {
dc0051
+            rv = seckey_EnforceKeySize(key->keyType,
dc0051
+                                       SECKEY_PublicKeyStrengthInBits(key),
dc0051
+                                       SEC_ERROR_SIGNATURE_ALGORITHM_DISABLED);
dc0051
+            if (rv != SECSuccess) {
dc0051
+                return NULL;
dc0051
+            }
dc0051
+        }
dc0051
+    }
dc0051
     /* check the policy on the encryption algorithm */
dc0051
     if ((NSS_GetAlgorithmPolicy(encAlg, &policyFlags) == SECFailure) ||
dc0051
         !(policyFlags & NSS_USE_ALG_IN_ANY_SIGNATURE)) {
dc0051
diff -up ./lib/freebl/blapit.h.sign_policy ./lib/freebl/blapit.h
dc0051
--- ./lib/freebl/blapit.h.sign_policy	2022-05-26 02:54:33.000000000 -0700
dc0051
+++ ./lib/freebl/blapit.h	2022-06-20 16:47:35.025785641 -0700
dc0051
@@ -135,7 +135,7 @@ typedef int __BLAPI_DEPRECATED __attribu
dc0051
  * These values come from the initial key size limits from the PKCS #11
dc0051
  * module. They may be arbitrarily adjusted to any value freebl supports.
dc0051
  */
dc0051
-#define RSA_MIN_MODULUS_BITS 128
dc0051
+#define RSA_MIN_MODULUS_BITS 1023 /* 128 */
dc0051
 #define RSA_MAX_MODULUS_BITS 16384
dc0051
 #define RSA_MAX_EXPONENT_BITS 64
dc0051
 #define DH_MIN_P_BITS 128
dc0051
diff -up ./lib/nss/nss.h.sign_policy ./lib/nss/nss.h
dc0051
--- ./lib/nss/nss.h.sign_policy	2022-05-26 02:54:33.000000000 -0700
dc0051
+++ ./lib/nss/nss.h	2022-06-20 16:47:35.026785647 -0700
dc0051
@@ -302,6 +302,28 @@ SECStatus NSS_UnregisterShutdown(NSS_Shu
dc0051
 #define NSS_DEFAULT_LOCKS 0x00d /* lock default values */
dc0051
 #define NSS_DEFAULT_SSL_LOCK 1  /* lock the ssl default values */
dc0051
 
dc0051
+/* NSS_KEY_SIZE_POLICY controls what kinds of operations are subject to
dc0051
+ * the NSS_XXX_MIN_KEY_SIZE values.
dc0051
+ *    NSS_KEY_SIZE_POLICY_FLAGS sets and clears all the flags to the input
dc0051
+ *                              value
dc0051
+ *     On get it returns all the flags
dc0051
+ *    NSS_KEY_SIZE_POLICY_SET_FLAGS sets only the flags=1 in theinput value and
dc0051
+ *                                  does not affect the other flags
dc0051
+ *     On get it returns all the flags
dc0051
+ *    NSS_KEY_SIZE_POLICY_CLEAR_FLAGS clears only the flags=1 in the input
dc0051
+ *                                    value and does not affect the other flags
dc0051
+ *     On get it returns all the compliment of all the flags
dc0051
+ *     (cleared flags == 1) */
dc0051
+#define NSS_KEY_SIZE_POLICY_FLAGS 0x00e
dc0051
+#define NSS_KEY_SIZE_POLICY_SET_FLAGS 0x00f
dc0051
+#define NSS_KEY_SIZE_POLICY_CLEAR_FLAGS 0x010
dc0051
+/* currently defined flags */
dc0051
+#define NSS_KEY_SIZE_POLICY_SSL_FLAG 1
dc0051
+#define NSS_KEY_SIZE_POLICY_VERIFY_FLAG 2
dc0051
+#define NSS_KEY_SIZE_POLICY_SIGN_FLAG 4
dc0051
+
dc0051
+#define NSS_ECC_MIN_KEY_SIZE 0x011
dc0051
+
dc0051
 /*
dc0051
  * Set and get global options for the NSS library.
dc0051
  */
dc0051
diff -up ./lib/nss/nssoptions.c.sign_policy ./lib/nss/nssoptions.c
dc0051
--- ./lib/nss/nssoptions.c.sign_policy	2022-05-26 02:54:33.000000000 -0700
dc0051
+++ ./lib/nss/nssoptions.c	2022-06-20 16:47:35.026785647 -0700
dc0051
@@ -26,6 +26,8 @@ struct nssOps {
dc0051
     PRInt32 dtlsVersionMaxPolicy;
dc0051
     PRInt32 pkcs12DecodeForceUnicode;
dc0051
     PRInt32 defaultLocks;
dc0051
+    PRInt32 keySizePolicyFlags;
dc0051
+    PRInt32 eccMinKeySize;
dc0051
 };
dc0051
 
dc0051
 static struct nssOps nss_ops = {
dc0051
@@ -37,7 +39,9 @@ static struct nssOps nss_ops = {
dc0051
     1,
dc0051
     0xffff,
dc0051
     PR_FALSE,
dc0051
-    0
dc0051
+    0,
dc0051
+    NSS_KEY_SIZE_POLICY_SSL_FLAG,
dc0051
+    SSL_ECC_MIN_CURVE_BITS
dc0051
 };
dc0051
 
dc0051
 SECStatus
dc0051
@@ -78,6 +82,18 @@ NSS_OptionSet(PRInt32 which, PRInt32 val
dc0051
         case NSS_DEFAULT_LOCKS:
dc0051
             nss_ops.defaultLocks = value;
dc0051
             break;
dc0051
+        case NSS_KEY_SIZE_POLICY_FLAGS:
dc0051
+            nss_ops.keySizePolicyFlags = value;
dc0051
+            break;
dc0051
+        case NSS_KEY_SIZE_POLICY_SET_FLAGS:
dc0051
+            nss_ops.keySizePolicyFlags |= value;
dc0051
+            break;
dc0051
+        case NSS_KEY_SIZE_POLICY_CLEAR_FLAGS:
dc0051
+            nss_ops.keySizePolicyFlags &= ~value;
dc0051
+            break;
dc0051
+        case NSS_ECC_MIN_KEY_SIZE:
dc0051
+            nss_ops.eccMinKeySize = value;
dc0051
+            break;
dc0051
         default:
dc0051
             PORT_SetError(SEC_ERROR_INVALID_ARGS);
dc0051
             rv = SECFailure;
dc0051
@@ -119,6 +135,16 @@ NSS_OptionGet(PRInt32 which, PRInt32 *va
dc0051
         case NSS_DEFAULT_LOCKS:
dc0051
             *value = nss_ops.defaultLocks;
dc0051
             break;
dc0051
+        case NSS_KEY_SIZE_POLICY_FLAGS:
dc0051
+        case NSS_KEY_SIZE_POLICY_SET_FLAGS:
dc0051
+            *value = nss_ops.keySizePolicyFlags;
dc0051
+            break;
dc0051
+        case NSS_KEY_SIZE_POLICY_CLEAR_FLAGS:
dc0051
+            *value = ~nss_ops.keySizePolicyFlags;
dc0051
+            break;
dc0051
+        case NSS_ECC_MIN_KEY_SIZE:
dc0051
+            *value = nss_ops.eccMinKeySize;
dc0051
+            break;
dc0051
         default:
dc0051
             rv = SECFailure;
dc0051
     }
dc0051
diff -up ./lib/nss/nssoptions.h.sign_policy ./lib/nss/nssoptions.h
dc0051
--- ./lib/nss/nssoptions.h.sign_policy	2022-05-26 02:54:33.000000000 -0700
dc0051
+++ ./lib/nss/nssoptions.h	2022-06-20 16:47:35.026785647 -0700
dc0051
@@ -18,3 +18,5 @@
dc0051
  * happens because NSS used to count bit lengths incorrectly. */
dc0051
 #define SSL_DH_MIN_P_BITS 1023
dc0051
 #define SSL_DSA_MIN_P_BITS 1023
dc0051
+/* not really used by SSL, but define it here for consistency */
dc0051
+#define SSL_ECC_MIN_CURVE_BITS 256
dc0051
diff -up ./lib/pk11wrap/pk11kea.c.sign_policy ./lib/pk11wrap/pk11kea.c
dc0051
--- ./lib/pk11wrap/pk11kea.c.sign_policy	2022-05-26 02:54:33.000000000 -0700
dc0051
+++ ./lib/pk11wrap/pk11kea.c	2022-06-20 16:47:35.026785647 -0700
dc0051
@@ -78,15 +78,14 @@ pk11_KeyExchange(PK11SlotInfo *slot, CK_
dc0051
         if (privKeyHandle == CK_INVALID_HANDLE) {
dc0051
             PK11RSAGenParams rsaParams;
dc0051
 
dc0051
-            if (symKeyLength > 53) /* bytes */ {
dc0051
-                /* we'd have to generate an RSA key pair > 512 bits long,
dc0051
+            if (symKeyLength > 120) /* bytes */ {
dc0051
+                /* we'd have to generate an RSA key pair > 1024 bits long,
dc0051
                 ** and that's too costly.  Don't even try.
dc0051
                 */
dc0051
                 PORT_SetError(SEC_ERROR_CANNOT_MOVE_SENSITIVE_KEY);
dc0051
                 goto rsa_failed;
dc0051
             }
dc0051
-            rsaParams.keySizeInBits =
dc0051
-                (symKeyLength > 21 || symKeyLength == 0) ? 512 : 256;
dc0051
+            rsaParams.keySizeInBits = 1024;
dc0051
             rsaParams.pe = 0x10001;
dc0051
             privKey = PK11_GenerateKeyPair(slot, CKM_RSA_PKCS_KEY_PAIR_GEN,
dc0051
                                            &rsaParams, &pubKey, PR_FALSE, PR_TRUE, symKey->cx);
dc0051
diff -up ./lib/pk11wrap/pk11pars.c.sign_policy ./lib/pk11wrap/pk11pars.c
dc0051
--- ./lib/pk11wrap/pk11pars.c.sign_policy	2022-06-20 16:47:35.004785510 -0700
dc0051
+++ ./lib/pk11wrap/pk11pars.c	2022-06-20 16:47:35.026785647 -0700
dc0051
@@ -427,12 +427,21 @@ static const optionFreeDef sslOptList[]
dc0051
     { CIPHER_NAME("DTLS1.3"), 0x304 },
dc0051
 };
dc0051
 
dc0051
+static const optionFreeDef keySizeFlagsList[] = {
dc0051
+    { CIPHER_NAME("KEY-SIZE-SSL"), NSS_KEY_SIZE_POLICY_SSL_FLAG },
dc0051
+    { CIPHER_NAME("KEY-SIZE-SIGN"), NSS_KEY_SIZE_POLICY_SIGN_FLAG },
dc0051
+    { CIPHER_NAME("KEY-SIZE-VERIFY"), NSS_KEY_SIZE_POLICY_VERIFY_FLAG },
dc0051
+};
dc0051
+
dc0051
 static const optionFreeDef freeOptList[] = {
dc0051
 
dc0051
     /* Restrictions for asymetric keys */
dc0051
     { CIPHER_NAME("RSA-MIN"), NSS_RSA_MIN_KEY_SIZE },
dc0051
     { CIPHER_NAME("DH-MIN"), NSS_DH_MIN_KEY_SIZE },
dc0051
     { CIPHER_NAME("DSA-MIN"), NSS_DSA_MIN_KEY_SIZE },
dc0051
+    { CIPHER_NAME("ECC-MIN"), NSS_ECC_MIN_KEY_SIZE },
dc0051
+    /* what operations doe the key size apply to */
dc0051
+    { CIPHER_NAME("KEY-SIZE-FLAGS"), NSS_KEY_SIZE_POLICY_FLAGS },
dc0051
     /* constraints on SSL Protocols */
dc0051
     { CIPHER_NAME("TLS-VERSION-MIN"), NSS_TLS_VERSION_MIN_POLICY },
dc0051
     { CIPHER_NAME("TLS-VERSION-MAX"), NSS_TLS_VERSION_MAX_POLICY },
dc0051
@@ -540,6 +549,7 @@ secmod_getPolicyOptValue(const char *pol
dc0051
         *result = val;
dc0051
         return SECSuccess;
dc0051
     }
dc0051
+    /* handle any ssl strings */
dc0051
     for (i = 0; i < PR_ARRAY_SIZE(sslOptList); i++) {
dc0051
         if (policyValueLength == sslOptList[i].name_size &&
dc0051
             PORT_Strncasecmp(sslOptList[i].name, policyValue,
dc0051
@@ -548,7 +558,29 @@ secmod_getPolicyOptValue(const char *pol
dc0051
             return SECSuccess;
dc0051
         }
dc0051
     }
dc0051
-    return SECFailure;
dc0051
+    /* handle key_size flags. Each flag represents a bit, which
dc0051
+     * gets or'd together. They can be separated by , | or + */
dc0051
+    val = 0;
dc0051
+    while (*policyValue) {
dc0051
+        PRBool found = PR_FALSE;
dc0051
+        for (i = 0; i < PR_ARRAY_SIZE(keySizeFlagsList); i++) {
dc0051
+            if (PORT_Strncasecmp(keySizeFlagsList[i].name, policyValue,
dc0051
+                                 keySizeFlagsList[i].name_size) == 0) {
dc0051
+                val |= keySizeFlagsList[i].option;
dc0051
+                found = PR_TRUE;
dc0051
+                policyValue += keySizeFlagsList[i].name_size;
dc0051
+                break;
dc0051
+            }
dc0051
+        }
dc0051
+        if (!found) {
dc0051
+            return SECFailure;
dc0051
+        }
dc0051
+        if (*policyValue == ',' || *policyValue == '|' || *policyValue == '+') {
dc0051
+            policyValue++;
dc0051
+        }
dc0051
+    }
dc0051
+    *result = val;
dc0051
+    return SECSuccess;
dc0051
 }
dc0051
 
dc0051
 /* Policy operations:
dc0051
diff -up ./lib/softoken/fips_algorithms.h.sign_policy ./lib/softoken/fips_algorithms.h
dc0051
--- ./lib/softoken/fips_algorithms.h.sign_policy	2022-05-26 02:54:33.000000000 -0700
dc0051
+++ ./lib/softoken/fips_algorithms.h	2022-06-20 16:47:35.026785647 -0700
dc0051
@@ -54,7 +54,9 @@ SFTKFIPSAlgorithmList sftk_fips_mechs[]
dc0051
 /* mechanisms using the same key types share the same key type
dc0051
  * limits */
dc0051
 #define RSA_FB_KEY 2048, 4096 /* min, max */
dc0051
-#define RSA_FB_STEP 1024
dc0051
+#define RSA_FB_STEP 1
dc0051
+#define RSA_LEGACY_FB_KEY 1024, 1792 /* min, max */
dc0051
+#define RSA_LEGACY_FB_STEP 256
dc0051
 #define DSA_FB_KEY 2048, 4096 /* min, max */
dc0051
 #define DSA_FB_STEP 1024
dc0051
 #define DH_FB_KEY 2048, 4096 /* min, max */
dc0051
@@ -66,6 +68,7 @@ SFTKFIPSAlgorithmList sftk_fips_mechs[]
dc0051
     { CKM_RSA_PKCS_KEY_PAIR_GEN, { RSA_FB_KEY, CKF_KPG }, RSA_FB_STEP, SFTKFIPSNone },
dc0051
     { CKM_RSA_PKCS_PSS, { RSA_FB_KEY, CKF_SGN }, RSA_FB_STEP, SFTKFIPSNone },
dc0051
     { CKM_RSA_PKCS_OAEP, { RSA_FB_KEY, CKF_ENC }, RSA_FB_STEP, SFTKFIPSNone },
dc0051
+    { CKM_RSA_PKCS_PSS, { RSA_LEGACY_FB_KEY, CKF_VERIFY }, RSA_LEGACY_FB_STEP, SFTKFIPSNone },
dc0051
     /* -------------- RSA Multipart Signing Operations -------------------- */
dc0051
     { CKM_SHA224_RSA_PKCS, { RSA_FB_KEY, CKF_SGN }, RSA_FB_STEP, SFTKFIPSNone },
dc0051
     { CKM_SHA256_RSA_PKCS, { RSA_FB_KEY, CKF_SGN }, RSA_FB_STEP, SFTKFIPSNone },
dc0051
@@ -75,6 +78,14 @@ SFTKFIPSAlgorithmList sftk_fips_mechs[]
dc0051
     { CKM_SHA256_RSA_PKCS_PSS, { RSA_FB_KEY, CKF_SGN }, RSA_FB_STEP, SFTKFIPSNone },
dc0051
     { CKM_SHA384_RSA_PKCS_PSS, { RSA_FB_KEY, CKF_SGN }, RSA_FB_STEP, SFTKFIPSNone },
dc0051
     { CKM_SHA512_RSA_PKCS_PSS, { RSA_FB_KEY, CKF_SGN }, RSA_FB_STEP, SFTKFIPSNone },
dc0051
+    { CKM_SHA224_RSA_PKCS, { RSA_LEGACY_FB_KEY, CKF_VERIFY }, RSA_LEGACY_FB_STEP, SFTKFIPSNone },
dc0051
+    { CKM_SHA256_RSA_PKCS, { RSA_LEGACY_FB_KEY, CKF_VERIFY }, RSA_LEGACY_FB_STEP, SFTKFIPSNone },
dc0051
+    { CKM_SHA384_RSA_PKCS, { RSA_LEGACY_FB_KEY, CKF_VERIFY }, RSA_LEGACY_FB_STEP, SFTKFIPSNone },
dc0051
+    { CKM_SHA512_RSA_PKCS, { RSA_LEGACY_FB_KEY, CKF_VERIFY }, RSA_LEGACY_FB_STEP, SFTKFIPSNone },
dc0051
+    { CKM_SHA224_RSA_PKCS_PSS, { RSA_LEGACY_FB_KEY, CKF_VERIFY }, RSA_LEGACY_FB_STEP, SFTKFIPSNone },
dc0051
+    { CKM_SHA256_RSA_PKCS_PSS, { RSA_LEGACY_FB_KEY, CKF_VERIFY }, RSA_LEGACY_FB_STEP, SFTKFIPSNone },
dc0051
+    { CKM_SHA384_RSA_PKCS_PSS, { RSA_LEGACY_FB_KEY, CKF_VERIFY }, RSA_LEGACY_FB_STEP, SFTKFIPSNone },
dc0051
+    { CKM_SHA512_RSA_PKCS_PSS, { RSA_LEGACY_FB_KEY, CKF_VERIFY }, RSA_LEGACY_FB_STEP, SFTKFIPSNone },
dc0051
     /* ------------------------- DSA Operations --------------------------- */
dc0051
     { CKM_DSA_KEY_PAIR_GEN, { DSA_FB_KEY, CKF_KPG }, DSA_FB_STEP, SFTKFIPSNone },
dc0051
     { CKM_DSA, { DSA_FB_KEY, CKF_SGN }, DSA_FB_STEP, SFTKFIPSNone },
dc0051
diff -up ./lib/ssl/ssl3con.c.sign_policy ./lib/ssl/ssl3con.c
dc0051
--- ./lib/ssl/ssl3con.c.sign_policy	2022-06-20 16:47:34.998785473 -0700
dc0051
+++ ./lib/ssl/ssl3con.c	2022-06-20 16:47:35.028785660 -0700
dc0051
@@ -7409,6 +7409,8 @@ ssl_HandleDHServerKeyExchange(sslSocket
dc0051
     unsigned dh_p_bits;
dc0051
     unsigned dh_g_bits;
dc0051
     PRInt32 minDH;
dc0051
+    PRInt32 optval;
dc0051
+    PRBool usePolicyLength = PR_FALSE;
dc0051
 
dc0051
     SSL3Hashes hashes;
dc0051
     SECItem signature = { siBuffer, NULL, 0 };
dc0051
@@ -7419,8 +7421,13 @@ ssl_HandleDHServerKeyExchange(sslSocket
dc0051
     if (rv != SECSuccess) {
dc0051
         goto loser; /* malformed. */
dc0051
     }
dc0051
+    rv = NSS_OptionGet(NSS_KEY_SIZE_POLICY_FLAGS, &optval);
dc0051
+    if (rv == SECSuccess) {
dc0051
+        usePolicyLength = (PRBool)((optval & NSS_KEY_SIZE_POLICY_SSL_FLAG) == NSS_KEY_SIZE_POLICY_SSL_FLAG);
dc0051
+    }
dc0051
 
dc0051
-    rv = NSS_OptionGet(NSS_DH_MIN_KEY_SIZE, &minDH);
dc0051
+    rv = usePolicyLength ? NSS_OptionGet(NSS_DH_MIN_KEY_SIZE, &minDH)
dc0051
+                         : SECFailure;
dc0051
     if (rv != SECSuccess || minDH <= 0) {
dc0051
         minDH = SSL_DH_MIN_P_BITS;
dc0051
     }
dc0051
@@ -11411,13 +11418,20 @@ ssl_SetAuthKeyBits(sslSocket *ss, const
dc0051
     SECStatus rv;
dc0051
     PRUint32 minKey;
dc0051
     PRInt32 optval;
dc0051
+    PRBool usePolicyLength = PR_TRUE;
dc0051
+
dc0051
+    rv = NSS_OptionGet(NSS_KEY_SIZE_POLICY_FLAGS, &optval);
dc0051
+    if (rv == SECSuccess) {
dc0051
+        usePolicyLength = (PRBool)((optval & NSS_KEY_SIZE_POLICY_SSL_FLAG) == NSS_KEY_SIZE_POLICY_SSL_FLAG);
dc0051
+    }
dc0051
 
dc0051
     ss->sec.authKeyBits = SECKEY_PublicKeyStrengthInBits(pubKey);
dc0051
     switch (SECKEY_GetPublicKeyType(pubKey)) {
dc0051
         case rsaKey:
dc0051
         case rsaPssKey:
dc0051
         case rsaOaepKey:
dc0051
-            rv = NSS_OptionGet(NSS_RSA_MIN_KEY_SIZE, &optval);
dc0051
+            rv = usePolicyLength ? NSS_OptionGet(NSS_RSA_MIN_KEY_SIZE, &optval)
dc0051
+                                 : SECFailure;
dc0051
             if (rv == SECSuccess && optval > 0) {
dc0051
                 minKey = (PRUint32)optval;
dc0051
             } else {
dc0051
@@ -11426,7 +11440,8 @@ ssl_SetAuthKeyBits(sslSocket *ss, const
dc0051
             break;
dc0051
 
dc0051
         case dsaKey:
dc0051
-            rv = NSS_OptionGet(NSS_DSA_MIN_KEY_SIZE, &optval);
dc0051
+            rv = usePolicyLength ? NSS_OptionGet(NSS_DSA_MIN_KEY_SIZE, &optval)
dc0051
+                                 : SECFailure;
dc0051
             if (rv == SECSuccess && optval > 0) {
dc0051
                 minKey = (PRUint32)optval;
dc0051
             } else {
dc0051
@@ -11435,7 +11450,8 @@ ssl_SetAuthKeyBits(sslSocket *ss, const
dc0051
             break;
dc0051
 
dc0051
         case dhKey:
dc0051
-            rv = NSS_OptionGet(NSS_DH_MIN_KEY_SIZE, &optval);
dc0051
+            rv = usePolicyLength ? NSS_OptionGet(NSS_DH_MIN_KEY_SIZE, &optval)
dc0051
+                                 : SECFailure;
dc0051
             if (rv == SECSuccess && optval > 0) {
dc0051
                 minKey = (PRUint32)optval;
dc0051
             } else {
dc0051
@@ -11444,9 +11460,15 @@ ssl_SetAuthKeyBits(sslSocket *ss, const
dc0051
             break;
dc0051
 
dc0051
         case ecKey:
dc0051
-            /* Don't check EC strength here on the understanding that we only
dc0051
-             * support curves we like. */
dc0051
-            minKey = ss->sec.authKeyBits;
dc0051
+            rv = usePolicyLength ? NSS_OptionGet(NSS_ECC_MIN_KEY_SIZE, &optval)
dc0051
+                                 : SECFailure;
dc0051
+            if (rv == SECSuccess && optval > 0) {
dc0051
+                minKey = (PRUint32)optval;
dc0051
+            } else {
dc0051
+                /* Don't check EC strength here on the understanding that we
dc0051
+                 * only support curves we like. */
dc0051
+                minKey = ss->sec.authKeyBits;
dc0051
+            }
dc0051
             break;
dc0051
 
dc0051
         default:
dc0051
diff -up ./tests/policy/crypto-policy.txt.sign_policy ./tests/policy/crypto-policy.txt
dc0051
--- ./tests/policy/crypto-policy.txt.sign_policy	2022-05-26 02:54:33.000000000 -0700
dc0051
+++ ./tests/policy/crypto-policy.txt	2022-06-20 16:47:35.028785660 -0700
dc0051
@@ -6,6 +6,8 @@
dc0051
 0 disallow=ALL_allow=HMAC-SHA256:HMAC-SHA1:HMAC-SHA384:HMAC-SHA512:SECP256R1:SECP384R1:SECP521R1:aes256-gcm:chacha20-poly1305:aes256-cbc:camellia256-cbc:aes128-gcm:aes128-cbc:camellia128-cbc:SHA256:SHA384:SHA512:SHA1:ECDHE-RSA:ECDHE-ECDSA:RSA:DHE-RSA:rsa-pkcs:rsa-pss:ecdsa:tls-version-min=tls1.0:dtls-version-min=dtls1.0:DH-MIN=1023:DSA-MIN=2048:RSA-MIN=2048 NSS-POLICY-INFO.*LOADED-SUCCESSFULLY Standard policy
dc0051
 0 disallow=ALL_allow=HMAC-SHA1:HMAC-SHA256:HMAC-SHA384:HMAC-SHA512:SECP256R1:SECP384R1:SECP521R1:aes256-gcm:chacha20-poly1305:aes256-cbc:camellia256-cbc:aes128-gcm:aes128-cbc:camellia128-cbc:des-ede3-cbc:rc4:SHA256:SHA384:SHA512:SHA1:ECDHE-RSA:ECDHE-ECDSA:RSA:DHE-RSA:DHE-DSS:rsa-pkcs:rsa-pss:ecdsa:tls-version-min=tls1.0:dtls-version-min=tls1.0:DH-MIN=1023:DSA-MIN=1023:RSA-MIN=1023 NSS-POLICY-INFO.*LOADED-SUCCESSFULLY Legacy policy
dc0051
 0 disallow=ALL_allow=HMAC-SHA256:HMAC-SHA384:HMAC-SHA512:SECP384R1:SECP521R1:aes256-gcm:chacha20-poly1305:SHA384:SHA512:ECDHE-RSA:ECDHE-ECDSA:RSA:DHE-RSA:rsa-pkcs:rsa-pss:ecdsa:tls-version-min=tls1.2:dtls-version-min=dtls1.2:DH-MIN=3072:DSA-MIN=3072:RSA-MIN=3072 NSS-POLICY-INFO.*LOADED-SUCCESSFULLY Reduced policy
dc0051
+0 disallow=ALL_allow=HMAC-SHA256:HMAC-SHA384:HMAC-SHA512:SECP384R1:SECP521R1:aes256-gcm:chacha20-poly1305:SHA384:SHA512:ECDHE-RSA:ECDHE-ECDSA:RSA:DHE-RSA:rsa-pkcs:rsa-pss:ecdsa:tls-version-min=tls1.2:dtls-version-min=dtls1.2:DH-MIN=3072:DSA-MIN=3072:RSA-MIN=3072:KEY-SIZE-FLAGS=KEY-SIZE-SSL,KEY-SIZE-SIGN,KEY-SIZE-VERIFY NSS-POLICY-INFO.*LOADED-SUCCESSFULLY Valid key size
dc0051
+2 disallow=ALL_allow=HMAC-SHA256:HMAC-SHA384:HMAC-SHA512:SECP384R1:SECP521R1:aes256-gcm:chacha20-poly1305:SHA384:SHA512:ECDHE-RSA:ECDHE-ECDSA:RSA:DHE-RSA:rsa-pkcs:rsa-pss:ecdsa:tls-version-min=tls1.2:dtls-version-min=dtls1.2:DH-MIN=3072:DSA-MIN=3072:RSA-MIN=3072:KEY-SIZE-FLAGS=UNKNOWN,KEY-SIZE-SIGN,KEY-SIZE-VERIFY NSS-POLICY-FAIL.*unknown.* Invalid key size
dc0051
 2 disallow=ALL_allow=dtls-version-min=:dtls-version-max= NSS-POLICY-FAIL Missing value
dc0051
 2 disallow=ALL_allow=RSA-MIN=whatever NSS-POLICY-FAIL Invalid value
dc0051
 2 disallow=ALL_allow=flower NSS-POLICY-FAIL Invalid identifier
dc0051
diff -up ./tests/ssl/sslpolicy.txt.sign_policy ./tests/ssl/sslpolicy.txt
dc0051
--- ./tests/ssl/sslpolicy.txt.sign_policy	2022-06-20 16:47:35.028785660 -0700
dc0051
+++ ./tests/ssl/sslpolicy.txt	2022-06-20 16:50:08.958742135 -0700
dc0051
@@ -196,6 +196,11 @@
dc0051
 # rsa-pkcs, rsa-pss, and ecdsa policy checking reverted in rhel8 for binary
dc0051
 # compatibility reasons
dc0051
 #  1 noECC  SSL3   d    disallow=rsa-pkcs Disallow RSA PKCS 1 Signatures Explicitly
dc0051
++  1 noECC  SSL3   d    allow=rsa-min=16384:key-size-flags=key-size-verify Restrict RSA keys on signature verification
dc0051
++  1 noECC  SSL3   d    allow=rsa-min=16384:key-size-flags=key-size-sign Restrict RSA keys on signing
dc0051
++  1 noECC  SSL3   d    allow=rsa-min=16384:key-size-flags=key-size-ssl Restrict RSA keys when used in SSL
dc0051
++  0 noECC  SSL3   d    allow=rsa-min=1023 Restrict RSA keys when used in SSL
dc0051
+
dc0051
 # test default settings
dc0051
 # NOTE: tstclient will attempt to overide the defaults, so we detect we
dc0051
 # were successful by locking in our settings
dc0051
diff -up ./tests/dbupgrade/dbupgrade.sh.sign_policy ./tests/dbupgrade/dbupgrade.sh
dc0051
--- ./tests/dbupgrade/dbupgrade.sh.sign_policy	2022-06-22 08:43:55.905407738 -0700
dc0051
+++ ./tests/dbupgrade/dbupgrade.sh	2022-06-22 08:43:58.837426779 -0700
dc0051
@@ -69,7 +69,7 @@ dbupgrade_main()
dc0051
 		echo $i
dc0051
 		if [ -d $i ]; then
dc0051
 			echo "upgrading db $i"
dc0051
-			${BINDIR}/certutil -G -g 512 -d sql:$i -f ${PWFILE} -z ${NOISE_FILE} 2>&1
dc0051
+			${BINDIR}/certutil -G -g 1024 -d sql:$i -f ${PWFILE} -z ${NOISE_FILE} 2>&1
dc0051
 			html_msg $? 0 "Upgrading $i"
dc0051
 		else
dc0051
 			echo "skipping db $i"