Skip to content

Harden wolfcrypt wrapper argument and error handling - #65

Open
aidangarske wants to merge 31 commits into
wolfSSL:masterfrom
aidangarske:fenrir-fixes-wolfcrypt-wrappers
Open

aidangarske wants to merge 31 commits into
wolfSSL:masterfrom
aidangarske:fenrir-fixes-wolfcrypt-wrappers

Conversation

@aidangarske

Copy link
Copy Markdown
Member

F-14889 - b401c86 - Wc_ecc_negate_private now returns an error for keys with no curve or no private scalar instead of dereferencing NULL.

F-7872 - 11f50be - Wc_EncodeSignature now encodes into a bounded C buffer and rejects a digest that is too long or an output slice that is too short.

F-12015 - e041ae4 - Wc_curve25519_export_private_raw_ex now takes an endian argument so a little endian export round trips with import, and the old big endian export is kept and marked Deprecated.

F-2549 - 705a9b4 - Wc_Blake2s_HMAC_ex now returns the BLAKE2s HMAC error code, and the old void Wc_Blake2s_HMAC is kept as a deprecated wrapper.

F-3284 - 0125f02 - Wc_HmacFinal now rejects an output slice shorter than the HMAC digest.

F-7876 - a07e468 - The ChaCha20-Poly1305 wrappers now require exact key and IV lengths instead of truncating a long key, and the disabled-feature fallback sizes match wolfSSL.

F-9633 - d4001ef - The HKDF helper now returns the FIPS private key unlock and lock status instead of dropping it.

F-9634 - 2599106 - The PBKDF2 and ECC unlocked helpers now return the FIPS private key lock status instead of dropping it.

F-9648 - 24a4b75 - The RSA key generation wrapper now rejects key sizes and exponents that do not fit the C parameter types.

F-9649 - 7195ad8 - The RNG block wrapper now rejects lengths that do not fit in word32 instead of returning success on a no-op.

F-9650 - 954a99a - The SHA-256 update wrapper now rejects lengths that do not fit in word32 instead of returning success on a no-op.

F-9651 - 912cf8b - The BLAKE2s update wrapper now rejects lengths that do not fit in word32.

F-9652 - db7b97f - The HMAC update wrapper now rejects lengths that do not fit in word32.

F-9653 - ce077fd - The AES-GCM wrappers now reject input, AAD and tag lengths that do not fit in word32.

F-9654 - 835adac - The ChaCha20-Poly1305 wrappers now reject lengths that do not fit in word32.

F-12019 - 4961b56 - Wc_AesSetKey now rejects an IV shorter than one block instead of letting C read past the slice.

F-12020 - e1e4141 - The AES-CBC wrappers now reject lengths that do not fit in word32.

F-12021 - 6790b6c - Wc_HmacSetKey now rejects key lengths that do not fit in word32.

F-12022 - 7e28fb0 - Wc_HKDF now rejects salt, info, key and output lengths that do not fit in word32.

F-14915 - 5860ab1 - Wc_Blake2sFinal now resolves a requested size of 0 to the digest size and bounds it by the output slice, instead of writing 32 bytes into a 16 byte slice.

F-4402 - c9b1eab - The PEM passphrase C copy is now zeroed before it is freed.

F-7869 - f642726 - Wc_Blake2s_HMAC now writes only the requested number of output bytes.

F-7870 - 9f07344 - Wc_AesInit now returns BAD_FUNC_ARG for a non-nil heap hint instead of silently dropping it.

F-7881 - b4ee613 - The five one-shot hash wrappers now reject input that does not fit in word32.

F-12054 - 8030bec - Wc_KeyPemToDer now rejects passphrases containing a NUL byte.

F-12820 - 3ced2b6 - The ECC verify wrapper now clears its result flag when verification returns an error.

F-12821 - a8527eb - The AES-GCM appended tag encrypt now returns nil and the error code on failure instead of a buffer.

F-12841 - b1504f9 - Package init now panics when the RNG seed callback cannot be set instead of continuing without it.

F-12848 - e1bd774 - The ChaCha20-Poly1305 appended tag encrypt now returns nil and the error code on failure instead of a buffer.

F-13585 - 75abdcd - Wc_HKDF now returns NOT_COMPILED_IN when wolfSSL lacks HKDF, because its body is guarded by HAVE_HKDF.

CI - 7774630 - The build workflow now runs go test on the root package in both the full and default configs.

@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 #65

Scan targets checked: go-wolfssl-src, go-wolfssl-bugs
Coverage: 8 of 15 in-scope changed file(s) opened by the reviewer; not opened: hash.go, random.go, sha.go, wolfcrypt_hugeslice_other_test.go, wolfcrypt_hugeslice_unix_test.go, wolfcrypt_len.go, wolfcrypt_wrappers_test.go

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: Lite

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.

3 participants