Bug 2097837

Summary: allow signature verification using RSA keys <2k in FIPS mode [rhel-8.7.0]
Product: Red Hat Enterprise Linux 8 Reporter: Bob Relyea <rrelyea>
Component: nssAssignee: Bob Relyea <rrelyea>
Status: CLOSED CURRENTRELEASE QA Contact: BaseOS QE Security Team <qe-baseos-security>
Severity: low Docs Contact: Mirek Jahoda <mjahoda>
Priority: high    
Version: 8.6CC: cllang, qe-baseos-security, rrelyea, ssorce
Target Milestone: rcKeywords: Triaged, ZStream
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: nss-3.79.0-7.el8_6 Doc Type: Enhancement
Doc Text:
.NSS no longer support RSA keys shorter than 1023 bits The update of the Network Security Services (NSS) libraries changes the minimum key size for all RSA operations from 128 to 1023 bits. This means that NSS no longer perform the following functions: * Generate RSA keys shorter than 1023 bits. * Sign or verify RSA signatures with RSA keys shorter than 1023 bits. * Encrypt or decrypt values with RSA key shorter than 1023 bits.
Story Points: ---
Clone Of: 2091905
: 2098642 (view as bug list) Environment:
Last Closed: 2023-06-05 16:47:13 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 2091905    
Bug Blocks: 2098642    

Description Bob Relyea 2022-06-16 16:32:49 UTC
+++ This bug was initially created as a clone of Bug #2091905 +++

We clarified with lab that we should be able to use the RSA keys for signature verification if they are of the following sizes:

  1024, 1280, 1536, 1792

Consider adapting NSS to also support these shorter key sizes. We may not want to enable these short key sizes by default in TLS, though.

--- Additional comment from Bob Relyea on 2022-06-16 09:30:13 PDT ---

ok, I'm coopting this bug. That's because there is code around this that was supposed to be upstream, but didn't make into the RHEL 3.79 NSS release. (https://phabricator.services.mozilla.com/D146341).

The base thing this bug describes is already done by NSS. NSS allows any signature for any rsa key between 128 and 16384 for both signing and verification in regular and FIPS mode. It only gives FIPS indicators for keys >2048.

The upstream patch was supposed to:
1) increase the low end of the RSA keys to 1024 in all cases (encryption/decryption/signing/verification).
2) give FIPS indicators for 1024, 1280, 1536, 1792, signing only.
3) allow crypto-policies to optionally add signing, and verification to the checks for minimum key sizes by set by policy.

this bug is now to include this patch as part of the rebase.

proposed AC: 
1) verify small RSA keys are no longer supported.
2) check the fips indicators for signing in FIPS mode.

These could be sanity checks by looking at RSA_MIN_MODULUS_BITS in lib/freebl/blapit.h (or /usr/include/nss3/blapit.h in an installed system), and looking at nss/lib/softokn/fips_algorithms.h to make sure that the verification entries in the table are there:

    { CKM_SHA224_RSA_PKCS, { RSA_LEGACY_FB_KEY, CKF_VERIFY }, RSA_LEGACY_FB_STEP, SFTKFIPSNone },
    { CKM_SHA256_RSA_PKCS, { RSA_LEGACY_FB_KEY, CKF_VERIFY }, RSA_LEGACY_FB_STEP, SFTKFIPSNone },
    { CKM_SHA384_RSA_PKCS, { RSA_LEGACY_FB_KEY, CKF_VERIFY }, RSA_LEGACY_FB_STEP, SFTKFIPSNone },
    { CKM_SHA512_RSA_PKCS, { RSA_LEGACY_FB_KEY, CKF_VERIFY }, RSA_LEGACY_FB_STEP, SFTKFIPSNone },
    { CKM_SHA224_RSA_PKCS_PSS, { RSA_LEGACY_FB_KEY, CKF_VERIFY }, RSA_LEGACY_FB_STEP, SFTKFIPSNone },
    { CKM_SHA256_RSA_PKCS_PSS, { RSA_LEGACY_FB_KEY, CKF_VERIFY }, RSA_LEGACY_FB_STEP, SFTKFIPSNone },
    { CKM_SHA384_RSA_PKCS_PSS, { RSA_LEGACY_FB_KEY, CKF_VERIFY }, RSA_LEGACY_FB_STEP, SFTKFIPSNone },
    { CKM_SHA512_RSA_PKCS_PSS, { RSA_LEGACY_FB_KEY, CKF_VERIFY }, RSA_LEGACY_FB_STEP, SFTKFIPSNone },

Comment 10 Clemens Lang 2023-06-05 16:47:13 UTC
RHEL 8.7 contains nss-3.79.0-10.el8_6