Commit Graph

345 Commits

Author SHA1 Message Date
Josh Holtrop ca362a4e8f Rust wrapper: also check usize to u32 conversions for digest_size 2026-04-14 20:50:08 -04:00
Josh Holtrop e1a01926bc Rust wrapper: check length returned by Lms.get_kid() in unit test 2026-04-14 20:50:08 -04:00
Josh Holtrop 15ac0718a3 Rust wrapper: make zeroize functions private 2026-04-14 20:50:08 -04:00
Josh Holtrop 2f94121078 Rust wrapper: require caller supplied buffer for Lms.get_kid()
Fixes F-1073.
2026-04-14 20:50:08 -04:00
Josh Holtrop 10fbc95241 Rust wrapper: add comment to MlKem about not implementing Send/Sync
Fixes F-1072.
2026-04-14 20:50:08 -04:00
Josh Holtrop 85ad08a50a Rust wrapper: avoid as_ptr() to *mut u8 casts
Fixes F-1065.
2026-04-14 20:50:08 -04:00
Josh Holtrop 884b882afe Rust wrapper: remove generic types for AES buffers
Fixes F-1071.
This is an API-breaking change, so will lead to a new crate major
version.
2026-04-14 20:50:08 -04:00
Josh Holtrop db1aab959c Rust wrapper: zeroize structs on drop 2026-04-14 20:50:08 -04:00
Josh Holtrop f1a041a216 Rust wrapper: add zeroizing Drop impl for ChaCha20Poly1305
Fix F-1069
2026-04-14 20:50:08 -04:00
Josh Holtrop 2c981d67e6 Rust wrapper: check all buffer lengths when converting to u32/i32
Fix F-1068
2026-04-14 20:50:08 -04:00
Josh Holtrop f00636919e Rust wrapper: check kdr_index range in srtp_kdf() and srtcp_kdf()
Fix F-1257
2026-04-14 20:50:08 -04:00
Josh Holtrop 5c10fe9a58 Rust wrapper: BLAKE2: check for non-empty hash buffer in finalize()
This is related to F-1070 but not the same. We do not need to check
that hash_size being passed in matches the initialized digest size
because the C function will use the passed-in size as long as it is
non-zero.
2026-04-14 20:50:08 -04:00
Josh Holtrop 56c20aeda0 Rust wrapper: dilithium: remove unnecessary size define presence checks
Fix F-1256
2026-04-14 20:50:08 -04:00
Josh Holtrop 5959aa2b58 Rust wrapper: ed448: add check for context buffers too long
Fix F-1064
2026-04-14 20:50:08 -04:00
Josh Holtrop 4f42ba9aa7 Rust wrapper: ed25519: add check for context buffers too long
Fix F-1063
2026-04-14 20:50:08 -04:00
Josh Holtrop 337dfc323e Rust wrapper: avoid uninitialized sys::XtsAesStreamData
Fix F-1066
2026-04-14 20:50:08 -04:00
Josh Holtrop 9843f0365a Rust wrapper: avoid creating a MaybeUninit<RNG>
Fix F-1067
2026-04-14 20:50:08 -04:00
Josh Holtrop a8fa845fa9 Rust wrapper: ecc: fix possible resource leak in some error cases
Fix F-1062.

If wolfSSL returns an error after initializing ECC struct with
wc_ecc_init_ex(), wc_ecc_free() might not have been called in all cases.

