Skip to content

Rust wrapper: add rand_core, aead, cipher trait implementations#10070

Open
holtrop-wolfssl wants to merge 6 commits intowolfSSL:masterfrom
holtrop-wolfssl:rust-rand_core-aead-cipher
Open

Rust wrapper: add rand_core, aead, cipher trait implementations#10070
holtrop-wolfssl wants to merge 6 commits intowolfSSL:masterfrom
holtrop-wolfssl:rust-rand_core-aead-cipher

Conversation

@holtrop-wolfssl
Copy link
Copy Markdown
Contributor

Description

This PR adds APIs which implement the traits in the rand_core, aead, and cipher crates.

This makes our crate more compatible with the rest of the Rust ecosystem.

Testing

Unit tests

Checklist

  • added tests
  • updated/added doxygen
  • updated appropriate READMEs
  • Updated manual and documentation

@holtrop-wolfssl holtrop-wolfssl self-assigned this Mar 25, 2026
Copilot AI review requested due to automatic review settings March 25, 2026 14:53
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR extends the wolfssl-wolfcrypt Rust wrapper with trait implementations from common ecosystem crates (rand_core, aead, cipher) to improve interoperability with existing Rust crypto APIs.

Changes:

  • Add optional crate features and dependencies for rand_core, aead, and cipher.
  • Implement rand_core RNG traits for RNG, plus aead/cipher trait adapters for ChaCha20-Poly1305/XChaCha20-Poly1305 and multiple AES modes.
  • Add new unit tests covering the new trait-based APIs, and update the wrapper Makefile to build/test with these features enabled.

Reviewed changes

Copilot reviewed 8 out of 9 changed files in this pull request and generated 9 comments.

Show a summary per file
File Description
wrapper/rust/wolfssl-wolfcrypt/src/random.rs Adds rand_core trait implementation for RNG.
wrapper/rust/wolfssl-wolfcrypt/src/chacha20_poly1305.rs Adds aead trait adapter types for ChaCha20-Poly1305 and XChaCha20-Poly1305; adjusts XChaCha struct form.
wrapper/rust/wolfssl-wolfcrypt/src/aes.rs Adds aead adapters for AES-GCM/CCM and cipher adapters for AES ECB/CBC and stream modes (CTR/OFB).
wrapper/rust/wolfssl-wolfcrypt/tests/test_random.rs Adds tests validating rand_core trait behavior on RNG.
wrapper/rust/wolfssl-wolfcrypt/tests/test_chacha20_poly1305.rs Adds aead-trait tests for ChaCha20-Poly1305 and XChaCha20-Poly1305.
wrapper/rust/wolfssl-wolfcrypt/tests/test_aes.rs Adds aead and cipher trait tests for AES modes (GCM/CCM, ECB/CBC, CTR/OFB).
wrapper/rust/wolfssl-wolfcrypt/Cargo.toml Declares new optional features/dependencies and dev-dependencies for tests.
wrapper/rust/wolfssl-wolfcrypt/Makefile Builds/tests/docs with the new features enabled by default.
wrapper/rust/wolfssl-wolfcrypt/Cargo.lock Locks newly introduced dependency graph entries.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@holtrop-wolfssl
Copy link
Copy Markdown
Contributor Author

retest this please (Calling Pipeline was cancelled)

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 9 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@holtrop-wolfssl holtrop-wolfssl removed their assignment Mar 26, 2026
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.

4 participants