wolfCrypt's C API takes non-const (mutable) key pointers for operations that are logically read-only, including signature verification and public-key access. Affected functions include:
wc_Ed25519Sign, wc_Ed25519Verify
wc_Ed448Sign, wc_Ed448Verify
wc_ecc_sign_hash, wc_ecc_verify_hash
wc_RsaSSL_Sign, wc_RsaSSL_Verify
wc_MlDsaKey_Sign, wc_MlDsaKey_Verify
Impact: For Rust FFI wrappers, the standard Verifier trait takes &self (shared/immutable reference). There is no safe way to obtain *mut from &self without interior mutability, so every key type that backs sign or verify must be wrapped in UnsafeCell, propagating !Sync throughout the key hierarchy. This is a significant ergonomic burden.
The same pattern affects other language FFI wrappers (Python, Go, C++) that distinguish const/non-const or immutable/mutable references.
Suggested approach: Extend const-correctness to the sign/verify function set as an ongoing effort. The Ed448 DER functions were already fixed in PR #10372 as a contained starting point.
Migrated from internal tracking (ZD-21739).
wolfCrypt's C API takes non-const (mutable) key pointers for operations that are logically read-only, including signature verification and public-key access. Affected functions include:
wc_Ed25519Sign,wc_Ed25519Verifywc_Ed448Sign,wc_Ed448Verifywc_ecc_sign_hash,wc_ecc_verify_hashwc_RsaSSL_Sign,wc_RsaSSL_Verifywc_MlDsaKey_Sign,wc_MlDsaKey_VerifyImpact: For Rust FFI wrappers, the standard
Verifiertrait takes&self(shared/immutable reference). There is no safe way to obtain*mutfrom&selfwithout interior mutability, so every key type that backs sign or verify must be wrapped inUnsafeCell, propagating!Syncthroughout the key hierarchy. This is a significant ergonomic burden.The same pattern affects other language FFI wrappers (Python, Go, C++) that distinguish const/non-const or immutable/mutable references.
Suggested approach: Extend const-correctness to the sign/verify function set as an ongoing effort. The Ed448 DER functions were already fixed in PR #10372 as a contained starting point.
Migrated from internal tracking (ZD-21739).