[test] add tbor crypto command fuzz targets - #680
[test] add tbor crypto command fuzz targets#680David Zimmermann (zimmy87) wants to merge 3 commits into
Conversation
dbb0af8 to
e7574d7
Compare
…om/Azure/azihsm-sdk into user/v-davidz/add_tbor_crypto_fuzz
There was a problem hiding this comment.
🟢 Approval recommended
The changes are additive fuzz targets and corresponding Cargo registrations, and the implementations follow existing fuzz-target patterns in this repository.
Pull request overview
Adds new libFuzzer fuzz targets for TBOR crypto-related DDI commands in the fuzz/ crate, expanding emulator-backed round-trip coverage of TBOR request handling for cryptographic operations.
Changes:
- Introduces multiple new TBOR crypto command fuzz targets (AES, ECC, ECDH, HKDF, ConcatKDF, HMAC, RSA mod-exp, unwrap/get-unwrapping-key).
- Bounds fuzzed variable-length inputs to the corresponding TBOR type limits to avoid trivial oversized frames.
- Registers the new fuzz targets as
[[bin]]entries infuzz/Cargo.toml.
File summaries
| File | Description |
|---|---|
| fuzz/fuzz_targets/ddi/tbor/fuzz_tbor_unwrap_key.rs | Fuzzes TborUnwrapKeyReq with bounded wrapped blob input. |
| fuzz/fuzz_targets/ddi/tbor/fuzz_tbor_rsa_mod_exp.rs | Fuzzes TborRsaModExpReq with bounded masked key and input integer. |
| fuzz/fuzz_targets/ddi/tbor/fuzz_tbor_hmac.rs | Fuzzes TborHmacReq, generating a valid masked key via TborHmacGenerateKeyReq. |
| fuzz/fuzz_targets/ddi/tbor/fuzz_tbor_hmac_generate_key.rs | Fuzzes TborHmacGenerateKeyReq parameter space. |
| fuzz/fuzz_targets/ddi/tbor/fuzz_tbor_hkdf_derive.rs | Fuzzes TborHkdfDeriveReq, deriving a valid masked secret via ECC keygen + ECDH. |
| fuzz/fuzz_targets/ddi/tbor/fuzz_tbor_hash.rs | Fuzzes TborHashReq with bounded message input. |
| fuzz/fuzz_targets/ddi/tbor/fuzz_tbor_get_unwrapping_key.rs | Fuzzes TborGetUnwrappingKeyReq round-trips. |
| fuzz/fuzz_targets/ddi/tbor/fuzz_tbor_ecdh_derive.rs | Fuzzes TborEcdhDeriveReq, generating a valid masked key first. |
| fuzz/fuzz_targets/ddi/tbor/fuzz_tbor_ecc_sign.rs | Fuzzes TborEccSignReq, generating a valid masked key first. |
| fuzz/fuzz_targets/ddi/tbor/fuzz_tbor_ecc_generate_key.rs | Fuzzes TborEccGenerateKeyReq parameter space. |
| fuzz/fuzz_targets/ddi/tbor/fuzz_tbor_concat_kdf_derive.rs | Fuzzes TborConcatKdfDeriveReq, deriving a valid masked secret via ECC keygen + ECDH. |
| fuzz/fuzz_targets/ddi/tbor/fuzz_tbor_aes_generate_key.rs | Fuzzes TborAesGenerateKeyReq parameter space. |
| fuzz/fuzz_targets/ddi/tbor/fuzz_tbor_aes_encrypt_decrypt.rs | Fuzzes TborAesEncryptDecryptReq, generating a valid masked key first. |
| fuzz/Cargo.toml | Registers the new fuzz target binaries. |
Review details
- Files reviewed: 14/14 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
There was a problem hiding this comment.
🔵 Needs a closer look
fuzz_tbor_get_unwrapping_key currently ignores its input, making it ineffective as a fuzz target.
Review details
Suppressed comments (1)
Previously missed (1) — in code that hasn't changed since the last review.
fuzz/fuzz_targets/ddi/tbor/fuzz_tbor_get_unwrapping_key.rs:28
- This fuzz target ignores its input entirely, so the fuzzer can't mutate anything meaningful and coverage will be effectively constant. Consider consuming the input to vary
session_id(e.g., sometimes use the real active session id and sometimes a fuzzed one) so validation and error paths are actually fuzzed.
- Files reviewed: 14/14 changed files
- Comments generated: 0 new
- Review effort level: Lite
No description provided.