Bug 2091905

Summary: allow signature verification using RSA keys <2k in FIPS mode [rhel-9.1.0]
Product: Red Hat Enterprise Linux 9 Reporter: Clemens Lang <cllang>
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: 9.0CC: mjahoda, pasik, rrelyea, ssorce
Target Milestone: rcKeywords: Triaged, ZStream
Target Release: ---Flags: pm-rhel: mirror+
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: nss-3.79.0-13.el9 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:
: 2097837 2099438 (view as bug list) Environment:
Last Closed: 2023-06-06 10:17:17 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:    
Bug Blocks: 2097837, 2099438    

Description Clemens Lang 2022-05-31 10:01:17 UTC
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.

Comment 1 Bob Relyea 2022-06-16 16:30:13 UTC
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 12 Clemens Lang 2023-06-06 10:17:17 UTC
RHEL 9.1 contains nss-3.79.0-14.el9_0.