Skip to content

sha3: add Memory Usage bench and Security Considerations docs - #95

Open
ounsworth wants to merge 1 commit into
bcgit:release/0.1.3alphafrom
ounsworth:docs/sha3-mem-usage-and-security
Open

sha3: add Memory Usage bench and Security Considerations docs#95
ounsworth wants to merge 1 commit into
bcgit:release/0.1.3alphafrom
ounsworth:docs/sha3-mem-usage-and-security

Conversation

@ounsworth

Copy link
Copy Markdown
Contributor

Break up of #87, so this is actually dgh's submission. So I will be reviewing / approving.

QUALITY_AND_STYLE.md requires every primitive crate's docs to carry a "Memory Usage" section with a stack-usage table and, usually, a "Security Considerations" section; SHA-3 had neither.

The Memory Usage table's figures come from a new
mem_usage_benches/bench_sha3_mem_usage.rs, following the existing bench_mldsa_mem_usage / bench_mlkem_mem_usage: print_struct_sizes() reports size_of for SHA3_224..SHA3_512 and SHAKE128/256 (all 440 bytes, since every variant shares the same Keccak-f[1600] sponge) and SUSPENDED_SHA3_STATE_LEN (415). The remaining entry points -- one-shot hash, streaming, XOF squeeze, suspend/resume -- exist for valgrind --tool=massif peak-stack measurement, which criterion cannot do.

Security Considerations cites FIPS 202 Appendix A.1 for the strengths and A.2 for the XOF prefix property (SHAKE128(m, 32) is a prefix of SHAKE128(m, 64)), and notes that the sponge state is held in Secret and zeroized on drop.

…age bench

QUALITY_AND_STYLE.md requires every primitive crate's docs to carry a
"Memory Usage" section with a stack-usage table and, usually, a
"Security Considerations" section; SHA-3 had neither.

The Memory Usage table's figures come from a new
mem_usage_benches/bench_sha3_mem_usage.rs, following the existing
bench_mldsa_mem_usage / bench_mlkem_mem_usage: print_struct_sizes()
reports size_of for SHA3_224..SHA3_512 and SHAKE128/256 (all 440 bytes,
since every variant shares the same Keccak-f[1600] sponge) and
SUSPENDED_SHA3_STATE_LEN (415). The remaining entry points -- one-shot
hash, streaming, XOF squeeze, suspend/resume -- exist for
valgrind --tool=massif peak-stack measurement, which criterion cannot do.

Security Considerations cites FIPS 202 Appendix A.1 for the strengths and
A.2 for the XOF prefix property (SHAKE128(m, 32) is a prefix of
SHAKE128(m, 64)), and notes that the sponge state is held in Secret and
zeroized on drop.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.

1 participant