Crypto: FaultOperation::pbkdf2 is never honored #51

Closed
opened 2026-12-03 13:41:25 +00:00 by faumaray · 1 comment
Owner

Context: Forge M04 fault-tests its crypto wrappers with Void::Crypto::ScopedFaultGuard. FaultOperation has a pbkdf2 value (include/Void/Crypto/Types.hpp), but pbkdf2_hmac_sha256_into in src/Crypto/Crypto.cpp never calls maybe_inject_fault; it goes straight to Detail::builtin_pbkdf2_hmac_sha256 (or OpenSSL). A guard with op = FaultOperation::pbkdf2 therefore has no effect.

Expected: inject a backend fault (and wipe the output) like the HMAC path does, so callers can test failure mapping deterministically.

Context: Forge M04 fault-tests its crypto wrappers with `Void::Crypto::ScopedFaultGuard`. `FaultOperation` has a `pbkdf2` value (`include/Void/Crypto/Types.hpp`), but `pbkdf2_hmac_sha256_into` in `src/Crypto/Crypto.cpp` never calls `maybe_inject_fault`; it goes straight to `Detail::builtin_pbkdf2_hmac_sha256` (or OpenSSL). A guard with `op = FaultOperation::pbkdf2` therefore has no effect. Expected: inject a backend fault (and wipe the output) like the HMAC path does, so callers can test failure mapping deterministically.
Author
Owner

Already fixed on main by the PBKDF2 work merged for #41 (commit 74bd01a): pbkdf2_hmac_sha256_into validates bounds, then calls maybe_inject_fault(FaultOperation::pbkdf2, "Crypto::pbkdf2_hmac_sha256") and secure_wipe(output) before returning the injected error; the built-in and OpenSSL paths run only afterwards. tests/standalone/Crypto/HmacPbkdf2.cpp covers a ScopedFaultGuard{FaultConfig{FaultOperation::pbkdf2, provider_error, 0}} and asserts the destination is zeroed. Verified now: Testing;Crypto -Werror suite passes (397 tests, 394 ✔, 3 ⊘). Closing as done.

Already fixed on `main` by the PBKDF2 work merged for #41 (commit `74bd01a`): `pbkdf2_hmac_sha256_into` validates bounds, then calls `maybe_inject_fault(FaultOperation::pbkdf2, "Crypto::pbkdf2_hmac_sha256")` and `secure_wipe(output)` before returning the injected error; the built-in and OpenSSL paths run only afterwards. `tests/standalone/Crypto/HmacPbkdf2.cpp` covers a `ScopedFaultGuard{FaultConfig{FaultOperation::pbkdf2, provider_error, 0}}` and asserts the destination is zeroed. Verified now: `Testing;Crypto` `-Werror` suite passes (397 tests, 394 ✔, 3 ⊘). Closing as done.
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Void/Library#51