Repository navigation
Fix the FIPS v5 PRB build and test failures - #298
Merged
JacobBarthelmeh merged 5 commits intoNov 11, 2026
Merged
Conversation
wp11_Rsa_CheckRange() is only called from the CKM_RSA_X_509 verify path, which is built with WC_RSA_DIRECT. Against a wolfSSL without WC_RSA_DIRECT the unused static function breaks -Werror builds.
find_store_file() is only used by the legacy store test, which is compiled out for FIPS with NSS, without PBKDF2 or scrypt, and with WOLFSSL_STM32U5_DHUK. Those builds failed with -Werror=unused-function, as the PRB-wolfpkcs11-fips-v5 Jenkins job has on every PR. Move the function into the block.
Since C_SetPIN re-encrypts token objects, the user path hashes the old PIN itself. When the PIN is too short for the PIN hash, as below the FIPS HMAC minimum key length, the hash error was returned and C_SetPIN reported CKR_FUNCTION_FAILED instead of CKR_PIN_INCORRECT, unlike C_Login and the SO path. Treat it as an incorrect PIN. As with a login, it does not count toward the lockout.
FIPS v5 rejects HMAC keys shorter than 14 bytes. login_pin_state_test used 13 byte PINs for the wrong old PIN and for the PIN replacing an empty one, and the HKDF length test used a 4 byte salt, which HKDF-Extract uses as the HMAC key. Lengthen them so the tests pass in the FIPS v5 PRB build.
C_Initialize runs the FIPS self-tests. With every allocation failing, the self-tests that allocate fail, and a failed self-test disables its algorithm until the process exits, so the retry and every later initialization in the test fail. Skip the test in FIPS builds.
JacobBarthelmeh
approved these changes
Nov 11, 2026
dgarske
approved these changes
Nov 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes the PRB-wolfpkcs11-fips-v5 Jenkins job (FIPS v5.2.1 with
--enable-nss), which has been failing on every PR since mid-October. Its result had stopped reaching PRs; that is fixed on the Jenkins side, so theFIPSv5 (./fips-check.sh linuxv5)status shows again.Build failures
Two static functions are defined in builds where nothing calls them, which breaks
-Werrorbuilds withunused-function.find_store_file()intests/object_policy_integrity_test.cis only used by the legacy store test. That test is compiled out for FIPS with NSS, without PBKDF2 or scrypt, and withWOLFSSL_STM32U5_DHUK, so the FIPSv5 job stopped at compile time. The function now lives inside the legacy store test block.wp11_Rsa_CheckRange()insrc/internal.cis only called from theCKM_RSA_X_509verify path, which is built withWC_RSA_DIRECT. It is now built only withWC_RSA_DIRECT.FIPS v5 test failures
With the build fixed,
make checkfailed 4 tests under FIPS v5:pkcs11test,login_pin_state_test: sinceC_SetPINre-encrypts token objects, the user path hashes the old PIN itself. An old PIN below the FIPS HMAC minimum key length (14 bytes) madeC_SetPINreturnCKR_FUNCTION_FAILEDinstead ofCKR_PIN_INCORRECT. It is now reported as an incorrect PIN, asC_Loginand the SO path already do, and like a login it does not count toward the lockout.login_pin_state_test: the wrong old PIN and the PIN replacing an empty one were 13 bytes, which FIPS cannot hash, so the lockout and empty PIN tests could not work. They are now 15 bytes.kdf_tls_derive_test: the HKDF length test used a 4 byte salt, which HKDF-Extract uses as the HMAC key. It is now 16 bytes.token_store_test: the init out of memory test fails every allocation duringC_Initialize, which runs the FIPS self-tests. The self-tests that allocate fail, and a failed self-test disables its algorithm until the process exits, so the retry and every later initialization in the test fail. The test is skipped in FIPS builds.Testing
fips-check.sh linuxv5on wolfSSL master, same configure flags), indebian:bookworm: before the fixesmake checkfailed the same 4 tests as the job. After, 85 pass, 8 skip, 0 fail, run as a non-root user so the store failure tests run too.--enable-nss,-Werror: the unfixedfind_store_file()fails to build with the same error as the job; with the fix it builds clean andmake checkpasses.WC_RSA_DIRECTinoptions.h,--enable-nss,-Werror: builds clean andmake checkpasses.