RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 2160733 - In FIPS mode, openssl KDFs should only allow selected hash algorithms
Summary: In FIPS mode, openssl KDFs should only allow selected hash algorithms
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 9
Classification: Red Hat
Component: openssl
Version: 9.0
Hardware: x86_64
OS: Linux
high
high
Target Milestone: rc
: ---
Assignee: Clemens Lang
QA Contact: Alicja Kario
URL:
Whiteboard:
Depends On:
Blocks: 2175860 2175861 2175862
TreeView+ depends on / blocked
 
Reported: 2023-01-13 14:12 UTC by Clemens Lang
Modified: 2023-11-07 11:26 UTC (History)
4 users (show)

Fixed In Version: openssl-3.0.7-17.el9
Doc Type: No Doc Update
Doc Text:
Clone Of:
: 2175860 2175861 2175862 (view as bug list)
Environment:
Last Closed: 2023-11-07 08:52:59 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
Reproducer for arbitrary KDFs (10.01 KB, text/x-csrc)
2023-01-13 14:12 UTC, Clemens Lang
no flags Details
Reproducer for arbitrary KDFs (now queries indicator after EVP_KDF_derive and supports PBKDF2) (10.26 KB, text/x-csrc)
2023-02-17 13:21 UTC, Clemens Lang
no flags Details
Reproducer for arbitrary KDFs (now queries indicator after EVP_KDF_derive and supports PBKDF2, TLS1PRF, TLS13KDF) (11.24 KB, text/x-csrc)
2023-03-16 14:11 UTC, Clemens Lang
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Gitlab redhat/centos-stream/rpms openssl merge_requests 93 0 None opened Draft: KDF: Add FIPS indicators 2023-02-27 15:26:02 UTC
Red Hat Issue Tracker CRYPTO-9273 0 None None None 2023-01-13 17:12:41 UTC
Red Hat Issue Tracker RHELPLAN-145056 0 None None None 2023-01-13 14:13:57 UTC
Red Hat Product Errata RHBA-2023:6627 0 None None None 2023-11-07 08:53:37 UTC

Description Clemens Lang 2023-01-13 14:12:50 UTC
Created attachment 1937800 [details]
Reproducer for arbitrary KDFs

Description of problem:

OpenSSL implements various KDFs that are available in FIPS mode:
 - KBKDF (https://www.openssl.org/docs/man3.0/man7/EVP_KDF-KB.html)
 - HKDF (https://www.openssl.org/docs/man3.0/man7/EVP_KDF-HKDF.html)
 - SSHKDF (https://www.openssl.org/docs/man3.0/man7/EVP_KDF-SSHKDF.html)
 - SSKDF (https://www.openssl.org/docs/man3.0/man7/EVP_KDF-SS.html)
   - in H(x) = hash(x, digest=md) mode
   - in H(x) = HMAC_hash(x, key=salt, digest=md) mode
   - in H(x) = KMACxxx(x, key=salt, custom="KDF", outlen=mac_size) mode
 - X9.63 KDF (https://www.openssl.org/docs/man3.0/man7/EVP_KDF-X963.html), implemented together with SSKDF
 - X9.42 KDF (https://www.openssl.org/docs/manmaster/man7/EVP_KDF-X942-ASN1.html)
 - TLS1PRF (https://www.openssl.org/docs/man3.0/man7/EVP_KDF-TLS1_PRF.html)
 - TLS1.3PRF (https://www.openssl.org/docs/man3.0/man7/EVP_KDF-TLS13_KDF.html)

Most of these KDFs (with the exception of SSKDF in KMAC mode) use hash functions. Not all hash functions are acceptable for FIPS according to our lab.

Specifically, we need to place the following restrictions:

 - TLS1PRF: SHA-256, SHA-384, and SHA-512 only
 - X9.42, X9.63, and SSHKDF: SHA-1, SHA-224, SHA-256, SHA-384, and SHA-512 only

We should also reconfirm what restrictions are required for HKDF, SSKDF, and TLS1.3PRF, if any.


Version-Release number of selected component (if applicable):
openssl-libs-3.0.1-44.el9_0.1.x86_64

How reproducible:
Run the attached reproducer with algorithms that should not be supported (e.g., SHAKE128/SHAKE256)

Steps to Reproduce:
1. head -1 kdf2.c | sed -E 's#^// ##g'
2. ./kdf2 SSHKDF SHAKE128 "" 14 14 14 32
3. ./kdf2 SSKDF SHAKE128 "" 14 14 14 32
4. ./kdf2 X963KDF SHAKE256 "" 14 14 14 32
5. ./kdf2 X942KDF-ASN1 SHAKE128 AES-128-WRAP 14 14 14 32

Actual results:
Use of SHAKE128 works

Expected results:
THese calls fail

Additional info:
Restrictions are specified in FIPS 140-3 IG C.C, SP 800-135r1 5.2, SP 800-135r1 4.2, and other sections of SP 800-135r1.

Comment 3 Clemens Lang 2023-01-17 18:49:10 UTC
As a clarification:

- for X9.63 KDF, SHA-1 is not approved, i.e. SHA-224, SHA-256, SHA-384, and SHA-512 only
- KBKDF: all except SHAKE
- HKDF: all except SHAKE
- SSKDF: all except SHAKE
- TLS1.3PRF: SHA-256 and SHA-384 only

Comment 4 Clemens Lang 2023-02-13 09:00:51 UTC
Further clarification from NIST is available that says FIPS 180-4 or FIPS 202 hash functions are permissible where FIPS 180-3 is referenced, and can be vendor-affirmed where testing by ACVP is not yet available.
This means that the only limitations now are on hash functions approved for specific applications (TLS1PRF, TLS1.3PRF, SSHKDF) and on the use of SHAKE. In summary:

- X9.63, X9.42, KBKDF, HKDF, SSKDF: all except SHAKE
- TLS1PRF: SHA-256, SHA-384, and SHA-512 only
- TLS1.3PRF: SHA-256 and SHA-384 only
- SSHKDF: SHA-1, SHA-224, SHA-256, SHA-384, and SHA-512 only

Comment 5 Clemens Lang 2023-02-17 13:21:04 UTC
Created attachment 1944757 [details]
Reproducer for arbitrary KDFs (now queries indicator after EVP_KDF_derive and supports PBKDF2)

Comment 6 Clemens Lang 2023-02-21 09:05:21 UTC
Further further clarification from the lab and NIST (https://github.com/usnistgov/ACVP/issues/1403#issuecomment-1435300395) now says that SHA-1 in X9.63 is not approved, but the same implementation with a different order of fields that are concatenated to be hashed is SSKDF are approved, so X9.63 needs to set the indicator to unapproved when SHA-1 is used.

Comment 11 Clemens Lang 2023-03-16 14:11:56 UTC
Created attachment 1951291 [details]
Reproducer for arbitrary KDFs (now queries indicator after EVP_KDF_derive and supports PBKDF2, TLS1PRF, TLS13KDF)

Comment 20 errata-xmlrpc 2023-11-07 08:52:59 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (openssl bug fix and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2023:6627


Note You need to log in before you can comment on or make changes to this bug.