Skip to content

Improve FIPS error diagnostics#207

Merged
rlm2002 merged 3 commits intowolfSSL:masterfrom
cconlon:fipsCallback
Apr 1, 2026
Merged

Improve FIPS error diagnostics#207
rlm2002 merged 3 commits intowolfSSL:masterfrom
cconlon:fipsCallback

Conversation

@cconlon
Copy link
Copy Markdown
Member

@cconlon cconlon commented Mar 30, 2026

Summary

  • Register a default FIPS error callback in WolfCryptProvider that logs the error code, description, and verifyCore hash to stderr on first occurrence of each unique error. Suppresses duplicate messages. If wolfJSSE is also registered, the last provider instantiated has its callback active (both provide equivalent logging).
  • Enrich WolfCryptException for FIPS_NOT_ALLOWED_E errors by querying wolfCrypt_GetStatus_fips() and appending the underlying module status (e.g., DRBG continuous test failure, integrity check failure) to the exception message.
  • Fix 6 threaded MessageDigest tests that hang indefinitely when FIPS operations fail, due to threads dying without calling latch.countDown().

@cconlon cconlon self-assigned this Mar 30, 2026
Copilot AI review requested due to automatic review settings March 30, 2026 22:26
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves FIPS failure diagnostics in the wolfJCE provider and makes threaded MessageDigest tests more robust when FIPS-related failures occur.

Changes:

  • Add a default wolfCrypt FIPS error callback in WolfCryptProvider that logs diagnostic details.
  • Enrich WolfCryptException messages for FIPS_NOT_ALLOWED_E by appending the underlying FIPS module status when available.
  • Adjust multiple threaded MessageDigest tests to avoid indefinite hangs when thread setup fails.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
src/main/java/com/wolfssl/provider/jce/WolfCryptProvider.java Registers a default FIPS error callback and logs FIPS errors for diagnostics.
src/main/java/com/wolfssl/wolfcrypt/WolfCryptException.java Builds a richer error message for FIPS_NOT_ALLOWED_E by querying module status.
src/test/java/com/wolfssl/provider/jce/test/WolfCryptMessageDigestShaTest.java Adds latch countdown on MessageDigest instantiation failure in threaded test.
src/test/java/com/wolfssl/provider/jce/test/WolfCryptMessageDigestSha256Test.java Adds latch countdown on MessageDigest instantiation failure in threaded test.
src/test/java/com/wolfssl/provider/jce/test/WolfCryptMessageDigestSha384Test.java Adds latch countdown on MessageDigest instantiation failure in threaded test.
src/test/java/com/wolfssl/provider/jce/test/WolfCryptMessageDigestSha512Test.java Adds latch countdown on MessageDigest instantiation failure in threaded test.
src/test/java/com/wolfssl/provider/jce/test/WolfCryptMessageDigestSha3Test.java Adds latch countdown on MessageDigest instantiation failure in threaded test.
src/test/java/com/wolfssl/provider/jce/test/WolfCryptMessageDigestMd5Test.java Adds latch countdown on MessageDigest instantiation failure in threaded test.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/main/java/com/wolfssl/provider/jce/WolfCryptProvider.java Outdated
Comment thread src/main/java/com/wolfssl/provider/jce/WolfCryptProvider.java Outdated
Comment thread src/test/java/com/wolfssl/provider/jce/test/WolfCryptMessageDigestShaTest.java Outdated
Comment thread src/test/java/com/wolfssl/provider/jce/test/WolfCryptMessageDigestSha256Test.java Outdated
Comment thread src/test/java/com/wolfssl/provider/jce/test/WolfCryptMessageDigestSha384Test.java Outdated
Comment thread src/test/java/com/wolfssl/provider/jce/test/WolfCryptMessageDigestSha3Test.java Outdated
Comment thread src/test/java/com/wolfssl/provider/jce/test/WolfCryptMessageDigestSha512Test.java Outdated
Comment thread src/test/java/com/wolfssl/provider/jce/test/WolfCryptMessageDigestMd5Test.java Outdated
Copilot AI review requested due to automatic review settings March 31, 2026 18:30
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@cconlon cconlon assigned rlm2002 and unassigned cconlon Apr 1, 2026
@rlm2002 rlm2002 merged commit 13e83eb into wolfSSL:master Apr 1, 2026
79 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants