Skip to content

digest: register SHAKE-128 - #520

Merged
yosuke-wolfssl merged 3 commits into
wolfSSL:masterfrom
ColtonWilley:fix/shake128
Dec 3, 2026
Merged

yosuke-wolfssl merged 3 commits into
wolfSSL:masterfrom
ColtonWilley:fix/shake128

Conversation

@ColtonWilley

Copy link
Copy Markdown
Contributor

wolfCrypt has SHAKE-128 but only SHAKE-256 was exposed, so in replace-default mode Python's import hashlib logs a traceback, hashlib.shake_128 is missing and openssl dgst -shake128 fails. Registers SHAKE-128 (wolfSSL 5.5.1+; FIPS v5 has no SHAKE, FIPS Ready does), adds EVP_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.

Copilot AI balanced review requested due to automatic review settings October 27, 2026 21:02

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔵 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

@ColtonWilley ColtonWilley added the ci:all PR OSP toggle: run all label Dec 2, 2026
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.
@yosuke-wolfssl

Copy link
Copy Markdown
Contributor

@claude review

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Nothing blocking. The comments below are optional suggestions. There is no need to push a fix for them before merging.

Comment thread test/test_digest.c Resolved

@wolfSSL-Fenrir-bot wolfSSL-Fenrir-bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Fenrir Automated Review — PR #520

Scan targets checked: wolfprovider-src, wolfprovider-bugs
Not reviewed (no scan target covers them): README.md, scripts/evp_test/evpmd_sha.txt, test/unit.h
Coverage: 4 of 6 in-scope changed file(s) opened by the reviewer; not opened: include/wolfprovider/alg_funcs.h, test/unit.c

Fenrir result: Approved ✅

No new issues found in the changed files.

Advisory only — this automated result does not count as a GitHub approval.

Review tier: Max

@yosuke-wolfssl
yosuke-wolfssl merged commit 41f8063 into wolfSSL:master Dec 3, 2026
84 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci:all PR OSP toggle: run all

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Expose SHAKE-128 digest (SHA-3 family and SHAKE-256 are registered; SHAKE-128 is not)

4 participants