Repository navigation
digest: register SHAKE-128 - #520
Open
ColtonWilley wants to merge 3 commits into
Open
ColtonWilley wants to merge 3 commits into
ColtonWilley wants to merge 3 commits into
Conversation
Add the squeeze call OpenSSL 3.3+ uses (ML-KEM, ML-DSA) and match the default provider's output length handling: no default length or digest size from 3.4, xoflen/size readable from the context. Mark the AlgorithmIdentifier parameters absent; no absorbing after output starts.
wolfCrypt builds with WOLFSSL_SHAKE128 but only SHAKE-256 was exposed, so SHAKE-128 fetches (openssl dgst -shake128, Python hashlib) failed. Reuse the SHAKE-256 XOF code with the wc_Shake128 functions.
Mirror test_shake_256 for SHAKE-128 and compare default length final, squeeze across block boundaries and flags with OpenSSL for both SHAKEs. Enable the SHAKE128 evp_test vectors.
There was a problem hiding this comment.
🔵 Needs a closer look
Shared cryptographic state-machine changes warrant human review and runtime validation across supported OpenSSL, wolfSSL, and FIPS configurations.
No open issues 🎉
What changed in this PR
Exposes SHAKE-128 through wolfProvider to address the missing digest reported in #434, and updates shared SHAKE behavior for newer OpenSSL APIs.
Changes:
- Registers SHAKE-128 with feature gating, aliases, and documentation.
- Adds incremental squeezing and OpenSSL 3.4 output-length behavior for both SHAKE variants.
- Expands default-provider parity tests and enables SHAKE-128 test vectors.
| File | Description |
|---|---|
test/unit.h |
Declares the SHAKE-128 unit test. |
test/unit.c |
Registers the SHAKE-128 unit test. |
test/test_digest.c |
Tests SHAKE parity, squeezing, lifecycle, and context copying. |
src/wp_wolfprov.c |
Registers SHAKE-128 in the provider digest table. |
src/wp_digests.c |
Implements SHAKE-128 and shared SHAKE state and output handling. |
scripts/evp_test/evpmd_sha.txt |
Enables SHAKE-128 digest vectors. |
README.md |
Lists SHAKE-128 as supported. |
include/wolfprovider/settings.h |
Gates SHAKE-128 on wolfSSL version and features. |
include/wolfprovider/alg_funcs.h |
Adds SHAKE-128 aliases and dispatch declaration. |
Review effort: Balanced
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.
wolfCrypt has SHAKE-128 but only SHAKE-256 was exposed, so in replace-default mode Python's
import hashliblogs a traceback,hashlib.shake_128is missing andopenssl dgst -shake128fails. Registers SHAKE-128 (wolfSSL 5.5.1+; FIPS v5 has no SHAKE, FIPS Ready does), addsEVP_DigestSqueeze(OpenSSL 3.3+, used by ML-KEM/ML-DSA) and OpenSSL 3.4's no-default-length rule for both SHAKEs, and enables the SHAKE128 evp_test vectors. Covered by unit tests comparing against the default provider.Closes #434.