Move construction of the ECC struct earlier ahead of further wolfSSL
calls after wc_ecc_init_ex() so if those subsequent wolfSSL calls return
an error the Drop impl for ECC will be called to deinitialize.
2026-04-14 20:50:07 -04:00
David Garske d692f99631 More peer review fixes (Use ML-DSA naming) 2026-04-13 15:55:31 -07:00
David Garske 5f124a9ae9 Peer review fixes 2026-04-13 15:30:58 -07:00
David Garske 72c57dc127 Improvements to C# PQC 2026-04-13 15:30:57 -07:00
Masaki Iwai 21be3776bd add ML-KEM/ML-DSA support for C# wrapper 2026-04-13 15:29:57 -07:00
Sean Parkinson 9176185d66 Merge pull request #10171 from dgarske/hpke_csharp
Add HPKE (RFC 9180) C# wrapper
2026-04-14 08:27:03 +10:00
David Garske c4e7198686 Merge pull request #10070 from holtrop-wolfssl/rust-rand_core-aead-cipher
Rust wrapper: add rand_core, aead, cipher trait implementations
2026-04-13 10:00:26 -07:00
David Garske a82583d50b Add HPKE (RFC 9180) C# wrapper and test 2026-04-12 14:50:11 -07:00
Daniel Pouzzner 60d1e222b2 globally fix all "BLAKE2" references (implicit BLAKE2B) to explicit "BLAKE2B":
* implement legacy compatibility in settings.h and configure.ac (adds --enable-blake2b while retaining --enable-blake2);
* fix incorrect Blake2 gates in wolfcrypt/src/hash.c wc_HashGetDigestSize() and wc_HashGetBlockSize();
* in wolfcrypt/test/test.c hash_test(), backfill missing Blake2 test coverage and separate blake2b from blake2s in typesHashBad[];
* in tests/api/test_hash.c, separate blake2b from blake2s in notCompiledHash[], sizeSupportedHash[], and sizeNotCompiledHash[].
2026-04-07 13:18:53 -05:00
Josh Holtrop aa33d7be35 Rust wrapper: chacha20_poly1305: add debug_assert checking in-place operation maximum length 2026-03-26 09:09:55 -04:00
Josh Holtrop 444f90553a Rust wrapper: document XChaCha20Poly1305 encrypt_in_place_detached maximum buffer length 2026-03-25 13:48:03 -04:00
Josh Holtrop 5d9439c581 Rust wrapper: aes: avoid overlapping Rust slices 2026-03-25 13:43:19 -04:00
Josh Holtrop 23cb7ae30c Rust wrapper: add cipher trait support 2026-03-25 10:51:06 -04:00
Josh Holtrop 873bc05cde Rust wrapper: add aead trait support 2026-03-25 10:51:00 -04:00
Josh Holtrop 07acf8d33d Rust wrapper: add rand_core trait support 2026-03-25 10:50:52 -04:00
Daniel Pouzzner 7efc962d04 Merge pull request #10031 from holtrop-wolfssl/rust-cross-compile-support
Rust wrapper: update build.rs to support cross-compiling and bare-metal targets
2026-03-25 09:46:40 -05:00
Josh Holtrop 34afd28541 Rust wrapper: build.rs improvements from code review 2026-03-25 09:00:28 -04:00
Josh Holtrop a511e45d30 Rust wrapper: build.rs improvements per code review 2026-03-25 08:15:42 -04:00
Tobias Frauenschläger 3fd13b819d Guard old non-ctx ML-DSA API by default 2026-03-24 11:16:22 +01:00
Josh Holtrop ffa466f463 Rust wrapper: minor build.rs improvements for cross-compiling 2026-03-23 11:22:47 -04:00
Josh Holtrop fa25a3818a Rust wrapper: update build.rs to support cross-compiling and bare-metal targets 2026-03-20 13:25:47 -04:00
David Garske be7bf60e38 Merge pull request #10010 from SparkiDev/dilithium_ctxlen_byte
Dilithium: fix API so that context length is byte
2026-03-19 12:26:42 -07:00
Sean Parkinson a8247bfd62 Dilithium: fix API so that context length is byte
Only allowed to have a context length of 0..255 bytes.
Make all context len parameters type byte.
2026-03-19 14:28:22 +10:00
Josh Holtrop b6584d1e96 Rust wrapper: wolfssl-wolfcrypt crate version 1.2.0 2026-03-13 08:08:23 -04:00
Josh Holtrop fa07db2cc6 Rust wrapper: add lms module 2026-03-06 10:19:12 -05:00
Josh Holtrop a87446ca9e Rust wrapper: mlkem: avoid unit test warnings 2026-03-02 11:49:14 -05:00
Josh Holtrop d12285cb6f Rust wrapper: mlkem: update ss buffer length requirement comment 2026-02-27 15:04:16 -05:00
Josh Holtrop 4235fa59b6 Add comments explaining ct.len() and ss.len() checks 2026-02-26 15:09:12 -05:00
Josh Holtrop 67c500ec87 Rust wrapper: add mlkem module 2026-02-25 14:16:20 -05:00
Josh Holtrop 7af0fa497a Rust wrapper: update dilithium module after review 2026-02-24 14:23:59 -05:00
Josh Holtrop 504617bbe9 Rust wrapper: add dilithium module 2026-02-23 10:54:21 -05:00
Josh Holtrop 3da3e12edc Rust wrapper: fix no_std support
Generate bindgen API with core instead of std
Replace C types using std:: with core::
Replace std::mem usage with core::mem
2026-02-20 07:10:01 -05:00
Josh Holtrop 2ada1a3629 Rust wrapper: add compatibility with older FIPS v5 package 2026-02-19 12:50:05 -05:00