From 8cd0c9bd11da15e88c8453664c194e0d54341174 Mon Sep 17 00:00:00 2001 From: Josh Holtrop Date: Fri, 12 Dec 2025 15:23:45 -0500 Subject: [PATCH 1/9] Rust wrapper: rename wolfssl crate to wolfssl-wolfcrypt --- wrapper/rust/Makefile | 6 +- wrapper/rust/README.md | 18 ++- wrapper/rust/include.am | 66 ++++----- .../{wolfssl => wolfssl-wolfcrypt}/Cargo.lock | 2 +- .../{wolfssl => wolfssl-wolfcrypt}/Cargo.toml | 4 +- .../{wolfssl => wolfssl-wolfcrypt}/Makefile | 0 .../{wolfssl => wolfssl-wolfcrypt}/build.rs | 0 .../{wolfssl => wolfssl-wolfcrypt}/headers.h | 0 .../src}/aes.rs | 22 +-- .../src}/cmac.rs | 16 +- .../wolfcrypt => wolfssl-wolfcrypt/src}/dh.rs | 86 +++++------ .../src}/ecc.rs | 138 ++++++++--------- .../src}/ed25519.rs | 126 ++++++++-------- .../src}/ed448.rs | 118 +++++++-------- .../src}/hkdf.rs | 30 ++-- .../src}/hmac.rs | 14 +- .../src}/kdf.rs | 56 +++---- .../src/lib.rs} | 9 +- .../src}/prf.rs | 4 +- .../src}/random.rs | 10 +- .../src}/rsa.rs | 86 +++++------ .../src}/sha.rs | 140 +++++++++--------- .../{wolfssl => wolfssl-wolfcrypt}/src/sys.rs | 0 .../tests/test_aes.rs | 2 +- .../tests/test_cmac.rs | 2 +- .../tests/test_dh.rs | 4 +- .../tests/test_ecc.rs | 4 +- .../tests/test_ed25519.rs | 4 +- .../tests/test_ed448.rs | 4 +- .../tests/test_hkdf.rs | 6 +- .../tests/test_hmac.rs | 4 +- .../tests/test_kdf.rs | 6 +- .../tests/test_prf.rs | 2 +- .../tests/test_random.rs | 2 +- .../tests/test_rsa.rs | 4 +- .../tests/test_sha.rs | 2 +- .../tests/test_wolfcrypt.rs | 2 +- wrapper/rust/wolfssl/src/lib.rs | 22 --- 38 files changed, 505 insertions(+), 516 deletions(-) rename wrapper/rust/{wolfssl => wolfssl-wolfcrypt}/Cargo.lock (99%) rename wrapper/rust/{wolfssl => wolfssl-wolfcrypt}/Cargo.toml (82%) rename wrapper/rust/{wolfssl => wolfssl-wolfcrypt}/Makefile (100%) rename wrapper/rust/{wolfssl => wolfssl-wolfcrypt}/build.rs (100%) rename wrapper/rust/{wolfssl => wolfssl-wolfcrypt}/headers.h (100%) rename wrapper/rust/{wolfssl/src/wolfcrypt => wolfssl-wolfcrypt/src}/aes.rs (99%) rename wrapper/rust/{wolfssl/src/wolfcrypt => wolfssl-wolfcrypt/src}/cmac.rs (97%) rename wrapper/rust/{wolfssl/src/wolfcrypt => wolfssl-wolfcrypt/src}/dh.rs (97%) rename wrapper/rust/{wolfssl/src/wolfcrypt => wolfssl-wolfcrypt/src}/ecc.rs (95%) rename wrapper/rust/{wolfssl/src/wolfcrypt => wolfssl-wolfcrypt/src}/ed25519.rs (94%) rename wrapper/rust/{wolfssl/src/wolfcrypt => wolfssl-wolfcrypt/src}/ed448.rs (94%) rename wrapper/rust/{wolfssl/src/wolfcrypt => wolfssl-wolfcrypt/src}/hkdf.rs (93%) rename wrapper/rust/{wolfssl/src/wolfcrypt => wolfssl-wolfcrypt/src}/hmac.rs (97%) rename wrapper/rust/{wolfssl/src/wolfcrypt => wolfssl-wolfcrypt/src}/kdf.rs (96%) rename wrapper/rust/{wolfssl/src/wolfcrypt.rs => wolfssl-wolfcrypt/src/lib.rs} (93%) rename wrapper/rust/{wolfssl/src/wolfcrypt => wolfssl-wolfcrypt/src}/prf.rs (98%) rename wrapper/rust/{wolfssl/src/wolfcrypt => wolfssl-wolfcrypt/src}/random.rs (98%) rename wrapper/rust/{wolfssl/src/wolfcrypt => wolfssl-wolfcrypt/src}/rsa.rs (96%) rename wrapper/rust/{wolfssl/src/wolfcrypt => wolfssl-wolfcrypt/src}/sha.rs (95%) rename wrapper/rust/{wolfssl => wolfssl-wolfcrypt}/src/sys.rs (100%) rename wrapper/rust/{wolfssl => wolfssl-wolfcrypt}/tests/test_aes.rs (99%) rename wrapper/rust/{wolfssl => wolfssl-wolfcrypt}/tests/test_cmac.rs (97%) rename wrapper/rust/{wolfssl => wolfssl-wolfcrypt}/tests/test_dh.rs (99%) rename wrapper/rust/{wolfssl => wolfssl-wolfcrypt}/tests/test_ecc.rs (99%) rename wrapper/rust/{wolfssl => wolfssl-wolfcrypt}/tests/test_ed25519.rs (99%) rename wrapper/rust/{wolfssl => wolfssl-wolfcrypt}/tests/test_ed448.rs (99%) rename wrapper/rust/{wolfssl => wolfssl-wolfcrypt}/tests/test_hkdf.rs (92%) rename wrapper/rust/{wolfssl => wolfssl-wolfcrypt}/tests/test_hmac.rs (97%) rename wrapper/rust/{wolfssl => wolfssl-wolfcrypt}/tests/test_kdf.rs (98%) rename wrapper/rust/{wolfssl => wolfssl-wolfcrypt}/tests/test_prf.rs (97%) rename wrapper/rust/{wolfssl => wolfssl-wolfcrypt}/tests/test_random.rs (98%) rename wrapper/rust/{wolfssl => wolfssl-wolfcrypt}/tests/test_rsa.rs (98%) rename wrapper/rust/{wolfssl => wolfssl-wolfcrypt}/tests/test_sha.rs (99%) rename wrapper/rust/{wolfssl => wolfssl-wolfcrypt}/tests/test_wolfcrypt.rs (88%) delete mode 100644 wrapper/rust/wolfssl/src/lib.rs diff --git a/wrapper/rust/Makefile b/wrapper/rust/Makefile index 0c0704230..73bd658e5 100644 --- a/wrapper/rust/Makefile +++ b/wrapper/rust/Makefile @@ -1,11 +1,11 @@ .PHONY: all all: - +$(MAKE) -C wolfssl + +$(MAKE) -C wolfssl-wolfcrypt .PHONY: test test: - +$(MAKE) -C wolfssl test + +$(MAKE) -C wolfssl-wolfcrypt test .PHONY: clean clean: - +$(MAKE) -C wolfssl clean + +$(MAKE) -C wolfssl-wolfcrypt clean diff --git a/wrapper/rust/README.md b/wrapper/rust/README.md index 682c714c6..297e87225 100644 --- a/wrapper/rust/README.md +++ b/wrapper/rust/README.md @@ -1,6 +1,17 @@ # wolfSSL Rust Wrapper -## Building the wolfssl Rust Wrapper +The wolfSSL Rust wrapper currently consists of a single Rust crate named +`wolfssl-wolfcrypt`. This crate provides wrappers for the cryptographic +algorithms supported by wolfCrypt in the wolfSSL library. + +The `wolfssl-wolfcrypt` crate is intended to be published to +[crates.io](https://crates.io/) and can be used by including it in your +project's `Cargo.toml` file. + +It can also be built locally from within the wolfssl C library repository to +test changes to the C library using the Rust API. + +## Locally building the wolfssl-wolfcrypt crate First, configure and build wolfssl C library. @@ -17,9 +28,8 @@ Run tests with: | Repository Directory | Description | | --- | --- | | `/wrapper/rust` | Top level container for all Rust wrapper functionality. | -| `/wrapper/rust/wolfssl` | Top level for the `wolfssl` library crate. | -| `/wrapper/rust/wolfssl/src` | Source directory for `wolfssl` crate top-level modules. | -| `/wrapper/rust/wolfssl/src/wolfcrypt` | Source directory for submodules of `wolfssl::wolfcrypt` module. | +| `/wrapper/rust/wolfssl-wolfcrypt` | Top level for the `wolfssl-wolfcrypt` library crate. | +| `/wrapper/rust/wolfssl-wolfcrypt/src` | Source directory for `wolfssl-wolfcrypt` crate top-level modules. | ## API Coverage diff --git a/wrapper/rust/include.am b/wrapper/rust/include.am index 77c7b5c42..fdba62f51 100644 --- a/wrapper/rust/include.am +++ b/wrapper/rust/include.am @@ -4,36 +4,36 @@ EXTRA_DIST += wrapper/rust/Makefile EXTRA_DIST += wrapper/rust/README.md -EXTRA_DIST += wrapper/rust/wolfssl/Cargo.lock -EXTRA_DIST += wrapper/rust/wolfssl/Cargo.toml -EXTRA_DIST += wrapper/rust/wolfssl/Makefile -EXTRA_DIST += wrapper/rust/wolfssl/build.rs -EXTRA_DIST += wrapper/rust/wolfssl/headers.h -EXTRA_DIST += wrapper/rust/wolfssl/src/lib.rs -EXTRA_DIST += wrapper/rust/wolfssl/src/wolfcrypt.rs -EXTRA_DIST += wrapper/rust/wolfssl/src/wolfcrypt/aes.rs -EXTRA_DIST += wrapper/rust/wolfssl/src/wolfcrypt/cmac.rs -EXTRA_DIST += wrapper/rust/wolfssl/src/wolfcrypt/dh.rs -EXTRA_DIST += wrapper/rust/wolfssl/src/wolfcrypt/ecc.rs -EXTRA_DIST += wrapper/rust/wolfssl/src/wolfcrypt/ed25519.rs -EXTRA_DIST += wrapper/rust/wolfssl/src/wolfcrypt/ed448.rs -EXTRA_DIST += wrapper/rust/wolfssl/src/wolfcrypt/hkdf.rs -EXTRA_DIST += wrapper/rust/wolfssl/src/wolfcrypt/hmac.rs -EXTRA_DIST += wrapper/rust/wolfssl/src/wolfcrypt/kdf.rs -EXTRA_DIST += wrapper/rust/wolfssl/src/wolfcrypt/prf.rs -EXTRA_DIST += wrapper/rust/wolfssl/src/wolfcrypt/random.rs -EXTRA_DIST += wrapper/rust/wolfssl/src/wolfcrypt/rsa.rs -EXTRA_DIST += wrapper/rust/wolfssl/src/wolfcrypt/sha.rs -EXTRA_DIST += wrapper/rust/wolfssl/tests/test_aes.rs -EXTRA_DIST += wrapper/rust/wolfssl/tests/test_cmac.rs -EXTRA_DIST += wrapper/rust/wolfssl/tests/test_dh.rs -EXTRA_DIST += wrapper/rust/wolfssl/tests/test_ecc.rs -EXTRA_DIST += wrapper/rust/wolfssl/tests/test_ed25519.rs -EXTRA_DIST += wrapper/rust/wolfssl/tests/test_ed448.rs -EXTRA_DIST += wrapper/rust/wolfssl/tests/test_hkdf.rs -EXTRA_DIST += wrapper/rust/wolfssl/tests/test_hmac.rs -EXTRA_DIST += wrapper/rust/wolfssl/tests/test_kdf.rs -EXTRA_DIST += wrapper/rust/wolfssl/tests/test_prf.rs -EXTRA_DIST += wrapper/rust/wolfssl/tests/test_random.rs -EXTRA_DIST += wrapper/rust/wolfssl/tests/test_rsa.rs -EXTRA_DIST += wrapper/rust/wolfssl/tests/test_sha.rs +EXTRA_DIST += wrapper/rust/wolfssl-wolfcrypt/Cargo.lock +EXTRA_DIST += wrapper/rust/wolfssl-wolfcrypt/Cargo.toml +EXTRA_DIST += wrapper/rust/wolfssl-wolfcrypt/Makefile +EXTRA_DIST += wrapper/rust/wolfssl-wolfcrypt/build.rs +EXTRA_DIST += wrapper/rust/wolfssl-wolfcrypt/headers.h +EXTRA_DIST += wrapper/rust/wolfssl-wolfcrypt/src/lib.rs +EXTRA_DIST += wrapper/rust/wolfssl-wolfcrypt/src/wolfcrypt.rs +EXTRA_DIST += wrapper/rust/wolfssl-wolfcrypt/src/wolfcrypt/aes.rs +EXTRA_DIST += wrapper/rust/wolfssl-wolfcrypt/src/wolfcrypt/cmac.rs +EXTRA_DIST += wrapper/rust/wolfssl-wolfcrypt/src/wolfcrypt/dh.rs +EXTRA_DIST += wrapper/rust/wolfssl-wolfcrypt/src/wolfcrypt/ecc.rs +EXTRA_DIST += wrapper/rust/wolfssl-wolfcrypt/src/wolfcrypt/ed25519.rs +EXTRA_DIST += wrapper/rust/wolfssl-wolfcrypt/src/wolfcrypt/ed448.rs +EXTRA_DIST += wrapper/rust/wolfssl-wolfcrypt/src/wolfcrypt/hkdf.rs +EXTRA_DIST += wrapper/rust/wolfssl-wolfcrypt/src/wolfcrypt/hmac.rs +EXTRA_DIST += wrapper/rust/wolfssl-wolfcrypt/src/wolfcrypt/kdf.rs +EXTRA_DIST += wrapper/rust/wolfssl-wolfcrypt/src/wolfcrypt/prf.rs +EXTRA_DIST += wrapper/rust/wolfssl-wolfcrypt/src/wolfcrypt/random.rs +EXTRA_DIST += wrapper/rust/wolfssl-wolfcrypt/src/wolfcrypt/rsa.rs +EXTRA_DIST += wrapper/rust/wolfssl-wolfcrypt/src/wolfcrypt/sha.rs +EXTRA_DIST += wrapper/rust/wolfssl-wolfcrypt/tests/test_aes.rs +EXTRA_DIST += wrapper/rust/wolfssl-wolfcrypt/tests/test_cmac.rs +EXTRA_DIST += wrapper/rust/wolfssl-wolfcrypt/tests/test_dh.rs +EXTRA_DIST += wrapper/rust/wolfssl-wolfcrypt/tests/test_ecc.rs +EXTRA_DIST += wrapper/rust/wolfssl-wolfcrypt/tests/test_ed25519.rs +EXTRA_DIST += wrapper/rust/wolfssl-wolfcrypt/tests/test_ed448.rs +EXTRA_DIST += wrapper/rust/wolfssl-wolfcrypt/tests/test_hkdf.rs +EXTRA_DIST += wrapper/rust/wolfssl-wolfcrypt/tests/test_hmac.rs +EXTRA_DIST += wrapper/rust/wolfssl-wolfcrypt/tests/test_kdf.rs +EXTRA_DIST += wrapper/rust/wolfssl-wolfcrypt/tests/test_prf.rs +EXTRA_DIST += wrapper/rust/wolfssl-wolfcrypt/tests/test_random.rs +EXTRA_DIST += wrapper/rust/wolfssl-wolfcrypt/tests/test_rsa.rs +EXTRA_DIST += wrapper/rust/wolfssl-wolfcrypt/tests/test_sha.rs diff --git a/wrapper/rust/wolfssl/Cargo.lock b/wrapper/rust/wolfssl-wolfcrypt/Cargo.lock similarity index 99% rename from wrapper/rust/wolfssl/Cargo.lock rename to wrapper/rust/wolfssl-wolfcrypt/Cargo.lock index 603e91f1d..6ac43f158 100644 --- a/wrapper/rust/wolfssl/Cargo.lock +++ b/wrapper/rust/wolfssl-wolfcrypt/Cargo.lock @@ -286,7 +286,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "271414315aff87387382ec3d271b52d7ae78726f5d44ac98b4f4030c91880486" [[package]] -name = "wolfssl" +name = "wolfssl-wolfcrypt" version = "0.1.0" dependencies = [ "bindgen", diff --git a/wrapper/rust/wolfssl/Cargo.toml b/wrapper/rust/wolfssl-wolfcrypt/Cargo.toml similarity index 82% rename from wrapper/rust/wolfssl/Cargo.toml rename to wrapper/rust/wolfssl-wolfcrypt/Cargo.toml index 2dc30eaae..027b3f848 100644 --- a/wrapper/rust/wolfssl/Cargo.toml +++ b/wrapper/rust/wolfssl-wolfcrypt/Cargo.toml @@ -1,8 +1,8 @@ [package] -name = "wolfssl" +name = "wolfssl-wolfcrypt" version = "0.1.0" edition = "2024" -description = "Rust wrapper for wolfssl C library" +description = "Rust wrapper for wolfssl C library cryptographic functionality" license = "GPL-3.0" repository = "https://github.com/wolfSSL/wolfssl" documentation = "https://github.com/wolfSSL/wolfssl/tree/master/wrapper/rust" diff --git a/wrapper/rust/wolfssl/Makefile b/wrapper/rust/wolfssl-wolfcrypt/Makefile similarity index 100% rename from wrapper/rust/wolfssl/Makefile rename to wrapper/rust/wolfssl-wolfcrypt/Makefile diff --git a/wrapper/rust/wolfssl/build.rs b/wrapper/rust/wolfssl-wolfcrypt/build.rs similarity index 100% rename from wrapper/rust/wolfssl/build.rs rename to wrapper/rust/wolfssl-wolfcrypt/build.rs diff --git a/wrapper/rust/wolfssl/headers.h b/wrapper/rust/wolfssl-wolfcrypt/headers.h similarity index 100% rename from wrapper/rust/wolfssl/headers.h rename to wrapper/rust/wolfssl-wolfcrypt/headers.h diff --git a/wrapper/rust/wolfssl/src/wolfcrypt/aes.rs b/wrapper/rust/wolfssl-wolfcrypt/src/aes.rs similarity index 99% rename from wrapper/rust/wolfssl/src/wolfcrypt/aes.rs rename to wrapper/rust/wolfssl-wolfcrypt/src/aes.rs index 168b1c88b..10d2755a3 100644 --- a/wrapper/rust/wolfssl/src/wolfcrypt/aes.rs +++ b/wrapper/rust/wolfssl-wolfcrypt/src/aes.rs @@ -34,7 +34,7 @@ use std::mem::{size_of_val, MaybeUninit}; /// ```rust /// #[cfg(aes_cbc)] /// { -/// use wolfssl::wolfcrypt::aes::CBC; +/// use wolfssl_wolfcrypt::aes::CBC; /// let mut cbc = CBC::new().expect("Failed to create CBC"); /// let key: &[u8; 16] = b"0123456789abcdef"; /// let iv: &[u8; 16] = b"1234567890abcdef"; @@ -220,7 +220,7 @@ impl Drop for CBC { /// ```rust /// #[cfg(aes_ccm)] /// { -/// use wolfssl::wolfcrypt::aes::CCM; +/// use wolfssl_wolfcrypt::aes::CCM; /// let key: [u8; 16] = [ /// 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /// 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf @@ -415,7 +415,7 @@ impl Drop for CCM { /// ```rust /// #[cfg(aes_cfb)] /// { -/// use wolfssl::wolfcrypt::aes::CFB; +/// use wolfssl_wolfcrypt::aes::CFB; /// let mut cfb = CFB::new().expect("Failed to create CFB"); /// let key: [u8; 16] = [ /// 0x2b,0x7e,0x15,0x16,0x28,0xae,0xd2,0xa6, @@ -722,7 +722,7 @@ impl Drop for CFB { /// ```rust /// #[cfg(aes_ctr)] /// { -/// use wolfssl::wolfcrypt::aes::CTR; +/// use wolfssl_wolfcrypt::aes::CTR; /// let iv: [u8; 16] = [ /// 0xf0,0xf1,0xf2,0xf3,0xf4,0xf5,0xf6,0xf7, /// 0xf8,0xf9,0xfa,0xfb,0xfc,0xfd,0xfe,0xff @@ -892,7 +892,7 @@ impl Drop for CTR { /// ```rust /// #[cfg(aes_eax)] /// { -/// use wolfssl::wolfcrypt::aes::EAX; +/// use wolfssl_wolfcrypt::aes::EAX; /// let key: [u8; 16] = [ /// 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /// 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f @@ -1022,7 +1022,7 @@ impl EAX { /// ```rust /// #[cfg(aes_ecb)] /// { -/// use wolfssl::wolfcrypt::aes::ECB; +/// use wolfssl_wolfcrypt::aes::ECB; /// let mut ecb = ECB::new().expect("Failed to create ECB"); /// let key_128: &[u8; 16] = b"0123456789abcdef"; /// let msg: [u8; 16] = [ @@ -1203,7 +1203,7 @@ impl Drop for ECB { /// ```rust /// #[cfg(aes_gcm)] /// { -/// use wolfssl::wolfcrypt::aes::GCM; +/// use wolfssl_wolfcrypt::aes::GCM; /// let key: [u8; 16] = [ /// 0x29, 0x8e, 0xfa, 0x1c, 0xcf, 0x29, 0xcf, 0x62, /// 0xae, 0x68, 0x24, 0xbf, 0xc1, 0x95, 0x57, 0xfc @@ -1398,7 +1398,7 @@ impl Drop for GCM { /// ```rust /// #[cfg(aes_gcm_stream)] /// { -/// use wolfssl::wolfcrypt::aes::GCMStream; +/// use wolfssl_wolfcrypt::aes::GCMStream; /// let plain: [u8; 60] = [ /// 0xd9, 0x31, 0x32, 0x25, 0xf8, 0x84, 0x06, 0xe5, /// 0xa5, 0x59, 0x09, 0xc5, 0xaf, 0xf5, 0x26, 0x9a, @@ -1678,7 +1678,7 @@ impl Drop for GCMStream { /// ```rust /// #[cfg(aes_ofb)] /// { -/// use wolfssl::wolfcrypt::aes::OFB; +/// use wolfssl_wolfcrypt::aes::OFB; /// let key: [u8; 32] = [ /// 0xc4,0xc7,0xfa,0xd6,0x53,0x5c,0xb8,0x71, /// 0x4a,0x5c,0x40,0x77,0x9a,0x8b,0xa1,0xd2, @@ -1863,7 +1863,7 @@ impl Drop for OFB { /// ```rust /// #[cfg(aes_xts)] /// { -/// use wolfssl::wolfcrypt::aes::XTS; +/// use wolfssl_wolfcrypt::aes::XTS; /// let key: [u8; 32] = [ /// 0xa1, 0xb9, 0x0c, 0xba, 0x3f, 0x06, 0xac, 0x35, /// 0x3b, 0x2c, 0x34, 0x38, 0x76, 0x08, 0x17, 0x62, @@ -2234,7 +2234,7 @@ impl Drop for XTS { /// ```rust /// #[cfg(aes_xts_stream)] /// { -/// use wolfssl::wolfcrypt::aes::XTSStream; +/// use wolfssl_wolfcrypt::aes::XTSStream; /// let keys: [u8; 32] = [ /// 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, /// 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, diff --git a/wrapper/rust/wolfssl/src/wolfcrypt/cmac.rs b/wrapper/rust/wolfssl-wolfcrypt/src/cmac.rs similarity index 97% rename from wrapper/rust/wolfssl/src/wolfcrypt/cmac.rs rename to wrapper/rust/wolfssl-wolfcrypt/src/cmac.rs index fbb722176..833e9debe 100644 --- a/wrapper/rust/wolfssl/src/wolfcrypt/cmac.rs +++ b/wrapper/rust/wolfssl-wolfcrypt/src/cmac.rs @@ -55,7 +55,7 @@ impl CMAC { /// ```rust /// #[cfg(aes)] /// { - /// use wolfssl::wolfcrypt::cmac::CMAC; + /// use wolfssl_wolfcrypt::cmac::CMAC; /// let key = [ /// 0x2bu8, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6, /// 0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c @@ -98,7 +98,7 @@ impl CMAC { /// # Example /// /// ```rust - /// use wolfssl::wolfcrypt::cmac::CMAC; + /// use wolfssl_wolfcrypt::cmac::CMAC; /// let key = [ /// 0x2bu8, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6, /// 0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c @@ -126,7 +126,7 @@ impl CMAC { /// # Example /// /// ```rust - /// use wolfssl::wolfcrypt::cmac::CMAC; + /// use wolfssl_wolfcrypt::cmac::CMAC; /// let key = [ /// 0x2bu8, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6, /// 0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c @@ -176,7 +176,7 @@ impl CMAC { /// ```rust /// #[cfg(aes)] /// { - /// use wolfssl::wolfcrypt::cmac::CMAC; + /// use wolfssl_wolfcrypt::cmac::CMAC; /// let key = [ /// 0x2bu8, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6, /// 0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c @@ -227,7 +227,7 @@ impl CMAC { /// ```rust /// #[cfg(aes)] /// { - /// use wolfssl::wolfcrypt::cmac::CMAC; + /// use wolfssl_wolfcrypt::cmac::CMAC; /// let key = [ /// 0x2bu8, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6, /// 0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c @@ -280,7 +280,7 @@ impl CMAC { /// # Example /// /// ```rust - /// use wolfssl::wolfcrypt::cmac::CMAC; + /// use wolfssl_wolfcrypt::cmac::CMAC; /// let key = [ /// 0x2bu8, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6, /// 0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c @@ -320,7 +320,7 @@ impl CMAC { /// # Example /// /// ```rust - /// use wolfssl::wolfcrypt::cmac::CMAC; + /// use wolfssl_wolfcrypt::cmac::CMAC; /// let key = [ /// 0x2bu8, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6, /// 0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c @@ -367,7 +367,7 @@ impl CMAC { /// ```rust /// #[cfg(aes)] /// { - /// use wolfssl::wolfcrypt::cmac::CMAC; + /// use wolfssl_wolfcrypt::cmac::CMAC; /// let key = [ /// 0x2bu8, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6, /// 0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c diff --git a/wrapper/rust/wolfssl/src/wolfcrypt/dh.rs b/wrapper/rust/wolfssl-wolfcrypt/src/dh.rs similarity index 97% rename from wrapper/rust/wolfssl/src/wolfcrypt/dh.rs rename to wrapper/rust/wolfssl-wolfcrypt/src/dh.rs index 0e0137ac0..81b536208 100644 --- a/wrapper/rust/wolfssl/src/wolfcrypt/dh.rs +++ b/wrapper/rust/wolfssl-wolfcrypt/src/dh.rs @@ -30,7 +30,7 @@ wolfSSL `DhKey` object. It ensures proper initialization and deallocation. use crate::sys; #[cfg(random)] -use crate::wolfcrypt::random::RNG; +use crate::random::RNG; use std::mem::{MaybeUninit}; pub struct DH { @@ -76,8 +76,8 @@ impl DH { /// ```rust /// #[cfg(all(dh_ffdhe_2048, random))] /// { - /// use wolfssl::wolfcrypt::random::RNG; - /// use wolfssl::wolfcrypt::dh::DH; + /// use wolfssl_wolfcrypt::random::RNG; + /// use wolfssl_wolfcrypt::dh::DH; /// let mut rng = RNG::new().expect("Failed to create RNG"); /// let mut dh = DH::new_named(DH::FFDHE_2048).expect("Error with new_named()"); /// let mut private = [0u8; 256]; @@ -128,8 +128,8 @@ impl DH { /// ```rust /// #[cfg(all(dh_ffdhe_2048, random))] /// { - /// use wolfssl::wolfcrypt::random::RNG; - /// use wolfssl::wolfcrypt::dh::DH; + /// use wolfssl_wolfcrypt::random::RNG; + /// use wolfssl_wolfcrypt::dh::DH; /// let mut dh = DH::new_named(DH::FFDHE_2048).expect("Error with new_named()"); /// let mut p = [0u8; 256]; /// let mut q = [0u8; 256]; @@ -180,8 +180,8 @@ impl DH { /// ```rust /// #[cfg(all(dh_keygen, random))] /// { - /// use wolfssl::wolfcrypt::random::RNG; - /// use wolfssl::wolfcrypt::dh::DH; + /// use wolfssl_wolfcrypt::random::RNG; + /// use wolfssl_wolfcrypt::dh::DH; /// let mut rng = RNG::new().expect("Error with RNG::new()"); /// let mut dh = DH::generate(&mut rng, 2048).expect("Error with generate()"); /// } @@ -211,8 +211,8 @@ impl DH { /// ```rust /// #[cfg(all(dh_keygen, random))] /// { - /// use wolfssl::wolfcrypt::random::RNG; - /// use wolfssl::wolfcrypt::dh::DH; + /// use wolfssl_wolfcrypt::random::RNG; + /// use wolfssl_wolfcrypt::dh::DH; /// let mut rng = RNG::new().expect("Error with RNG::new()"); /// let mut dh = DH::generate_ex(&mut rng, 2048, None, None).expect("Error with generate_ex()"); /// } @@ -258,8 +258,8 @@ impl DH { /// ```rust /// #[cfg(all(dh_ffdhe_2048, random))] /// { - /// use wolfssl::wolfcrypt::random::RNG; - /// use wolfssl::wolfcrypt::dh::DH; + /// use wolfssl_wolfcrypt::random::RNG; + /// use wolfssl_wolfcrypt::dh::DH; /// let min_key_size = DH::get_min_key_size_for_named_parameters(DH::FFDHE_2048); /// assert_eq!(min_key_size, 29); /// } @@ -282,8 +282,8 @@ impl DH { /// ```rust /// #[cfg(all(dh_ffdhe_2048, random))] /// { - /// use wolfssl::wolfcrypt::random::RNG; - /// use wolfssl::wolfcrypt::dh::DH; + /// use wolfssl_wolfcrypt::random::RNG; + /// use wolfssl_wolfcrypt::dh::DH; /// let mut p_size = 0u32; /// let mut g_size = 0u32; /// let mut q_size = 0u32; @@ -312,8 +312,8 @@ impl DH { /// ```rust /// #[cfg(all(dh_ffdhe_2048, random))] /// { - /// use wolfssl::wolfcrypt::random::RNG; - /// use wolfssl::wolfcrypt::dh::DH; + /// use wolfssl_wolfcrypt::random::RNG; + /// use wolfssl_wolfcrypt::dh::DH; /// let mut dh = DH::new_named(DH::FFDHE_2048).expect("Error with new_named()"); /// } /// ``` @@ -340,8 +340,8 @@ impl DH { /// ```rust /// #[cfg(all(dh_ffdhe_2048, random))] /// { - /// use wolfssl::wolfcrypt::random::RNG; - /// use wolfssl::wolfcrypt::dh::DH; + /// use wolfssl_wolfcrypt::random::RNG; + /// use wolfssl_wolfcrypt::dh::DH; /// let mut dh = DH::new_named_ex(DH::FFDHE_2048, None, None).expect("Error with new_named_ex()"); /// } /// ``` @@ -385,8 +385,8 @@ impl DH { /// ```rust /// #[cfg(random)] /// { - /// use wolfssl::wolfcrypt::random::RNG; - /// use wolfssl::wolfcrypt::dh::DH; + /// use wolfssl_wolfcrypt::random::RNG; + /// use wolfssl_wolfcrypt::dh::DH; /// let p = [ /// 0xc5u8, 0x7c, 0xa2, 0x4f, 0x4b, 0xd6, 0x8c, 0x3c, /// 0xda, 0xc7, 0xba, 0xaa, 0xea, 0x2e, 0x5c, 0x1e, @@ -482,8 +482,8 @@ impl DH { /// ```rust /// #[cfg(random)] /// { - /// use wolfssl::wolfcrypt::random::RNG; - /// use wolfssl::wolfcrypt::dh::DH; + /// use wolfssl_wolfcrypt::random::RNG; + /// use wolfssl_wolfcrypt::dh::DH; /// let p = [ /// 0xc5u8, 0x7c, 0xa2, 0x4f, 0x4b, 0xd6, 0x8c, 0x3c, /// 0xda, 0xc7, 0xba, 0xaa, 0xea, 0x2e, 0x5c, 0x1e, @@ -600,8 +600,8 @@ impl DH { /// ```rust /// #[cfg(random)] /// { - /// use wolfssl::wolfcrypt::random::RNG; - /// use wolfssl::wolfcrypt::dh::DH; + /// use wolfssl_wolfcrypt::random::RNG; + /// use wolfssl_wolfcrypt::dh::DH; /// let p = [ /// 0xc5u8, 0x7c, 0xa2, 0x4f, 0x4b, 0xd6, 0x8c, 0x3c, /// 0xda, 0xc7, 0xba, 0xaa, 0xea, 0x2e, 0x5c, 0x1e, @@ -704,8 +704,8 @@ impl DH { /// ```rust /// #[cfg(random)] /// { - /// use wolfssl::wolfcrypt::random::RNG; - /// use wolfssl::wolfcrypt::dh::DH; + /// use wolfssl_wolfcrypt::random::RNG; + /// use wolfssl_wolfcrypt::dh::DH; /// let p = [ /// 0xc5u8, 0x7c, 0xa2, 0x4f, 0x4b, 0xd6, 0x8c, 0x3c, /// 0xda, 0xc7, 0xba, 0xaa, 0xea, 0x2e, 0x5c, 0x1e, @@ -833,8 +833,8 @@ impl DH { /// ```rust /// #[cfg(random)] /// { - /// use wolfssl::wolfcrypt::random::RNG; - /// use wolfssl::wolfcrypt::dh::DH; + /// use wolfssl_wolfcrypt::random::RNG; + /// use wolfssl_wolfcrypt::dh::DH; /// let p = [ /// 0xc5u8, 0x7c, 0xa2, 0x4f, 0x4b, 0xd6, 0x8c, 0x3c, /// 0xda, 0xc7, 0xba, 0xaa, 0xea, 0x2e, 0x5c, 0x1e, @@ -942,8 +942,8 @@ impl DH { /// ```rust /// #[cfg(random)] /// { - /// use wolfssl::wolfcrypt::random::RNG; - /// use wolfssl::wolfcrypt::dh::DH; + /// use wolfssl_wolfcrypt::random::RNG; + /// use wolfssl_wolfcrypt::dh::DH; /// let p = [ /// 0xc5u8, 0x7c, 0xa2, 0x4f, 0x4b, 0xd6, 0x8c, 0x3c, /// 0xda, 0xc7, 0xba, 0xaa, 0xea, 0x2e, 0x5c, 0x1e, @@ -1069,8 +1069,8 @@ impl DH { /// ```rust /// #[cfg(all(dh_ffdhe_2048, random))] /// { - /// use wolfssl::wolfcrypt::random::RNG; - /// use wolfssl::wolfcrypt::dh::DH; + /// use wolfssl_wolfcrypt::random::RNG; + /// use wolfssl_wolfcrypt::dh::DH; /// let mut rng = RNG::new().expect("Error with RNG::new()"); /// let mut dh = DH::new_named(DH::FFDHE_2048).expect("Error with new_named()"); /// let mut private = [0u8; 256]; @@ -1115,8 +1115,8 @@ impl DH { /// ```rust /// #[cfg(all(dh_ffdhe_2048, random))] /// { - /// use wolfssl::wolfcrypt::random::RNG; - /// use wolfssl::wolfcrypt::dh::DH; + /// use wolfssl_wolfcrypt::random::RNG; + /// use wolfssl_wolfcrypt::dh::DH; /// let mut rng = RNG::new().expect("Error with RNG::new()"); /// let mut dh = DH::new_named(DH::FFDHE_2048).expect("Error with new_named()"); /// let mut private = [0u8; 256]; @@ -1161,8 +1161,8 @@ impl DH { /// ```rust /// #[cfg(random)] /// { - /// use wolfssl::wolfcrypt::random::RNG; - /// use wolfssl::wolfcrypt::dh::DH; + /// use wolfssl_wolfcrypt::random::RNG; + /// use wolfssl_wolfcrypt::dh::DH; /// let p = [ /// 0xc5u8, 0x7c, 0xa2, 0x4f, 0x4b, 0xd6, 0x8c, 0x3c, /// 0xda, 0xc7, 0xba, 0xaa, 0xea, 0x2e, 0x5c, 0x1e, @@ -1285,8 +1285,8 @@ impl DH { /// ```rust /// #[cfg(all(dh_ffdhe_2048, random))] /// { - /// use wolfssl::wolfcrypt::random::RNG; - /// use wolfssl::wolfcrypt::dh::DH; + /// use wolfssl_wolfcrypt::random::RNG; + /// use wolfssl_wolfcrypt::dh::DH; /// let mut rng = RNG::new().expect("Error with RNG::new()"); /// let mut dh = DH::new_named(DH::FFDHE_2048).expect("Error with new_named()"); /// let mut private = [0u8; 256]; @@ -1328,8 +1328,8 @@ impl DH { /// ```rust /// #[cfg(random)] /// { - /// use wolfssl::wolfcrypt::random::RNG; - /// use wolfssl::wolfcrypt::dh::DH; + /// use wolfssl_wolfcrypt::random::RNG; + /// use wolfssl_wolfcrypt::dh::DH; /// let p = [ /// 0xc5u8, 0x7c, 0xa2, 0x4f, 0x4b, 0xd6, 0x8c, 0x3c, /// 0xda, 0xc7, 0xba, 0xaa, 0xea, 0x2e, 0x5c, 0x1e, @@ -1490,8 +1490,8 @@ impl DH { /// ```rust /// #[cfg(all(dh_ffdhe_2048, random))] /// { - /// use wolfssl::wolfcrypt::random::RNG; - /// use wolfssl::wolfcrypt::dh::DH; + /// use wolfssl_wolfcrypt::random::RNG; + /// use wolfssl_wolfcrypt::dh::DH; /// let mut rng = RNG::new().expect("Failed to create RNG"); /// let mut dh = DH::new_named(DH::FFDHE_2048).expect("Error with new_named()"); /// let mut private = [0u8; 256]; @@ -1536,8 +1536,8 @@ impl DH { /// ```rust /// #[cfg(all(dh_ffdhe_2048, random))] /// { - /// use wolfssl::wolfcrypt::random::RNG; - /// use wolfssl::wolfcrypt::dh::DH; + /// use wolfssl_wolfcrypt::random::RNG; + /// use wolfssl_wolfcrypt::dh::DH; /// let mut rng = RNG::new().expect("Error with RNG::new()"); /// let mut dh = DH::new_named(DH::FFDHE_2048).expect("Error with new_named()"); /// let mut private0 = [0u8; 256]; diff --git a/wrapper/rust/wolfssl/src/wolfcrypt/ecc.rs b/wrapper/rust/wolfssl-wolfcrypt/src/ecc.rs similarity index 95% rename from wrapper/rust/wolfssl/src/wolfcrypt/ecc.rs rename to wrapper/rust/wolfssl-wolfcrypt/src/ecc.rs index dfb5c0a09..a37cd2383 100644 --- a/wrapper/rust/wolfssl/src/wolfcrypt/ecc.rs +++ b/wrapper/rust/wolfssl-wolfcrypt/src/ecc.rs @@ -30,7 +30,7 @@ wolfSSL `ecc_key` object. It ensures proper initialization and deallocation. use crate::sys; #[cfg(random)] -use crate::wolfcrypt::random::RNG; +use crate::random::RNG; use std::mem::{MaybeUninit}; /// Rust wrapper for wolfSSL `ecc_point` object. @@ -58,8 +58,8 @@ impl ECCPoint { /// ```rust /// #[cfg(all(ecc_import, random))] /// { - /// use wolfssl::wolfcrypt::random::RNG; - /// use wolfssl::wolfcrypt::ecc::{ECC,ECCPoint}; + /// use wolfssl_wolfcrypt::random::RNG; + /// use wolfssl_wolfcrypt::ecc::{ECC,ECCPoint}; /// let mut rng = RNG::new().expect("Failed to create RNG"); /// let curve_id = ECC::SECP256R1; /// let curve_size = ECC::get_curve_size_from_id(curve_id).expect("Error with get_curve_size_from_id()"); @@ -116,8 +116,8 @@ impl ECCPoint { /// ```rust /// #[cfg(all(ecc_import, ecc_export, ecc_comp_key, random))] /// { - /// use wolfssl::wolfcrypt::random::RNG; - /// use wolfssl::wolfcrypt::ecc::{ECC,ECCPoint}; + /// use wolfssl_wolfcrypt::random::RNG; + /// use wolfssl_wolfcrypt::ecc::{ECC,ECCPoint}; /// let mut rng = RNG::new().expect("Failed to create RNG"); /// let curve_id = ECC::SECP256R1; /// let curve_size = ECC::get_curve_size_from_id(curve_id).expect("Error with get_curve_size_from_id()"); @@ -171,8 +171,8 @@ impl ECCPoint { /// ```rust /// #[cfg(all(ecc_export, random))] /// { - /// use wolfssl::wolfcrypt::random::RNG; - /// use wolfssl::wolfcrypt::ecc::{ECC,ECCPoint}; + /// use wolfssl_wolfcrypt::random::RNG; + /// use wolfssl_wolfcrypt::ecc::{ECC,ECCPoint}; /// let mut rng = RNG::new().expect("Failed to create RNG"); /// let curve_id = ECC::SECP256R1; /// let curve_size = ECC::get_curve_size_from_id(curve_id).expect("Error with get_curve_size_from_id()"); @@ -218,8 +218,8 @@ impl ECCPoint { /// ```rust /// #[cfg(all(ecc_export, ecc_comp_key, random))] /// { - /// use wolfssl::wolfcrypt::random::RNG; - /// use wolfssl::wolfcrypt::ecc::{ECC,ECCPoint}; + /// use wolfssl_wolfcrypt::random::RNG; + /// use wolfssl_wolfcrypt::ecc::{ECC,ECCPoint}; /// let mut rng = RNG::new().expect("Failed to create RNG"); /// let curve_id = ECC::SECP256R1; /// let curve_size = ECC::get_curve_size_from_id(curve_id).expect("Error with get_curve_size_from_id()"); @@ -253,8 +253,8 @@ impl ECCPoint { /// ```rust /// #[cfg(random)] /// { - /// use wolfssl::wolfcrypt::random::RNG; - /// use wolfssl::wolfcrypt::ecc::ECC; + /// use wolfssl_wolfcrypt::random::RNG; + /// use wolfssl_wolfcrypt::ecc::ECC; /// let mut rng = RNG::new().expect("Failed to create RNG"); /// let mut ecc = ECC::generate(32, &mut rng, None, None).expect("Error with generate()"); /// let mut ecc_point = ecc.make_pub_to_point(Some(&mut rng), None).expect("Error with make_pub_to_point()"); @@ -355,8 +355,8 @@ impl ECC { /// ```rust /// #[cfg(random)] /// { - /// use wolfssl::wolfcrypt::random::RNG; - /// use wolfssl::wolfcrypt::ecc::ECC; + /// use wolfssl_wolfcrypt::random::RNG; + /// use wolfssl_wolfcrypt::ecc::ECC; /// let mut rng = RNG::new().expect("Failed to create RNG"); /// let mut ecc = ECC::generate(32, &mut rng, None, None).expect("Error with generate()"); /// ecc.check().expect("Error with check()"); @@ -410,8 +410,8 @@ impl ECC { /// ```rust /// #[cfg(random)] /// { - /// use wolfssl::wolfcrypt::random::RNG; - /// use wolfssl::wolfcrypt::ecc::ECC; + /// use wolfssl_wolfcrypt::random::RNG; + /// use wolfssl_wolfcrypt::ecc::ECC; /// let mut rng = RNG::new().expect("Failed to create RNG"); /// let curve_id = ECC::SECP256R1; /// let curve_size = ECC::get_curve_size_from_id(curve_id).expect("Error with get_curve_size_from_id()"); @@ -468,8 +468,8 @@ impl ECC { /// ```rust /// #[cfg(random)] /// { - /// use wolfssl::wolfcrypt::random::RNG; - /// use wolfssl::wolfcrypt::ecc::ECC; + /// use wolfssl_wolfcrypt::random::RNG; + /// use wolfssl_wolfcrypt::ecc::ECC; /// let mut rng = RNG::new().expect("Failed to create RNG"); /// let curve_id = ECC::SECP256R1; /// let curve_size = ECC::get_curve_size_from_id(curve_id).expect("Error with get_curve_size_from_id()"); @@ -520,8 +520,8 @@ impl ECC { /// ```rust /// #[cfg(random)] /// { - /// use wolfssl::wolfcrypt::random::RNG; - /// use wolfssl::wolfcrypt::ecc::ECC; + /// use wolfssl_wolfcrypt::random::RNG; + /// use wolfssl_wolfcrypt::ecc::ECC; /// let mut rng = RNG::new().expect("Failed to create RNG"); /// let curve_id = ECC::SECP256R1; /// let curve_size = ECC::get_curve_size_from_id(curve_id).expect("Error with get_curve_size_from_id()"); @@ -555,8 +555,8 @@ impl ECC { /// ```rust /// #[cfg(random)] /// { - /// use wolfssl::wolfcrypt::random::RNG; - /// use wolfssl::wolfcrypt::ecc::ECC; + /// use wolfssl_wolfcrypt::random::RNG; + /// use wolfssl_wolfcrypt::ecc::ECC; /// use std::fs; /// let mut rng = RNG::new().expect("Failed to create RNG"); /// let key_path = "../../../certs/ecc-client-key.der"; @@ -609,8 +609,8 @@ impl ECC { /// ```rust /// #[cfg(random)] /// { - /// use wolfssl::wolfcrypt::random::RNG; - /// use wolfssl::wolfcrypt::ecc::ECC; + /// use wolfssl_wolfcrypt::random::RNG; + /// use wolfssl_wolfcrypt::ecc::ECC; /// use std::fs; /// let mut rng = RNG::new().expect("Failed to create RNG"); /// let key_path = "../../../certs/ecc-client-key.der"; @@ -676,8 +676,8 @@ impl ECC { /// ```rust /// #[cfg(all(ecc_import, random))] /// { - /// use wolfssl::wolfcrypt::random::RNG; - /// use wolfssl::wolfcrypt::ecc::ECC; + /// use wolfssl_wolfcrypt::random::RNG; + /// use wolfssl_wolfcrypt::ecc::ECC; /// let mut rng = RNG::new().expect("Failed to create RNG"); /// let mut ecc = ECC::generate(32, &mut rng, None, None).expect("Error with generate()"); /// let hash = [0x42u8; 32]; @@ -747,8 +747,8 @@ impl ECC { /// ```rust /// #[cfg(all(ecc_import, random))] /// { - /// use wolfssl::wolfcrypt::random::RNG; - /// use wolfssl::wolfcrypt::ecc::ECC; + /// use wolfssl_wolfcrypt::random::RNG; + /// use wolfssl_wolfcrypt::ecc::ECC; /// let mut rng = RNG::new().expect("Failed to create RNG"); /// let curve_id = ECC::SECP256R1; /// let curve_size = ECC::get_curve_size_from_id(curve_id).expect("Error with get_curve_size_from_id()"); @@ -818,7 +818,7 @@ impl ECC { /// ```rust /// #[cfg(ecc_import)] /// { - /// use wolfssl::wolfcrypt::ecc::ECC; + /// use wolfssl_wolfcrypt::ecc::ECC; /// let qx = b"7a4e287890a1a47ad3457e52f2f76a83ce46cbc947616d0cbaa82323818a793d\0"; /// let qy = b"eec4084f5b29ebf29c44cce3b3059610922f8b30ea6e8811742ac7238fe87308\0"; /// let d = b"8c14b793cb19137e323a6d2e2a870bca2e7a493ec1153b3a95feb8a4873f8d08\0"; @@ -878,7 +878,7 @@ impl ECC { /// ```rust /// #[cfg(ecc_import)] /// { - /// use wolfssl::wolfcrypt::ecc::ECC; + /// use wolfssl_wolfcrypt::ecc::ECC; /// let qx = b"7a4e287890a1a47ad3457e52f2f76a83ce46cbc947616d0cbaa82323818a793d\0"; /// let qy = b"eec4084f5b29ebf29c44cce3b3059610922f8b30ea6e8811742ac7238fe87308\0"; /// let d = b"8c14b793cb19137e323a6d2e2a870bca2e7a493ec1153b3a95feb8a4873f8d08\0"; @@ -937,8 +937,8 @@ impl ECC { /// ```rust /// #[cfg(all(ecc_import, random))] /// { - /// use wolfssl::wolfcrypt::random::RNG; - /// use wolfssl::wolfcrypt::ecc::ECC; + /// use wolfssl_wolfcrypt::random::RNG; + /// use wolfssl_wolfcrypt::ecc::ECC; /// let mut rng = RNG::new().expect("Failed to create RNG"); /// let curve_id = ECC::SECP256R1; /// let curve_size = ECC::get_curve_size_from_id(curve_id).expect("Error with get_curve_size_from_id()"); @@ -1001,8 +1001,8 @@ impl ECC { /// ```rust /// #[cfg(all(ecc_import, random))] /// { - /// use wolfssl::wolfcrypt::random::RNG; - /// use wolfssl::wolfcrypt::ecc::ECC; + /// use wolfssl_wolfcrypt::random::RNG; + /// use wolfssl_wolfcrypt::ecc::ECC; /// let mut rng = RNG::new().expect("Failed to create RNG"); /// let mut ecc = ECC::generate(32, &mut rng, None, None).expect("Error with generate()"); /// let mut x963 = [0u8; 128]; @@ -1063,8 +1063,8 @@ impl ECC { /// ```rust /// #[cfg(all(ecc_import, random))] /// { - /// use wolfssl::wolfcrypt::random::RNG; - /// use wolfssl::wolfcrypt::ecc::ECC; + /// use wolfssl_wolfcrypt::random::RNG; + /// use wolfssl_wolfcrypt::ecc::ECC; /// let mut rng = RNG::new().expect("Failed to create RNG"); /// let curve_id = ECC::SECP256R1; /// let curve_size = ECC::get_curve_size_from_id(curve_id).expect("Error with get_curve_size_from_id()"); @@ -1125,8 +1125,8 @@ impl ECC { /// #[cfg(random)] /// { /// use std::fs; - /// use wolfssl::wolfcrypt::random::RNG; - /// use wolfssl::wolfcrypt::ecc::ECC; + /// use wolfssl_wolfcrypt::random::RNG; + /// use wolfssl_wolfcrypt::ecc::ECC; /// fn bytes_to_asciiz_hex_string(bytes: &[u8]) -> String { /// let mut hex_string = String::with_capacity(bytes.len() * 2 + 1); /// for byte in bytes { @@ -1191,8 +1191,8 @@ impl ECC { /// #[cfg(random)] /// { /// use std::fs; - /// use wolfssl::wolfcrypt::random::RNG; - /// use wolfssl::wolfcrypt::ecc::ECC; + /// use wolfssl_wolfcrypt::random::RNG; + /// use wolfssl_wolfcrypt::ecc::ECC; /// let mut rng = RNG::new().expect("Failed to create RNG"); /// let key_path = "../../../certs/ecc-client-key.der"; /// let der: Vec = fs::read(key_path).expect("Error reading key file"); @@ -1243,8 +1243,8 @@ impl ECC { /// #[cfg(random)] /// { /// use std::fs; - /// use wolfssl::wolfcrypt::random::RNG; - /// use wolfssl::wolfcrypt::ecc::ECC; + /// use wolfssl_wolfcrypt::random::RNG; + /// use wolfssl_wolfcrypt::ecc::ECC; /// let mut rng = RNG::new().expect("Failed to create RNG"); /// let key_path = "../../../certs/ecc-client-key.der"; /// let der: Vec = fs::read(key_path).expect("Error reading key file"); @@ -1291,8 +1291,8 @@ impl ECC { /// ```rust /// #[cfg(random)] /// { - /// use wolfssl::wolfcrypt::random::RNG; - /// use wolfssl::wolfcrypt::ecc::ECC; + /// use wolfssl_wolfcrypt::random::RNG; + /// use wolfssl_wolfcrypt::ecc::ECC; /// let mut rng = RNG::new().expect("Failed to create RNG"); /// let mut ecc = ECC::generate(32, &mut rng, None, None).expect("Error with generate()"); /// ecc.check().expect("Error with check()"); @@ -1327,8 +1327,8 @@ impl ECC { /// ```rust /// #[cfg(all(ecc_import, random))] /// { - /// use wolfssl::wolfcrypt::random::RNG; - /// use wolfssl::wolfcrypt::ecc::ECC; + /// use wolfssl_wolfcrypt::random::RNG; + /// use wolfssl_wolfcrypt::ecc::ECC; /// let mut rng = RNG::new().expect("Failed to create RNG"); /// let mut ecc = ECC::generate(32, &mut rng, None, None).expect("Error with generate()"); /// let mut qx = [0u8; 32]; @@ -1382,8 +1382,8 @@ impl ECC { /// ```rust /// #[cfg(all(ecc_import, random))] /// { - /// use wolfssl::wolfcrypt::random::RNG; - /// use wolfssl::wolfcrypt::ecc::ECC; + /// use wolfssl_wolfcrypt::random::RNG; + /// use wolfssl_wolfcrypt::ecc::ECC; /// let mut rng = RNG::new().expect("Failed to create RNG"); /// let mut ecc = ECC::generate(32, &mut rng, None, None).expect("Error with generate()"); /// let mut qx = [0u8; 32]; @@ -1438,8 +1438,8 @@ impl ECC { /// ```rust /// #[cfg(all(ecc_export, random))] /// { - /// use wolfssl::wolfcrypt::random::RNG; - /// use wolfssl::wolfcrypt::ecc::ECC; + /// use wolfssl_wolfcrypt::random::RNG; + /// use wolfssl_wolfcrypt::ecc::ECC; /// let mut rng = RNG::new().expect("Failed to create RNG"); /// let mut ecc = ECC::generate(32, &mut rng, None, None).expect("Error with generate()"); /// let mut d = [0u8; 32]; @@ -1479,8 +1479,8 @@ impl ECC { /// ```rust /// #[cfg(all(ecc_export, random))] /// { - /// use wolfssl::wolfcrypt::random::RNG; - /// use wolfssl::wolfcrypt::ecc::ECC; + /// use wolfssl_wolfcrypt::random::RNG; + /// use wolfssl_wolfcrypt::ecc::ECC; /// let mut rng = RNG::new().expect("Failed to create RNG"); /// let mut ecc = ECC::generate(32, &mut rng, None, None).expect("Error with generate()"); /// let mut qx = [0u8; 32]; @@ -1522,8 +1522,8 @@ impl ECC { /// ```rust /// #[cfg(all(ecc_export, random))] /// { - /// use wolfssl::wolfcrypt::random::RNG; - /// use wolfssl::wolfcrypt::ecc::ECC; + /// use wolfssl_wolfcrypt::random::RNG; + /// use wolfssl_wolfcrypt::ecc::ECC; /// let mut rng = RNG::new().expect("Failed to create RNG"); /// let mut ecc = ECC::generate(32, &mut rng, None, None).expect("Error with generate()"); /// let mut x963 = [0u8; 128]; @@ -1558,8 +1558,8 @@ impl ECC { /// ```rust /// #[cfg(all(ecc_export, ecc_comp_key, random))] /// { - /// use wolfssl::wolfcrypt::random::RNG; - /// use wolfssl::wolfcrypt::ecc::ECC; + /// use wolfssl_wolfcrypt::random::RNG; + /// use wolfssl_wolfcrypt::ecc::ECC; /// let mut rng = RNG::new().expect("Failed to create RNG"); /// let mut ecc = ECC::generate(32, &mut rng, None, None).expect("Error with generate()"); /// let mut x963 = [0u8; 128]; @@ -1596,8 +1596,8 @@ impl ECC { /// #[cfg(random)] /// { /// use std::fs; - /// use wolfssl::wolfcrypt::random::RNG; - /// use wolfssl::wolfcrypt::ecc::ECC; + /// use wolfssl_wolfcrypt::random::RNG; + /// use wolfssl_wolfcrypt::ecc::ECC; /// let mut rng = RNG::new().expect("Failed to create RNG"); /// let key_path = "../../../certs/ecc-client-key.der"; /// let der: Vec = fs::read(key_path).expect("Error reading key file"); @@ -1639,8 +1639,8 @@ impl ECC { /// #[cfg(random)] /// { /// use std::fs; - /// use wolfssl::wolfcrypt::random::RNG; - /// use wolfssl::wolfcrypt::ecc::ECC; + /// use wolfssl_wolfcrypt::random::RNG; + /// use wolfssl_wolfcrypt::ecc::ECC; /// let mut rng = RNG::new().expect("Failed to create RNG"); /// let key_path = "../../../certs/ecc-client-key.der"; /// let der: Vec = fs::read(key_path).expect("Error reading key file"); @@ -1693,8 +1693,8 @@ impl ECC { /// ```rust /// #[cfg(random)] /// { - /// use wolfssl::wolfcrypt::random::RNG; - /// use wolfssl::wolfcrypt::ecc::ECC; + /// use wolfssl_wolfcrypt::random::RNG; + /// use wolfssl_wolfcrypt::ecc::ECC; /// let mut rng = RNG::new().expect("Failed to create RNG"); /// let mut ecc = ECC::generate(32, &mut rng, None, None).expect("Error with generate()"); /// ecc.set_rng(&mut rng).expect("Error with set_rng()"); @@ -1729,8 +1729,8 @@ impl ECC { /// ```rust /// #[cfg(all(ecc_dh, random))] /// { - /// use wolfssl::wolfcrypt::random::RNG; - /// use wolfssl::wolfcrypt::ecc::ECC; + /// use wolfssl_wolfcrypt::random::RNG; + /// use wolfssl_wolfcrypt::ecc::ECC; /// let mut rng = RNG::new().expect("Failed to create RNG"); /// let mut ecc0 = ECC::generate(32, &mut rng, None, None).expect("Error with generate()"); /// let mut ecc1 = ECC::generate(32, &mut rng, None, None).expect("Error with generate()"); @@ -1778,8 +1778,8 @@ impl ECC { /// ```rust /// #[cfg(all(ecc_dh, random))] /// { - /// use wolfssl::wolfcrypt::random::RNG; - /// use wolfssl::wolfcrypt::ecc::ECC; + /// use wolfssl_wolfcrypt::random::RNG; + /// use wolfssl_wolfcrypt::ecc::ECC; /// let mut rng = RNG::new().expect("Failed to create RNG"); /// let mut ecc0 = ECC::generate(32, &mut rng, None, None).expect("Error with generate()"); /// let mut ecc1 = ECC::generate(32, &mut rng, None, None).expect("Error with generate()"); @@ -1827,8 +1827,8 @@ impl ECC { /// ```rust /// #[cfg(all(ecc_sign, random))] /// { - /// use wolfssl::wolfcrypt::random::RNG; - /// use wolfssl::wolfcrypt::ecc::ECC; + /// use wolfssl_wolfcrypt::random::RNG; + /// use wolfssl_wolfcrypt::ecc::ECC; /// let mut rng = RNG::new().expect("Failed to create RNG"); /// let mut ecc = ECC::generate(32, &mut rng, None, None).expect("Error with generate()"); /// let hash = [0x42u8; 32]; @@ -1870,8 +1870,8 @@ impl ECC { /// ```rust /// #[cfg(all(ecc_verify, random))] /// { - /// use wolfssl::wolfcrypt::random::RNG; - /// use wolfssl::wolfcrypt::ecc::ECC; + /// use wolfssl_wolfcrypt::random::RNG; + /// use wolfssl_wolfcrypt::ecc::ECC; /// let mut rng = RNG::new().expect("Failed to create RNG"); /// let mut ecc = ECC::generate(32, &mut rng, None, None).expect("Error with generate()"); /// let hash = [0x42u8; 32]; diff --git a/wrapper/rust/wolfssl/src/wolfcrypt/ed25519.rs b/wrapper/rust/wolfssl-wolfcrypt/src/ed25519.rs similarity index 94% rename from wrapper/rust/wolfssl/src/wolfcrypt/ed25519.rs rename to wrapper/rust/wolfssl-wolfcrypt/src/ed25519.rs index 327a8416e..f6b12611a 100644 --- a/wrapper/rust/wolfssl/src/wolfcrypt/ed25519.rs +++ b/wrapper/rust/wolfssl-wolfcrypt/src/ed25519.rs @@ -26,7 +26,7 @@ This module provides a Rust wrapper for the wolfCrypt library's EdDSA Curve #![cfg(ed25519)] use crate::sys; -use crate::wolfcrypt::random::RNG; +use crate::random::RNG; use std::mem::MaybeUninit; /// The `Ed25519` struct manages the lifecycle of a wolfSSL `ed25519_key` @@ -67,8 +67,8 @@ impl Ed25519 { /// # Example /// /// ```rust - /// use wolfssl::wolfcrypt::random::RNG; - /// use wolfssl::wolfcrypt::ed25519::Ed25519; + /// use wolfssl_wolfcrypt::random::RNG; + /// use wolfssl_wolfcrypt::ed25519::Ed25519; /// let mut rng = RNG::new().expect("Error creating RNG"); /// let ed = Ed25519::generate(&mut rng).expect("Error with generate()"); /// ``` @@ -92,8 +92,8 @@ impl Ed25519 { /// # Example /// /// ```rust - /// use wolfssl::wolfcrypt::random::RNG; - /// use wolfssl::wolfcrypt::ed25519::Ed25519; + /// use wolfssl_wolfcrypt::random::RNG; + /// use wolfssl_wolfcrypt::ed25519::Ed25519; /// let mut rng = RNG::new().expect("Error creating RNG"); /// let ed = Ed25519::generate_ex(&mut rng, None, None).expect("Error with generate_ex()"); /// ``` @@ -136,7 +136,7 @@ impl Ed25519 { /// # Example /// /// ```rust - /// use wolfssl::wolfcrypt::ed25519::Ed25519; + /// use wolfssl_wolfcrypt::ed25519::Ed25519; /// let ed = Ed25519::new().expect("Error with new()"); /// ``` pub fn new() -> Result { @@ -162,7 +162,7 @@ impl Ed25519 { /// # Example /// /// ```rust - /// use wolfssl::wolfcrypt::ed25519::Ed25519; + /// use wolfssl_wolfcrypt::ed25519::Ed25519; /// let ed = Ed25519::new_ex(None, None).expect("Error with new()"); /// ``` pub fn new_ex(heap: Option<*mut std::os::raw::c_void>, dev_id: Option) -> Result { @@ -198,8 +198,8 @@ impl Ed25519 { /// # Example /// /// ```rust - /// use wolfssl::wolfcrypt::random::RNG; - /// use wolfssl::wolfcrypt::ed25519::Ed25519; + /// use wolfssl_wolfcrypt::random::RNG; + /// use wolfssl_wolfcrypt::ed25519::Ed25519; /// let mut rng = RNG::new().expect("Error creating RNG"); /// let mut ed = Ed25519::generate(&mut rng).expect("Error with generate()"); /// ed.check_key().expect("Error with check_key()"); @@ -231,8 +231,8 @@ impl Ed25519 { /// ```rust /// #[cfg(ed25519_export)] /// { - /// use wolfssl::wolfcrypt::random::RNG; - /// use wolfssl::wolfcrypt::ed25519::Ed25519; + /// use wolfssl_wolfcrypt::random::RNG; + /// use wolfssl_wolfcrypt::ed25519::Ed25519; /// let mut rng = RNG::new().expect("Error creating RNG"); /// let mut ed = Ed25519::generate(&mut rng).expect("Error with generate()"); /// let mut private = [0u8; Ed25519::PRV_KEY_SIZE]; @@ -273,8 +273,8 @@ impl Ed25519 { /// ```rust /// #[cfg(ed25519_export)] /// { - /// use wolfssl::wolfcrypt::random::RNG; - /// use wolfssl::wolfcrypt::ed25519::Ed25519; + /// use wolfssl_wolfcrypt::random::RNG; + /// use wolfssl_wolfcrypt::ed25519::Ed25519; /// let mut rng = RNG::new().expect("Error creating RNG"); /// let mut ed = Ed25519::generate(&mut rng).expect("Error with generate()"); /// let mut public = [0u8; Ed25519::PUB_KEY_SIZE]; @@ -312,8 +312,8 @@ impl Ed25519 { /// ```rust /// #[cfg(ed25519_export)] /// { - /// use wolfssl::wolfcrypt::random::RNG; - /// use wolfssl::wolfcrypt::ed25519::Ed25519; + /// use wolfssl_wolfcrypt::random::RNG; + /// use wolfssl_wolfcrypt::ed25519::Ed25519; /// let mut rng = RNG::new().expect("Error creating RNG"); /// let mut ed = Ed25519::generate(&mut rng).expect("Error with generate()"); /// let mut private = [0u8; Ed25519::PRV_KEY_SIZE]; @@ -351,8 +351,8 @@ impl Ed25519 { /// ```rust /// #[cfg(ed25519_export)] /// { - /// use wolfssl::wolfcrypt::random::RNG; - /// use wolfssl::wolfcrypt::ed25519::Ed25519; + /// use wolfssl_wolfcrypt::random::RNG; + /// use wolfssl_wolfcrypt::ed25519::Ed25519; /// let mut rng = RNG::new().expect("Error creating RNG"); /// let mut ed = Ed25519::generate(&mut rng).expect("Error with generate()"); /// let mut private_only = [0u8; Ed25519::KEY_SIZE]; @@ -392,8 +392,8 @@ impl Ed25519 { /// ```rust /// #[cfg(ed25519_import)] /// { - /// use wolfssl::wolfcrypt::random::RNG; - /// use wolfssl::wolfcrypt::ed25519::Ed25519; + /// use wolfssl_wolfcrypt::random::RNG; + /// use wolfssl_wolfcrypt::ed25519::Ed25519; /// let mut rng = RNG::new().expect("Error creating RNG"); /// let mut ed = Ed25519::generate(&mut rng).expect("Error with generate()"); /// let mut private = [0u8; Ed25519::PRV_KEY_SIZE]; @@ -436,8 +436,8 @@ impl Ed25519 { /// ```rust /// #[cfg(ed25519_import)] /// { - /// use wolfssl::wolfcrypt::random::RNG; - /// use wolfssl::wolfcrypt::ed25519::Ed25519; + /// use wolfssl_wolfcrypt::random::RNG; + /// use wolfssl_wolfcrypt::ed25519::Ed25519; /// let mut rng = RNG::new().expect("Error creating RNG"); /// let mut ed = Ed25519::generate(&mut rng).expect("Error with generate()"); /// let mut private = [0u8; Ed25519::PRV_KEY_SIZE]; @@ -476,8 +476,8 @@ impl Ed25519 { /// ```rust /// #[cfg(ed25519_import)] /// { - /// use wolfssl::wolfcrypt::random::RNG; - /// use wolfssl::wolfcrypt::ed25519::Ed25519; + /// use wolfssl_wolfcrypt::random::RNG; + /// use wolfssl_wolfcrypt::ed25519::Ed25519; /// let mut rng = RNG::new().expect("Error creating RNG"); /// let mut ed = Ed25519::generate(&mut rng).expect("Error with generate()"); /// let mut private_only = [0u8; Ed25519::KEY_SIZE]; @@ -520,8 +520,8 @@ impl Ed25519 { /// ```rust /// #[cfg(ed25519_import)] /// { - /// use wolfssl::wolfcrypt::random::RNG; - /// use wolfssl::wolfcrypt::ed25519::Ed25519; + /// use wolfssl_wolfcrypt::random::RNG; + /// use wolfssl_wolfcrypt::ed25519::Ed25519; /// let mut rng = RNG::new().expect("Error creating RNG"); /// let mut ed = Ed25519::generate(&mut rng).expect("Error with generate()"); /// let mut private = [0u8; Ed25519::PRV_KEY_SIZE]; @@ -571,8 +571,8 @@ impl Ed25519 { /// ```rust /// #[cfg(ed25519_import)] /// { - /// use wolfssl::wolfcrypt::random::RNG; - /// use wolfssl::wolfcrypt::ed25519::Ed25519; + /// use wolfssl_wolfcrypt::random::RNG; + /// use wolfssl_wolfcrypt::ed25519::Ed25519; /// let mut rng = RNG::new().expect("Error creating RNG"); /// let mut ed = Ed25519::generate(&mut rng).expect("Error with generate()"); /// let mut private = [0u8; Ed25519::PRV_KEY_SIZE]; @@ -618,8 +618,8 @@ impl Ed25519 { /// # Example /// /// ```rust - /// use wolfssl::wolfcrypt::random::RNG; - /// use wolfssl::wolfcrypt::ed25519::Ed25519; + /// use wolfssl_wolfcrypt::random::RNG; + /// use wolfssl_wolfcrypt::ed25519::Ed25519; /// let mut rng = RNG::new().expect("Error creating RNG"); /// let ed = Ed25519::generate(&mut rng).expect("Error with generate()"); /// let mut private = [0u8; Ed25519::KEY_SIZE]; @@ -659,8 +659,8 @@ impl Ed25519 { /// ```rust /// #[cfg(ed25519_sign)] /// { - /// use wolfssl::wolfcrypt::random::RNG; - /// use wolfssl::wolfcrypt::ed25519::Ed25519; + /// use wolfssl_wolfcrypt::random::RNG; + /// use wolfssl_wolfcrypt::ed25519::Ed25519; /// let mut rng = RNG::new().expect("Error creating RNG"); /// let mut ed = Ed25519::generate(&mut rng).expect("Error with generate()"); /// let message = [0x42u8, 33, 55, 66]; @@ -703,8 +703,8 @@ impl Ed25519 { /// ```rust /// #[cfg(ed25519_sign)] /// { - /// use wolfssl::wolfcrypt::random::RNG; - /// use wolfssl::wolfcrypt::ed25519::Ed25519; + /// use wolfssl_wolfcrypt::random::RNG; + /// use wolfssl_wolfcrypt::ed25519::Ed25519; /// let mut rng = RNG::new().expect("Error creating RNG"); /// let mut ed = Ed25519::generate(&mut rng).expect("Error with generate()"); /// let message = [0x42u8, 33, 55, 66]; @@ -751,8 +751,8 @@ impl Ed25519 { /// ```rust /// #[cfg(ed25519_sign)] /// { - /// use wolfssl::wolfcrypt::random::RNG; - /// use wolfssl::wolfcrypt::ed25519::Ed25519; + /// use wolfssl_wolfcrypt::random::RNG; + /// use wolfssl_wolfcrypt::ed25519::Ed25519; /// let mut rng = RNG::new().expect("Error creating RNG"); /// let mut ed = Ed25519::generate(&mut rng).expect("Error with generate()"); /// let hash = [ @@ -813,8 +813,8 @@ impl Ed25519 { /// ```rust /// #[cfg(ed25519_sign)] /// { - /// use wolfssl::wolfcrypt::random::RNG; - /// use wolfssl::wolfcrypt::ed25519::Ed25519; + /// use wolfssl_wolfcrypt::random::RNG; + /// use wolfssl_wolfcrypt::ed25519::Ed25519; /// let mut rng = RNG::new().expect("Error creating RNG"); /// let mut ed = Ed25519::generate(&mut rng).expect("Error with generate()"); /// let message = [0x42u8, 33, 55, 66]; @@ -866,8 +866,8 @@ impl Ed25519 { /// ```rust /// #[cfg(ed25519_sign)] /// { - /// use wolfssl::wolfcrypt::random::RNG; - /// use wolfssl::wolfcrypt::ed25519::Ed25519; + /// use wolfssl_wolfcrypt::random::RNG; + /// use wolfssl_wolfcrypt::ed25519::Ed25519; /// let mut rng = RNG::new().expect("Error creating RNG"); /// let mut ed = Ed25519::generate(&mut rng).expect("Error with generate()"); /// let message = [0x42u8, 33, 55, 66]; @@ -914,8 +914,8 @@ impl Ed25519 { /// ```rust /// #[cfg(ed25519_verify)] /// { - /// use wolfssl::wolfcrypt::random::RNG; - /// use wolfssl::wolfcrypt::ed25519::Ed25519; + /// use wolfssl_wolfcrypt::random::RNG; + /// use wolfssl_wolfcrypt::ed25519::Ed25519; /// let mut rng = RNG::new().expect("Error creating RNG"); /// let mut ed = Ed25519::generate(&mut rng).expect("Error with generate()"); /// let message = [0x42u8, 33, 55, 66]; @@ -960,8 +960,8 @@ impl Ed25519 { /// ```rust /// #[cfg(ed25519_verify)] /// { - /// use wolfssl::wolfcrypt::random::RNG; - /// use wolfssl::wolfcrypt::ed25519::Ed25519; + /// use wolfssl_wolfcrypt::random::RNG; + /// use wolfssl_wolfcrypt::ed25519::Ed25519; /// let mut rng = RNG::new().expect("Error creating RNG"); /// let mut ed = Ed25519::generate(&mut rng).expect("Error with generate()"); /// let message = b"Hello!"; @@ -1011,8 +1011,8 @@ impl Ed25519 { /// ```rust /// #[cfg(ed25519_verify)] /// { - /// use wolfssl::wolfcrypt::random::RNG; - /// use wolfssl::wolfcrypt::ed25519::Ed25519; + /// use wolfssl_wolfcrypt::random::RNG; + /// use wolfssl_wolfcrypt::ed25519::Ed25519; /// let mut rng = RNG::new().expect("Error creating RNG"); /// let mut ed = Ed25519::generate(&mut rng).expect("Error with generate()"); /// let hash = [ @@ -1075,8 +1075,8 @@ impl Ed25519 { /// ```rust /// #[cfg(ed25519_verify)] /// { - /// use wolfssl::wolfcrypt::random::RNG; - /// use wolfssl::wolfcrypt::ed25519::Ed25519; + /// use wolfssl_wolfcrypt::random::RNG; + /// use wolfssl_wolfcrypt::ed25519::Ed25519; /// let mut rng = RNG::new().expect("Error creating RNG"); /// let mut ed = Ed25519::generate(&mut rng).expect("Error with generate()"); /// let message = [0x42u8, 33, 55, 66]; @@ -1130,8 +1130,8 @@ impl Ed25519 { /// ```rust /// #[cfg(ed25519_verify)] /// { - /// use wolfssl::wolfcrypt::random::RNG; - /// use wolfssl::wolfcrypt::ed25519::Ed25519; + /// use wolfssl_wolfcrypt::random::RNG; + /// use wolfssl_wolfcrypt::ed25519::Ed25519; /// let mut rng = RNG::new().expect("Error creating RNG"); /// let mut ed = Ed25519::generate(&mut rng).expect("Error with generate()"); /// let message = [0x42u8, 33, 55, 66]; @@ -1182,8 +1182,8 @@ impl Ed25519 { /// ```rust /// #[cfg(ed25519_streaming_verify)] /// { - /// use wolfssl::wolfcrypt::random::RNG; - /// use wolfssl::wolfcrypt::ed25519::Ed25519; + /// use wolfssl_wolfcrypt::random::RNG; + /// use wolfssl_wolfcrypt::ed25519::Ed25519; /// let mut rng = RNG::new().expect("Error creating RNG"); /// let mut ed = Ed25519::generate(&mut rng).expect("Error with generate()"); /// let message = [0x42u8, 33, 55, 66]; @@ -1231,8 +1231,8 @@ impl Ed25519 { /// ```rust /// #[cfg(ed25519_streaming_verify)] /// { - /// use wolfssl::wolfcrypt::random::RNG; - /// use wolfssl::wolfcrypt::ed25519::Ed25519; + /// use wolfssl_wolfcrypt::random::RNG; + /// use wolfssl_wolfcrypt::ed25519::Ed25519; /// let mut rng = RNG::new().expect("Error creating RNG"); /// let mut ed = Ed25519::generate(&mut rng).expect("Error with generate()"); /// let message = [0x42u8, 33, 55, 66]; @@ -1274,8 +1274,8 @@ impl Ed25519 { /// ```rust /// #[cfg(ed25519_streaming_verify)] /// { - /// use wolfssl::wolfcrypt::random::RNG; - /// use wolfssl::wolfcrypt::ed25519::Ed25519; + /// use wolfssl_wolfcrypt::random::RNG; + /// use wolfssl_wolfcrypt::ed25519::Ed25519; /// let mut rng = RNG::new().expect("Error creating RNG"); /// let mut ed = Ed25519::generate(&mut rng).expect("Error with generate()"); /// let message = [0x42u8, 33, 55, 66]; @@ -1312,8 +1312,8 @@ impl Ed25519 { /// # Example /// /// ```rust - /// use wolfssl::wolfcrypt::random::RNG; - /// use wolfssl::wolfcrypt::ed25519::Ed25519; + /// use wolfssl_wolfcrypt::random::RNG; + /// use wolfssl_wolfcrypt::ed25519::Ed25519; /// let mut rng = RNG::new().expect("Error creating RNG"); /// let ed = Ed25519::generate(&mut rng).expect("Error with generate()"); /// let key_size = ed.size().expect("Error with size()"); @@ -1337,8 +1337,8 @@ impl Ed25519 { /// # Example /// /// ```rust - /// use wolfssl::wolfcrypt::random::RNG; - /// use wolfssl::wolfcrypt::ed25519::Ed25519; + /// use wolfssl_wolfcrypt::random::RNG; + /// use wolfssl_wolfcrypt::ed25519::Ed25519; /// let mut rng = RNG::new().expect("Error creating RNG"); /// let ed = Ed25519::generate(&mut rng).expect("Error with generate()"); /// let priv_size = ed.priv_size().expect("Error with priv_size()"); @@ -1362,8 +1362,8 @@ impl Ed25519 { /// # Example /// /// ```rust - /// use wolfssl::wolfcrypt::random::RNG; - /// use wolfssl::wolfcrypt::ed25519::Ed25519; + /// use wolfssl_wolfcrypt::random::RNG; + /// use wolfssl_wolfcrypt::ed25519::Ed25519; /// let mut rng = RNG::new().expect("Error creating RNG"); /// let ed = Ed25519::generate(&mut rng).expect("Error with generate()"); /// let pub_size = ed.pub_size().expect("Error with pub_size()"); @@ -1387,8 +1387,8 @@ impl Ed25519 { /// # Example /// /// ```rust - /// use wolfssl::wolfcrypt::random::RNG; - /// use wolfssl::wolfcrypt::ed25519::Ed25519; + /// use wolfssl_wolfcrypt::random::RNG; + /// use wolfssl_wolfcrypt::ed25519::Ed25519; /// let mut rng = RNG::new().expect("Error creating RNG"); /// let ed = Ed25519::generate(&mut rng).expect("Error with generate()"); /// let sig_size = ed.sig_size().expect("Error with sig_size()"); diff --git a/wrapper/rust/wolfssl/src/wolfcrypt/ed448.rs b/wrapper/rust/wolfssl-wolfcrypt/src/ed448.rs similarity index 94% rename from wrapper/rust/wolfssl/src/wolfcrypt/ed448.rs rename to wrapper/rust/wolfssl-wolfcrypt/src/ed448.rs index 104c92808..27feaf35b 100644 --- a/wrapper/rust/wolfssl/src/wolfcrypt/ed448.rs +++ b/wrapper/rust/wolfssl-wolfcrypt/src/ed448.rs @@ -26,7 +26,7 @@ This module provides a Rust wrapper for the wolfCrypt library's EdDSA Curve #![cfg(ed448)] use crate::sys; -use crate::wolfcrypt::random::RNG; +use crate::random::RNG; use std::mem::MaybeUninit; /// The `Ed448` struct manages the lifecycle of a wolfSSL `ed448_key` @@ -66,8 +66,8 @@ impl Ed448 { /// # Example /// /// ```rust - /// use wolfssl::wolfcrypt::random::RNG; - /// use wolfssl::wolfcrypt::ed448::Ed448; + /// use wolfssl_wolfcrypt::random::RNG; + /// use wolfssl_wolfcrypt::ed448::Ed448; /// let mut rng = RNG::new().expect("Error creating RNG"); /// let ed = Ed448::generate(&mut rng).expect("Error with generate()"); /// ``` @@ -91,8 +91,8 @@ impl Ed448 { /// # Example /// /// ```rust - /// use wolfssl::wolfcrypt::random::RNG; - /// use wolfssl::wolfcrypt::ed448::Ed448; + /// use wolfssl_wolfcrypt::random::RNG; + /// use wolfssl_wolfcrypt::ed448::Ed448; /// let mut rng = RNG::new().expect("Error creating RNG"); /// let ed = Ed448::generate_ex(&mut rng, None, None).expect("Error with generate_ex()"); /// ``` @@ -135,7 +135,7 @@ impl Ed448 { /// # Example /// /// ```rust - /// use wolfssl::wolfcrypt::ed448::Ed448; + /// use wolfssl_wolfcrypt::ed448::Ed448; /// let ed = Ed448::new().expect("Error with new()"); /// ``` pub fn new() -> Result { @@ -161,7 +161,7 @@ impl Ed448 { /// # Example /// /// ```rust - /// use wolfssl::wolfcrypt::ed448::Ed448; + /// use wolfssl_wolfcrypt::ed448::Ed448; /// let ed = Ed448::new_ex(None, None).expect("Error with new()"); /// ``` pub fn new_ex(heap: Option<*mut std::os::raw::c_void>, dev_id: Option) -> Result { @@ -197,8 +197,8 @@ impl Ed448 { /// # Example /// /// ```rust - /// use wolfssl::wolfcrypt::random::RNG; - /// use wolfssl::wolfcrypt::ed448::Ed448; + /// use wolfssl_wolfcrypt::random::RNG; + /// use wolfssl_wolfcrypt::ed448::Ed448; /// let mut rng = RNG::new().expect("Error creating RNG"); /// let mut ed = Ed448::generate(&mut rng).expect("Error with generate()"); /// ed.check_key().expect("Error with check_key()"); @@ -230,8 +230,8 @@ impl Ed448 { /// ```rust /// #[cfg(ed448_export)] /// { - /// use wolfssl::wolfcrypt::random::RNG; - /// use wolfssl::wolfcrypt::ed448::Ed448; + /// use wolfssl_wolfcrypt::random::RNG; + /// use wolfssl_wolfcrypt::ed448::Ed448; /// let mut rng = RNG::new().expect("Error creating RNG"); /// let mut ed = Ed448::generate(&mut rng).expect("Error with generate()"); /// let mut private = [0u8; Ed448::PRV_KEY_SIZE]; @@ -271,8 +271,8 @@ impl Ed448 { /// ```rust /// #[cfg(ed448_export)] /// { - /// use wolfssl::wolfcrypt::random::RNG; - /// use wolfssl::wolfcrypt::ed448::Ed448; + /// use wolfssl_wolfcrypt::random::RNG; + /// use wolfssl_wolfcrypt::ed448::Ed448; /// let mut rng = RNG::new().expect("Error creating RNG"); /// let mut ed = Ed448::generate(&mut rng).expect("Error with generate()"); /// let mut public = [0u8; Ed448::PUB_KEY_SIZE]; @@ -309,8 +309,8 @@ impl Ed448 { /// ```rust /// #[cfg(ed448_export)] /// { - /// use wolfssl::wolfcrypt::random::RNG; - /// use wolfssl::wolfcrypt::ed448::Ed448; + /// use wolfssl_wolfcrypt::random::RNG; + /// use wolfssl_wolfcrypt::ed448::Ed448; /// let mut rng = RNG::new().expect("Error creating RNG"); /// let mut ed = Ed448::generate(&mut rng).expect("Error with generate()"); /// let mut private = [0u8; Ed448::PRV_KEY_SIZE]; @@ -347,8 +347,8 @@ impl Ed448 { /// ```rust /// #[cfg(ed448_export)] /// { - /// use wolfssl::wolfcrypt::random::RNG; - /// use wolfssl::wolfcrypt::ed448::Ed448; + /// use wolfssl_wolfcrypt::random::RNG; + /// use wolfssl_wolfcrypt::ed448::Ed448; /// let mut rng = RNG::new().expect("Error creating RNG"); /// let mut ed = Ed448::generate(&mut rng).expect("Error with generate()"); /// let mut private_only = [0u8; Ed448::KEY_SIZE]; @@ -388,8 +388,8 @@ impl Ed448 { /// ```rust /// #[cfg(ed448_import)] /// { - /// use wolfssl::wolfcrypt::random::RNG; - /// use wolfssl::wolfcrypt::ed448::Ed448; + /// use wolfssl_wolfcrypt::random::RNG; + /// use wolfssl_wolfcrypt::ed448::Ed448; /// let mut rng = RNG::new().expect("Error creating RNG"); /// let mut ed = Ed448::generate(&mut rng).expect("Error with generate()"); /// let mut private = [0u8; Ed448::PRV_KEY_SIZE]; @@ -432,8 +432,8 @@ impl Ed448 { /// ```rust /// #[cfg(ed448_import)] /// { - /// use wolfssl::wolfcrypt::random::RNG; - /// use wolfssl::wolfcrypt::ed448::Ed448; + /// use wolfssl_wolfcrypt::random::RNG; + /// use wolfssl_wolfcrypt::ed448::Ed448; /// let mut rng = RNG::new().expect("Error creating RNG"); /// let mut ed = Ed448::generate(&mut rng).expect("Error with generate()"); /// let mut private = [0u8; Ed448::PRV_KEY_SIZE]; @@ -472,8 +472,8 @@ impl Ed448 { /// ```rust /// #[cfg(ed448_import)] /// { - /// use wolfssl::wolfcrypt::random::RNG; - /// use wolfssl::wolfcrypt::ed448::Ed448; + /// use wolfssl_wolfcrypt::random::RNG; + /// use wolfssl_wolfcrypt::ed448::Ed448; /// let mut rng = RNG::new().expect("Error creating RNG"); /// let mut ed = Ed448::generate(&mut rng).expect("Error with generate()"); /// let mut private_only = [0u8; Ed448::KEY_SIZE]; @@ -516,8 +516,8 @@ impl Ed448 { /// ```rust /// #[cfg(ed448_import)] /// { - /// use wolfssl::wolfcrypt::random::RNG; - /// use wolfssl::wolfcrypt::ed448::Ed448; + /// use wolfssl_wolfcrypt::random::RNG; + /// use wolfssl_wolfcrypt::ed448::Ed448; /// let mut rng = RNG::new().expect("Error creating RNG"); /// let mut ed = Ed448::generate(&mut rng).expect("Error with generate()"); /// let mut private = [0u8; Ed448::PRV_KEY_SIZE]; @@ -567,8 +567,8 @@ impl Ed448 { /// ```rust /// #[cfg(ed448_import)] /// { - /// use wolfssl::wolfcrypt::random::RNG; - /// use wolfssl::wolfcrypt::ed448::Ed448; + /// use wolfssl_wolfcrypt::random::RNG; + /// use wolfssl_wolfcrypt::ed448::Ed448; /// let mut rng = RNG::new().expect("Error creating RNG"); /// let mut ed = Ed448::generate(&mut rng).expect("Error with generate()"); /// let mut private = [0u8; Ed448::PRV_KEY_SIZE]; @@ -614,8 +614,8 @@ impl Ed448 { /// # Example /// /// ```rust - /// use wolfssl::wolfcrypt::random::RNG; - /// use wolfssl::wolfcrypt::ed448::Ed448; + /// use wolfssl_wolfcrypt::random::RNG; + /// use wolfssl_wolfcrypt::ed448::Ed448; /// let mut rng = RNG::new().expect("Error creating RNG"); /// let ed = Ed448::generate(&mut rng).expect("Error with generate()"); /// let mut private = [0u8; Ed448::KEY_SIZE]; @@ -658,8 +658,8 @@ impl Ed448 { /// ```rust /// #[cfg(ed448_sign)] /// { - /// use wolfssl::wolfcrypt::random::RNG; - /// use wolfssl::wolfcrypt::ed448::Ed448; + /// use wolfssl_wolfcrypt::random::RNG; + /// use wolfssl_wolfcrypt::ed448::Ed448; /// let mut rng = RNG::new().expect("Error creating RNG"); /// let mut ed = Ed448::generate(&mut rng).expect("Error with generate()"); /// let message = [0x42u8, 33, 55, 66]; @@ -711,8 +711,8 @@ impl Ed448 { /// ```rust /// #[cfg(ed448_sign)] /// { - /// use wolfssl::wolfcrypt::random::RNG; - /// use wolfssl::wolfcrypt::ed448::Ed448; + /// use wolfssl_wolfcrypt::random::RNG; + /// use wolfssl_wolfcrypt::ed448::Ed448; /// let mut rng = RNG::new().expect("Error creating RNG"); /// let mut ed = Ed448::generate(&mut rng).expect("Error with generate()"); /// let hash = [ @@ -773,8 +773,8 @@ impl Ed448 { /// ```rust /// #[cfg(ed448_sign)] /// { - /// use wolfssl::wolfcrypt::random::RNG; - /// use wolfssl::wolfcrypt::ed448::Ed448; + /// use wolfssl_wolfcrypt::random::RNG; + /// use wolfssl_wolfcrypt::ed448::Ed448; /// let mut rng = RNG::new().expect("Error creating RNG"); /// let mut ed = Ed448::generate(&mut rng).expect("Error with generate()"); /// let message = [0x42u8, 33, 55, 66]; @@ -826,8 +826,8 @@ impl Ed448 { /// ```rust /// #[cfg(ed448_sign)] /// { - /// use wolfssl::wolfcrypt::random::RNG; - /// use wolfssl::wolfcrypt::ed448::Ed448; + /// use wolfssl_wolfcrypt::random::RNG; + /// use wolfssl_wolfcrypt::ed448::Ed448; /// let mut rng = RNG::new().expect("Error creating RNG"); /// let mut ed = Ed448::generate(&mut rng).expect("Error with generate()"); /// let message = [0x42u8, 33, 55, 66]; @@ -877,8 +877,8 @@ impl Ed448 { /// ```rust /// #[cfg(ed448_verify)] /// { - /// use wolfssl::wolfcrypt::random::RNG; - /// use wolfssl::wolfcrypt::ed448::Ed448; + /// use wolfssl_wolfcrypt::random::RNG; + /// use wolfssl_wolfcrypt::ed448::Ed448; /// let mut rng = RNG::new().expect("Error creating RNG"); /// let mut ed = Ed448::generate(&mut rng).expect("Error with generate()"); /// let message = b"Hello!"; @@ -933,8 +933,8 @@ impl Ed448 { /// ```rust /// #[cfg(ed448_verify)] /// { - /// use wolfssl::wolfcrypt::random::RNG; - /// use wolfssl::wolfcrypt::ed448::Ed448; + /// use wolfssl_wolfcrypt::random::RNG; + /// use wolfssl_wolfcrypt::ed448::Ed448; /// let mut rng = RNG::new().expect("Error creating RNG"); /// let mut ed = Ed448::generate(&mut rng).expect("Error with generate()"); /// let hash = [ @@ -997,8 +997,8 @@ impl Ed448 { /// ```rust /// #[cfg(ed448_verify)] /// { - /// use wolfssl::wolfcrypt::random::RNG; - /// use wolfssl::wolfcrypt::ed448::Ed448; + /// use wolfssl_wolfcrypt::random::RNG; + /// use wolfssl_wolfcrypt::ed448::Ed448; /// let mut rng = RNG::new().expect("Error creating RNG"); /// let mut ed = Ed448::generate(&mut rng).expect("Error with generate()"); /// let message = [0x42u8, 33, 55, 66]; @@ -1052,8 +1052,8 @@ impl Ed448 { /// ```rust /// #[cfg(ed448_verify)] /// { - /// use wolfssl::wolfcrypt::random::RNG; - /// use wolfssl::wolfcrypt::ed448::Ed448; + /// use wolfssl_wolfcrypt::random::RNG; + /// use wolfssl_wolfcrypt::ed448::Ed448; /// let mut rng = RNG::new().expect("Error creating RNG"); /// let mut ed = Ed448::generate(&mut rng).expect("Error with generate()"); /// let message = [0x42u8, 33, 55, 66]; @@ -1104,8 +1104,8 @@ impl Ed448 { /// ```rust /// #[cfg(ed448_streaming_verify)] /// { - /// use wolfssl::wolfcrypt::random::RNG; - /// use wolfssl::wolfcrypt::ed448::Ed448; + /// use wolfssl_wolfcrypt::random::RNG; + /// use wolfssl_wolfcrypt::ed448::Ed448; /// let mut rng = RNG::new().expect("Error creating RNG"); /// let mut ed = Ed448::generate(&mut rng).expect("Error with generate()"); /// let message = [0x42u8, 33, 55, 66]; @@ -1154,8 +1154,8 @@ impl Ed448 { /// ```rust /// #[cfg(ed448_streaming_verify)] /// { - /// use wolfssl::wolfcrypt::random::RNG; - /// use wolfssl::wolfcrypt::ed448::Ed448; + /// use wolfssl_wolfcrypt::random::RNG; + /// use wolfssl_wolfcrypt::ed448::Ed448; /// let mut rng = RNG::new().expect("Error creating RNG"); /// let mut ed = Ed448::generate(&mut rng).expect("Error with generate()"); /// let message = [0x42u8, 33, 55, 66]; @@ -1198,8 +1198,8 @@ impl Ed448 { /// ```rust /// #[cfg(ed448_streaming_verify)] /// { - /// use wolfssl::wolfcrypt::random::RNG; - /// use wolfssl::wolfcrypt::ed448::Ed448; + /// use wolfssl_wolfcrypt::random::RNG; + /// use wolfssl_wolfcrypt::ed448::Ed448; /// let mut rng = RNG::new().expect("Error creating RNG"); /// let mut ed = Ed448::generate(&mut rng).expect("Error with generate()"); /// let message = [0x42u8, 33, 55, 66]; @@ -1237,8 +1237,8 @@ impl Ed448 { /// # Example /// /// ```rust - /// use wolfssl::wolfcrypt::random::RNG; - /// use wolfssl::wolfcrypt::ed448::Ed448; + /// use wolfssl_wolfcrypt::random::RNG; + /// use wolfssl_wolfcrypt::ed448::Ed448; /// let mut rng = RNG::new().expect("Error creating RNG"); /// let ed = Ed448::generate(&mut rng).expect("Error with generate()"); /// let key_size = ed.size().expect("Error with size()"); @@ -1262,8 +1262,8 @@ impl Ed448 { /// # Example /// /// ```rust - /// use wolfssl::wolfcrypt::random::RNG; - /// use wolfssl::wolfcrypt::ed448::Ed448; + /// use wolfssl_wolfcrypt::random::RNG; + /// use wolfssl_wolfcrypt::ed448::Ed448; /// let mut rng = RNG::new().expect("Error creating RNG"); /// let ed = Ed448::generate(&mut rng).expect("Error with generate()"); /// let priv_size = ed.priv_size().expect("Error with priv_size()"); @@ -1287,8 +1287,8 @@ impl Ed448 { /// # Example /// /// ```rust - /// use wolfssl::wolfcrypt::random::RNG; - /// use wolfssl::wolfcrypt::ed448::Ed448; + /// use wolfssl_wolfcrypt::random::RNG; + /// use wolfssl_wolfcrypt::ed448::Ed448; /// let mut rng = RNG::new().expect("Error creating RNG"); /// let ed = Ed448::generate(&mut rng).expect("Error with generate()"); /// let pub_size = ed.pub_size().expect("Error with pub_size()"); @@ -1312,8 +1312,8 @@ impl Ed448 { /// # Example /// /// ```rust - /// use wolfssl::wolfcrypt::random::RNG; - /// use wolfssl::wolfcrypt::ed448::Ed448; + /// use wolfssl_wolfcrypt::random::RNG; + /// use wolfssl_wolfcrypt::ed448::Ed448; /// let mut rng = RNG::new().expect("Error creating RNG"); /// let ed = Ed448::generate(&mut rng).expect("Error with generate()"); /// let sig_size = ed.sig_size().expect("Error with sig_size()"); diff --git a/wrapper/rust/wolfssl/src/wolfcrypt/hkdf.rs b/wrapper/rust/wolfssl-wolfcrypt/src/hkdf.rs similarity index 93% rename from wrapper/rust/wolfssl/src/wolfcrypt/hkdf.rs rename to wrapper/rust/wolfssl-wolfcrypt/src/hkdf.rs index 6dd52ffa6..8b3e670f1 100644 --- a/wrapper/rust/wolfssl/src/wolfcrypt/hkdf.rs +++ b/wrapper/rust/wolfssl-wolfcrypt/src/hkdf.rs @@ -26,7 +26,7 @@ Derivation Function (HKDF) functionality. #![cfg(hkdf)] use crate::sys; -use crate::wolfcrypt::hmac::HMAC; +use crate::hmac::HMAC; /// Perform HKDF-Extract operation. /// @@ -49,9 +49,9 @@ use crate::wolfcrypt::hmac::HMAC; /// # Example /// /// ```rust -/// use wolfssl::wolfcrypt::hkdf::*; -/// use wolfssl::wolfcrypt::hmac::HMAC; -/// use wolfssl::wolfcrypt::sha::SHA256; +/// use wolfssl_wolfcrypt::hkdf::*; +/// use wolfssl_wolfcrypt::hmac::HMAC; +/// use wolfssl_wolfcrypt::sha::SHA256; /// let ikm = b"MyPassword0"; /// let salt = b"12345678ABCDEFGH"; /// let mut extract_out = [0u8; SHA256::DIGEST_SIZE]; @@ -84,9 +84,9 @@ pub fn hkdf_extract(typ: i32, salt: Option<&[u8]>, key: &[u8], out: &mut [u8]) - /// # Example /// /// ```rust -/// use wolfssl::wolfcrypt::hkdf::*; -/// use wolfssl::wolfcrypt::hmac::HMAC; -/// use wolfssl::wolfcrypt::sha::SHA256; +/// use wolfssl_wolfcrypt::hkdf::*; +/// use wolfssl_wolfcrypt::hmac::HMAC; +/// use wolfssl_wolfcrypt::sha::SHA256; /// let ikm = b"MyPassword0"; /// let salt = b"12345678ABCDEFGH"; /// let mut extract_out = [0u8; SHA256::DIGEST_SIZE]; @@ -142,9 +142,9 @@ pub fn hkdf_extract_ex(typ: i32, salt: Option<&[u8]>, key: &[u8], out: &mut [u8] /// # Example /// /// ```rust -/// use wolfssl::wolfcrypt::hkdf::*; -/// use wolfssl::wolfcrypt::hmac::HMAC; -/// use wolfssl::wolfcrypt::sha::SHA256; +/// use wolfssl_wolfcrypt::hkdf::*; +/// use wolfssl_wolfcrypt::hmac::HMAC; +/// use wolfssl_wolfcrypt::sha::SHA256; /// let ikm = b"MyPassword0"; /// let salt = b"12345678ABCDEFGH"; /// let mut extract_out = [0u8; SHA256::DIGEST_SIZE]; @@ -180,9 +180,9 @@ pub fn hkdf_expand(typ: i32, key: &[u8], info: Option<&[u8]>, out: &mut [u8]) -> /// # Example /// /// ```rust -/// use wolfssl::wolfcrypt::hkdf::*; -/// use wolfssl::wolfcrypt::hmac::HMAC; -/// use wolfssl::wolfcrypt::sha::SHA256; +/// use wolfssl_wolfcrypt::hkdf::*; +/// use wolfssl_wolfcrypt::hmac::HMAC; +/// use wolfssl_wolfcrypt::sha::SHA256; /// let ikm = b"MyPassword0"; /// let salt = b"12345678ABCDEFGH"; /// let mut extract_out = [0u8; SHA256::DIGEST_SIZE]; @@ -241,8 +241,8 @@ pub fn hkdf_expand_ex(typ: i32, key: &[u8], info: Option<&[u8]>, out: &mut [u8], /// # Example /// /// ```rust -/// use wolfssl::wolfcrypt::hkdf::*; -/// use wolfssl::wolfcrypt::hmac::HMAC; +/// use wolfssl_wolfcrypt::hkdf::*; +/// use wolfssl_wolfcrypt::hmac::HMAC; /// let ikm = b"MyPassword0"; /// let salt = b"12345678ABCDEFGH"; /// let info = b"0"; diff --git a/wrapper/rust/wolfssl/src/wolfcrypt/hmac.rs b/wrapper/rust/wolfssl-wolfcrypt/src/hmac.rs similarity index 97% rename from wrapper/rust/wolfssl/src/wolfcrypt/hmac.rs rename to wrapper/rust/wolfssl-wolfcrypt/src/hmac.rs index b21cd0577..5c93c200c 100644 --- a/wrapper/rust/wolfssl/src/wolfcrypt/hmac.rs +++ b/wrapper/rust/wolfssl-wolfcrypt/src/hmac.rs @@ -80,7 +80,7 @@ impl HMAC { /// # Example /// /// ```rust - /// use wolfssl::wolfcrypt::hmac::HMAC; + /// use wolfssl_wolfcrypt::hmac::HMAC; /// let key = [0x42u8; 16]; /// let mut hmac = HMAC::new(HMAC::TYPE_SHA256, &key).expect("Error with new()"); /// ``` @@ -106,7 +106,7 @@ impl HMAC { /// # Example /// /// ```rust - /// use wolfssl::wolfcrypt::hmac::HMAC; + /// use wolfssl_wolfcrypt::hmac::HMAC; /// let key = [0x42u8; 16]; /// let mut hmac = HMAC::new_ex(HMAC::TYPE_SHA256, &key, None, None).expect("Error with new_ex()"); /// ``` @@ -154,7 +154,7 @@ impl HMAC { /// # Example /// /// ```rust - /// use wolfssl::wolfcrypt::hmac::HMAC; + /// use wolfssl_wolfcrypt::hmac::HMAC; /// let key = [0x42u8; 3]; /// let mut hmac = HMAC::new_allow_short_key(HMAC::TYPE_SHA256, &key).expect("Error with new_allow_short_key()"); /// ``` @@ -180,7 +180,7 @@ impl HMAC { /// # Example /// /// ```rust - /// use wolfssl::wolfcrypt::hmac::HMAC; + /// use wolfssl_wolfcrypt::hmac::HMAC; /// let key = [0x42u8; 3]; /// let mut hmac = HMAC::new_allow_short_key_ex(HMAC::TYPE_SHA256, &key, None, None).expect("Error with new_allow_short_key_ex()"); /// ``` @@ -229,7 +229,7 @@ impl HMAC { /// # Example /// /// ```rust - /// use wolfssl::wolfcrypt::hmac::HMAC; + /// use wolfssl_wolfcrypt::hmac::HMAC; /// let key = [0x42u8; 16]; /// let mut hmac = HMAC::new(HMAC::TYPE_SHA256, &key).expect("Error with new()"); /// hmac.update(b"input").expect("Error with update()"); @@ -260,7 +260,7 @@ impl HMAC { /// # Example /// /// ```rust - /// use wolfssl::wolfcrypt::hmac::HMAC; + /// use wolfssl_wolfcrypt::hmac::HMAC; /// let key = [0x42u8; 16]; /// let mut hmac = HMAC::new(HMAC::TYPE_SHA256, &key).expect("Error with new()"); /// hmac.update(b"input").expect("Error with update()"); @@ -299,7 +299,7 @@ impl HMAC { /// # Example /// /// ```rust - /// use wolfssl::wolfcrypt::hmac::HMAC; + /// use wolfssl_wolfcrypt::hmac::HMAC; /// let key = [0x42u8; 16]; /// let mut hmac = HMAC::new(HMAC::TYPE_SHA256, &key).expect("Error with new()"); /// hmac.update(b"input").expect("Error with update()"); diff --git a/wrapper/rust/wolfssl/src/wolfcrypt/kdf.rs b/wrapper/rust/wolfssl-wolfcrypt/src/kdf.rs similarity index 96% rename from wrapper/rust/wolfssl/src/wolfcrypt/kdf.rs rename to wrapper/rust/wolfssl-wolfcrypt/src/kdf.rs index 901f2f7f1..f3e2604a6 100644 --- a/wrapper/rust/wolfssl/src/wolfcrypt/kdf.rs +++ b/wrapper/rust/wolfssl-wolfcrypt/src/kdf.rs @@ -25,7 +25,7 @@ Function (KDF) functionality. use crate::sys; #[cfg(all(hmac, kdf_tls13))] -use crate::wolfcrypt::hmac::HMAC; +use crate::hmac::HMAC; #[cfg(kdf_srtp)] pub const SRTP_LABEL_ENCRYPTION: u8 = sys::WC_SRTP_LABEL_ENCRYPTION as u8; @@ -66,8 +66,8 @@ pub const SRTP_LABEL_HDR_SALT: u8 = sys::WC_SRTP_LABEL_HDR_SALT as u8; /// ```rust /// #[cfg(all(hmac, kdf_pbkdf2))] /// { -/// use wolfssl::wolfcrypt::kdf::pbkdf2; -/// use wolfssl::wolfcrypt::hmac::HMAC; +/// use wolfssl_wolfcrypt::kdf::pbkdf2; +/// use wolfssl_wolfcrypt::hmac::HMAC; /// let password = b"passwordpassword"; /// let salt = [0x78u8, 0x57, 0x8E, 0x5a, 0x5d, 0x63, 0xcb, 0x06]; /// let iterations = 2048; @@ -110,8 +110,8 @@ pub fn pbkdf2(password: &[u8], salt: &[u8], iterations: i32, typ: i32, out: &mut /// ```rust /// #[cfg(all(hmac, kdf_pbkdf2))] /// { -/// use wolfssl::wolfcrypt::kdf::pbkdf2_ex; -/// use wolfssl::wolfcrypt::hmac::HMAC; +/// use wolfssl_wolfcrypt::kdf::pbkdf2_ex; +/// use wolfssl_wolfcrypt::hmac::HMAC; /// let password = b"passwordpassword"; /// let salt = [0x78u8, 0x57, 0x8E, 0x5a, 0x5d, 0x63, 0xcb, 0x06]; /// let iterations = 2048; @@ -178,8 +178,8 @@ pub fn pbkdf2_ex(password: &[u8], salt: &[u8], iterations: i32, typ: i32, heap: /// ```rust /// #[cfg(all(hmac, kdf_pkcs12))] /// { -/// use wolfssl::wolfcrypt::kdf::pkcs12_pbkdf; -/// use wolfssl::wolfcrypt::hmac::HMAC; +/// use wolfssl_wolfcrypt::kdf::pkcs12_pbkdf; +/// use wolfssl_wolfcrypt::hmac::HMAC; /// let password = [0x00u8, 0x73, 0x00, 0x6d, 0x00, 0x65, 0x00, 0x67, 0x00, 0x00]; /// let salt = [0x0au8, 0x58, 0xCF, 0x64, 0x53, 0x0d, 0x82, 0x3f]; /// let expected_key = [ @@ -231,8 +231,8 @@ pub fn pkcs12_pbkdf(password: &[u8], salt: &[u8], iterations: i32, typ: i32, id: /// ```rust /// #[cfg(all(hmac, kdf_pkcs12))] /// { -/// use wolfssl::wolfcrypt::kdf::pkcs12_pbkdf_ex; -/// use wolfssl::wolfcrypt::hmac::HMAC; +/// use wolfssl_wolfcrypt::kdf::pkcs12_pbkdf_ex; +/// use wolfssl_wolfcrypt::hmac::HMAC; /// let password = [0x00u8, 0x73, 0x00, 0x6d, 0x00, 0x65, 0x00, 0x67, 0x00, 0x00]; /// let salt = [0x0au8, 0x58, 0xCF, 0x64, 0x53, 0x0d, 0x82, 0x3f]; /// let expected_key = [ @@ -286,9 +286,9 @@ pub fn pkcs12_pbkdf_ex(password: &[u8], salt: &[u8], iterations: i32, typ: i32, /// ```rust /// #[cfg(all(hmac, kdf_tls13))] /// { -/// use wolfssl::wolfcrypt::hmac::HMAC; -/// use wolfssl::wolfcrypt::kdf::*; -/// use wolfssl::wolfcrypt::sha::SHA256; +/// use wolfssl_wolfcrypt::hmac::HMAC; +/// use wolfssl_wolfcrypt::kdf::*; +/// use wolfssl_wolfcrypt::sha::SHA256; /// let mut secret = [0u8; SHA256::DIGEST_SIZE]; /// tls13_hkdf_extract(HMAC::TYPE_SHA256, None, None, &mut secret).expect("Error with tls13_hkdf_extract()"); /// } @@ -322,9 +322,9 @@ pub fn tls13_hkdf_extract(typ: i32, salt: Option<&[u8]>, key: Option<&mut [u8]>, /// ```rust /// #[cfg(all(hmac, kdf_tls13))] /// { -/// use wolfssl::wolfcrypt::hmac::HMAC; -/// use wolfssl::wolfcrypt::kdf::*; -/// use wolfssl::wolfcrypt::sha::SHA256; +/// use wolfssl_wolfcrypt::hmac::HMAC; +/// use wolfssl_wolfcrypt::kdf::*; +/// use wolfssl_wolfcrypt::sha::SHA256; /// let mut secret = [0u8; SHA256::DIGEST_SIZE]; /// tls13_hkdf_extract_ex(HMAC::TYPE_SHA256, None, None, &mut secret, None, None).expect("Error with tls13_hkdf_extract_ex()"); /// } @@ -390,9 +390,9 @@ pub fn tls13_hkdf_extract_ex(typ: i32, salt: Option<&[u8]>, key: Option<&mut [u8 /// ```rust /// #[cfg(all(hmac, kdf_tls13))] /// { -/// use wolfssl::wolfcrypt::hmac::HMAC; -/// use wolfssl::wolfcrypt::kdf::*; -/// use wolfssl::wolfcrypt::sha::SHA256; +/// use wolfssl_wolfcrypt::hmac::HMAC; +/// use wolfssl_wolfcrypt::kdf::*; +/// use wolfssl_wolfcrypt::sha::SHA256; /// let hash_hello1 = [ /// 0x63u8, 0x83, 0x58, 0xab, 0x36, 0xcd, 0x0c, 0xf3, /// 0x26, 0x07, 0xb5, 0x5f, 0x0b, 0x8b, 0x45, 0xd6, @@ -447,9 +447,9 @@ pub fn tls13_hkdf_expand_label(typ: i32, key: &[u8], protocol: &[u8], label: &[u /// ```rust /// #[cfg(all(hmac, kdf_tls13))] /// { -/// use wolfssl::wolfcrypt::hmac::HMAC; -/// use wolfssl::wolfcrypt::kdf::*; -/// use wolfssl::wolfcrypt::sha::SHA256; +/// use wolfssl_wolfcrypt::hmac::HMAC; +/// use wolfssl_wolfcrypt::kdf::*; +/// use wolfssl_wolfcrypt::sha::SHA256; /// let hash_hello1 = [ /// 0x63u8, 0x83, 0x58, 0xab, 0x36, 0xcd, 0x0c, 0xf3, /// 0x26, 0x07, 0xb5, 0x5f, 0x0b, 0x8b, 0x45, 0xd6, @@ -520,8 +520,8 @@ pub fn tls13_hkdf_expand_label_ex(typ: i32, key: &[u8], protocol: &[u8], label: /// ```rust /// #[cfg(kdf_ssh)] /// { -/// use wolfssl::wolfcrypt::hmac::HMAC; -/// use wolfssl::wolfcrypt::kdf::*; +/// use wolfssl_wolfcrypt::hmac::HMAC; +/// use wolfssl_wolfcrypt::kdf::*; /// let k = [0x42u8; 256]; /// let h = [0x43u8; 32]; /// let sid = [0x44u8; 32]; @@ -569,7 +569,7 @@ pub fn ssh_kdf(typ: i32, key_id: u8, k: &[u8], h: &[u8], session_id: &[u8], key: /// ```rust /// #[cfg(kdf_srtp)] /// { -/// use wolfssl::wolfcrypt::kdf::*; +/// use wolfssl_wolfcrypt::kdf::*; /// let key = [0xc4u8, 0x80, 0x9f, 0x6d, 0x36, 0x98, 0x88, 0x72, /// 0x8e, 0x26, 0xad, 0xb5, 0x32, 0x12, 0x98, 0x90]; /// let salt = [0x0eu8, 0x23, 0x00, 0x6c, 0x6c, 0x04, 0x4f, 0x56, @@ -621,7 +621,7 @@ pub fn srtp_kdf(key: &[u8], salt: &[u8], kdr_index: i32, idx: &[u8], /// ```rust /// #[cfg(kdf_srtp)] /// { -/// use wolfssl::wolfcrypt::kdf::*; +/// use wolfssl_wolfcrypt::kdf::*; /// let key = [0xc4u8, 0x80, 0x9f, 0x6d, 0x36, 0x98, 0x88, 0x72, /// 0x8e, 0x26, 0xad, 0xb5, 0x32, 0x12, 0x98, 0x90]; /// let salt = [0x0eu8, 0x23, 0x00, 0x6c, 0x6c, 0x04, 0x4f, 0x56, @@ -669,7 +669,7 @@ pub fn srtp_kdf_label(key: &[u8], salt: &[u8], kdr_index: i32, idx: &[u8], /// ```rust /// #[cfg(kdf_srtp)] /// { -/// use wolfssl::wolfcrypt::kdf::*; +/// use wolfssl_wolfcrypt::kdf::*; /// let key = [0xc4u8, 0x80, 0x9f, 0x6d, 0x36, 0x98, 0x88, 0x72, /// 0x8e, 0x26, 0xad, 0xb5, 0x32, 0x12, 0x98, 0x90]; /// let salt = [0x0eu8, 0x23, 0x00, 0x6c, 0x6c, 0x04, 0x4f, 0x56, @@ -721,7 +721,7 @@ pub fn srtcp_kdf(key: &[u8], salt: &[u8], kdr_index: i32, idx: &[u8], /// ```rust /// #[cfg(kdf_srtp)] /// { -/// use wolfssl::wolfcrypt::kdf::*; +/// use wolfssl_wolfcrypt::kdf::*; /// let key = [0xc4u8, 0x80, 0x9f, 0x6d, 0x36, 0x98, 0x88, 0x72, /// 0x8e, 0x26, 0xad, 0xb5, 0x32, 0x12, 0x98, 0x90]; /// let salt = [0x0eu8, 0x23, 0x00, 0x6c, 0x6c, 0x04, 0x4f, 0x56, @@ -763,7 +763,7 @@ pub fn srtcp_kdf_label(key: &[u8], salt: &[u8], kdr_index: i32, idx: &[u8], /// ```rust /// #[cfg(kdf_srtp)] /// { -/// use wolfssl::wolfcrypt::kdf::*; +/// use wolfssl_wolfcrypt::kdf::*; /// let kdr_index = srtp_kdr_to_index(16); /// } /// ``` diff --git a/wrapper/rust/wolfssl/src/wolfcrypt.rs b/wrapper/rust/wolfssl-wolfcrypt/src/lib.rs similarity index 93% rename from wrapper/rust/wolfssl/src/wolfcrypt.rs rename to wrapper/rust/wolfssl-wolfcrypt/src/lib.rs index c79185880..d7c96fd66 100644 --- a/wrapper/rust/wolfssl/src/wolfcrypt.rs +++ b/wrapper/rust/wolfssl-wolfcrypt/src/lib.rs @@ -18,6 +18,9 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA */ +/* bindgen-generated bindings to the C library */ +pub mod sys; + pub mod aes; pub mod cmac; pub mod dh; @@ -32,8 +35,6 @@ pub mod random; pub mod rsa; pub mod sha; -use crate::sys; - /// Initialize resources used by wolfCrypt. /// /// # Returns @@ -44,7 +45,7 @@ use crate::sys; /// # Example /// /// ```rust -/// use wolfssl::wolfcrypt::*; +/// use wolfssl_wolfcrypt::*; /// wolfcrypt_init().expect("Error with wolfcrypt_init()"); /// ``` pub fn wolfcrypt_init() -> Result<(), i32> { @@ -65,7 +66,7 @@ pub fn wolfcrypt_init() -> Result<(), i32> { /// # Example /// /// ```rust -/// use wolfssl::wolfcrypt::*; +/// use wolfssl_wolfcrypt::*; /// wolfcrypt_cleanup().expect("Error with wolfcrypt_cleanup()"); /// ``` pub fn wolfcrypt_cleanup() -> Result<(), i32> { diff --git a/wrapper/rust/wolfssl/src/wolfcrypt/prf.rs b/wrapper/rust/wolfssl-wolfcrypt/src/prf.rs similarity index 98% rename from wrapper/rust/wolfssl/src/wolfcrypt/prf.rs rename to wrapper/rust/wolfssl-wolfcrypt/src/prf.rs index 5a88665cc..e27859ebf 100644 --- a/wrapper/rust/wolfssl/src/wolfcrypt/prf.rs +++ b/wrapper/rust/wolfssl-wolfcrypt/src/prf.rs @@ -57,7 +57,7 @@ pub const PRF_HASH_SM3: i32 = sys::wc_MACAlgorithm_sm3_mac as i32; /// ```rust /// #[cfg(sha384)] /// { -/// use wolfssl::wolfcrypt::prf::*; +/// use wolfssl_wolfcrypt::prf::*; /// let secret = [0x10u8, 0xbc, 0xb4, 0xa2, 0xe8, 0xdc, 0xf1, 0x9b, 0x4c, /// 0x51, 0x9c, 0xed, 0x31, 0x1b, 0x51, 0x57, 0x02, 0x3f, /// 0xa1, 0x7d, 0xfb, 0x0e, 0xf3, 0x4e, 0x8f, 0x6f, 0x71, @@ -101,7 +101,7 @@ pub fn prf(secret: &[u8], seed: &[u8], hash_type: i32, dout: &mut [u8]) -> Resul /// ```rust /// #[cfg(sha384)] /// { -/// use wolfssl::wolfcrypt::prf::*; +/// use wolfssl_wolfcrypt::prf::*; /// let secret = [0x10u8, 0xbc, 0xb4, 0xa2, 0xe8, 0xdc, 0xf1, 0x9b, 0x4c, /// 0x51, 0x9c, 0xed, 0x31, 0x1b, 0x51, 0x57, 0x02, 0x3f, /// 0xa1, 0x7d, 0xfb, 0x0e, 0xf3, 0x4e, 0x8f, 0x6f, 0x71, diff --git a/wrapper/rust/wolfssl/src/wolfcrypt/random.rs b/wrapper/rust/wolfssl-wolfcrypt/src/random.rs similarity index 98% rename from wrapper/rust/wolfssl/src/wolfcrypt/random.rs rename to wrapper/rust/wolfssl-wolfcrypt/src/random.rs index 820452282..9e12a5f37 100644 --- a/wrapper/rust/wolfssl/src/wolfcrypt/random.rs +++ b/wrapper/rust/wolfssl-wolfcrypt/src/random.rs @@ -28,7 +28,7 @@ wolfSSL `WC_RNG` object. It ensures proper initialization and deallocation. # Examples ```rust -use wolfssl::wolfcrypt::random::RNG; +use wolfssl_wolfcrypt::random::RNG; // Create a RNG instance. let mut rng = RNG::new().expect("Failed to create RNG"); @@ -178,7 +178,7 @@ impl RNG { /// /// ```rust /// #![cfg(random_hashdrbg)] - /// use wolfssl::wolfcrypt::random::RNG; + /// use wolfssl_wolfcrypt::random::RNG; /// let nonce = [99u8, 88, 77, 66]; /// let seed_a = [42u8, 33, 55, 88]; /// let seed_b = [45u8, 10, 20, 30]; @@ -211,7 +211,7 @@ impl RNG { /// /// ```rust /// #![cfg(random_hashdrbg)] - /// use wolfssl::wolfcrypt::random::RNG; + /// use wolfssl_wolfcrypt::random::RNG; /// let nonce = [99u8, 88, 77, 66]; /// let seed_a = [42u8, 33, 55, 88]; /// let seed_b = [45u8, 10, 20, 30]; @@ -271,7 +271,7 @@ impl RNG { /// /// ```rust /// #![cfg(random_hashdrbg)] - /// use wolfssl::wolfcrypt::random::RNG; + /// use wolfssl_wolfcrypt::random::RNG; /// let seed = [42u8, 33, 55, 88]; /// RNG::test_seed(&seed).expect("Error with test_seed()"); /// ``` @@ -344,7 +344,7 @@ impl RNG { /// /// ```rust /// #![cfg(random_hashdrbg)] - /// use wolfssl::wolfcrypt::random::RNG; + /// use wolfssl_wolfcrypt::random::RNG; /// let mut rng = RNG::new().expect("Failed to create RNG"); /// let seed = [1u8, 2, 3, 4]; /// rng.reseed(&seed).expect("Error with reseed()"); diff --git a/wrapper/rust/wolfssl/src/wolfcrypt/rsa.rs b/wrapper/rust/wolfssl-wolfcrypt/src/rsa.rs similarity index 96% rename from wrapper/rust/wolfssl/src/wolfcrypt/rsa.rs rename to wrapper/rust/wolfssl-wolfcrypt/src/rsa.rs index 05930d1d9..8b8d44f3f 100644 --- a/wrapper/rust/wolfssl/src/wolfcrypt/rsa.rs +++ b/wrapper/rust/wolfssl-wolfcrypt/src/rsa.rs @@ -31,8 +31,8 @@ wolfSSL `RsaKey` object. It ensures proper initialization and deallocation. #[cfg(random)] { use std::fs; -use wolfssl::wolfcrypt::random::RNG; -use wolfssl::wolfcrypt::rsa::RSA; +use wolfssl_wolfcrypt::random::RNG; +use wolfssl_wolfcrypt::rsa::RSA; let mut rng = RNG::new().expect("Error creating RNG"); let key_path = "../../../certs/client-keyPub.der"; @@ -60,7 +60,7 @@ assert_eq!(plain_out[0..dec_len], *plain); use crate::sys; #[cfg(random)] -use crate::wolfcrypt::random::RNG; +use crate::random::RNG; use std::mem::{MaybeUninit}; /// The `RSA` struct manages the lifecycle of a wolfSSL `RsaKey` object. @@ -140,8 +140,8 @@ impl RSA { /// #[cfg(random)] /// { /// use std::fs; - /// use wolfssl::wolfcrypt::random::RNG; - /// use wolfssl::wolfcrypt::rsa::RSA; + /// use wolfssl_wolfcrypt::random::RNG; + /// use wolfssl_wolfcrypt::rsa::RSA; /// /// let mut rng = RNG::new().expect("Error creating RNG"); /// let key_path = "../../../certs/client-keyPub.der"; @@ -187,8 +187,8 @@ impl RSA { /// #[cfg(random)] /// { /// use std::fs; - /// use wolfssl::wolfcrypt::random::RNG; - /// use wolfssl::wolfcrypt::rsa::RSA; + /// use wolfssl_wolfcrypt::random::RNG; + /// use wolfssl_wolfcrypt::rsa::RSA; /// /// let mut rng = RNG::new().expect("Error creating RNG"); /// let key_path = "../../../certs/client-keyPub.der"; @@ -255,8 +255,8 @@ impl RSA { /// #[cfg(random)] /// { /// use std::fs; - /// use wolfssl::wolfcrypt::random::RNG; - /// use wolfssl::wolfcrypt::rsa::RSA; + /// use wolfssl_wolfcrypt::random::RNG; + /// use wolfssl_wolfcrypt::rsa::RSA; /// /// let mut rng = RNG::new().expect("Error creating RNG"); /// let key_path = "../../../certs/client-keyPub.der"; @@ -302,8 +302,8 @@ impl RSA { /// #[cfg(random)] /// { /// use std::fs; - /// use wolfssl::wolfcrypt::random::RNG; - /// use wolfssl::wolfcrypt::rsa::RSA; + /// use wolfssl_wolfcrypt::random::RNG; + /// use wolfssl_wolfcrypt::rsa::RSA; /// /// let mut rng = RNG::new().expect("Error creating RNG"); /// let key_path = "../../../certs/client-keyPub.der"; @@ -382,8 +382,8 @@ impl RSA { /// ```rust /// #[cfg(rsa_keygen)] /// { - /// use wolfssl::wolfcrypt::random::RNG; - /// use wolfssl::wolfcrypt::rsa::RSA; + /// use wolfssl_wolfcrypt::random::RNG; + /// use wolfssl_wolfcrypt::rsa::RSA; /// /// let mut rng = RNG::new().expect("Error creating RNG"); /// let mut rsa = RSA::generate(2048, 65537, &mut rng).expect("Error with generate()"); @@ -429,8 +429,8 @@ impl RSA { /// ```rust /// #[cfg(rsa_keygen)] /// { - /// use wolfssl::wolfcrypt::random::RNG; - /// use wolfssl::wolfcrypt::rsa::RSA; + /// use wolfssl_wolfcrypt::random::RNG; + /// use wolfssl_wolfcrypt::rsa::RSA; /// /// let mut rng = RNG::new().expect("Error creating RNG"); /// let mut rsa = RSA::generate_ex(2048, 65537, &mut rng, None, None).expect("Error with generate_ex()"); @@ -492,8 +492,8 @@ impl RSA { /// ```rust /// #[cfg(rsa_keygen)] /// { - /// use wolfssl::wolfcrypt::random::RNG; - /// use wolfssl::wolfcrypt::rsa::RSA; + /// use wolfssl_wolfcrypt::random::RNG; + /// use wolfssl_wolfcrypt::rsa::RSA; /// /// let mut rng = RNG::new().expect("Error creating RNG"); /// let mut rsa = RSA::generate(2048, 65537, &mut rng).expect("Error with generate()"); @@ -556,8 +556,8 @@ impl RSA { /// ```rust /// #[cfg(rsa_keygen)] /// { - /// use wolfssl::wolfcrypt::random::RNG; - /// use wolfssl::wolfcrypt::rsa::RSA; + /// use wolfssl_wolfcrypt::random::RNG; + /// use wolfssl_wolfcrypt::rsa::RSA; /// /// let mut rng = RNG::new().expect("Error creating RNG"); /// let mut rsa = RSA::generate(2048, 65537, &mut rng).expect("Error with generate()"); @@ -595,8 +595,8 @@ impl RSA { /// ```rust /// #[cfg(rsa_keygen)] /// { - /// use wolfssl::wolfcrypt::random::RNG; - /// use wolfssl::wolfcrypt::rsa::RSA; + /// use wolfssl_wolfcrypt::random::RNG; + /// use wolfssl_wolfcrypt::rsa::RSA; /// /// let mut rng = RNG::new().expect("Error creating RNG"); /// let mut rsa = RSA::generate(2048, 65537, &mut rng).expect("Error with generate()"); @@ -624,8 +624,8 @@ impl RSA { /// ```rust /// #[cfg(rsa_keygen)] /// { - /// use wolfssl::wolfcrypt::random::RNG; - /// use wolfssl::wolfcrypt::rsa::RSA; + /// use wolfssl_wolfcrypt::random::RNG; + /// use wolfssl_wolfcrypt::rsa::RSA; /// /// let mut rng = RNG::new().expect("Error creating RNG"); /// let mut rsa = RSA::generate(2048, 65537, &mut rng).expect("Error with generate()"); @@ -662,8 +662,8 @@ impl RSA { /// #[cfg(random)] /// { /// use std::fs; - /// use wolfssl::wolfcrypt::random::RNG; - /// use wolfssl::wolfcrypt::rsa::RSA; + /// use wolfssl_wolfcrypt::random::RNG; + /// use wolfssl_wolfcrypt::rsa::RSA; /// /// let mut rng = RNG::new().expect("Error creating RNG"); /// let key_path = "../../../certs/client-keyPub.der"; @@ -720,8 +720,8 @@ impl RSA { /// #[cfg(random)] /// { /// use std::fs; - /// use wolfssl::wolfcrypt::random::RNG; - /// use wolfssl::wolfcrypt::rsa::RSA; + /// use wolfssl_wolfcrypt::random::RNG; + /// use wolfssl_wolfcrypt::rsa::RSA; /// /// let mut rng = RNG::new().expect("Error creating RNG"); /// let key_path = "../../../certs/client-keyPub.der"; @@ -781,8 +781,8 @@ impl RSA { /// #[cfg(all(random, rsa_pss))] /// { /// use std::fs; - /// use wolfssl::wolfcrypt::random::RNG; - /// use wolfssl::wolfcrypt::rsa::RSA; + /// use wolfssl_wolfcrypt::random::RNG; + /// use wolfssl_wolfcrypt::rsa::RSA; /// /// let mut rng = RNG::new().expect("Error creating RNG"); /// @@ -844,8 +844,8 @@ impl RSA { /// #[cfg(all(random, rsa_pss))] /// { /// use std::fs; - /// use wolfssl::wolfcrypt::random::RNG; - /// use wolfssl::wolfcrypt::rsa::RSA; + /// use wolfssl_wolfcrypt::random::RNG; + /// use wolfssl_wolfcrypt::rsa::RSA; /// /// let mut rng = RNG::new().expect("Error creating RNG"); /// @@ -910,8 +910,8 @@ impl RSA { /// #[cfg(all(random, rsa_pss))] /// { /// use std::fs; - /// use wolfssl::wolfcrypt::random::RNG; - /// use wolfssl::wolfcrypt::rsa::RSA; + /// use wolfssl_wolfcrypt::random::RNG; + /// use wolfssl_wolfcrypt::rsa::RSA; /// /// let mut rng = RNG::new().expect("Error creating RNG"); /// @@ -981,8 +981,8 @@ impl RSA { /// #[cfg(all(random, rsa_pss))] /// { /// use std::fs; - /// use wolfssl::wolfcrypt::random::RNG; - /// use wolfssl::wolfcrypt::rsa::RSA; + /// use wolfssl_wolfcrypt::random::RNG; + /// use wolfssl_wolfcrypt::rsa::RSA; /// /// let mut rng = RNG::new().expect("Error creating RNG"); /// @@ -1051,8 +1051,8 @@ impl RSA { /// #[cfg(rsa_direct)] /// { /// use std::fs; - /// use wolfssl::wolfcrypt::random::RNG; - /// use wolfssl::wolfcrypt::rsa::RSA; + /// use wolfssl_wolfcrypt::random::RNG; + /// use wolfssl_wolfcrypt::rsa::RSA; /// /// let mut rng = RNG::new().expect("Error creating RNG"); /// @@ -1108,8 +1108,8 @@ impl RSA { /// #[cfg(random)] /// { /// use std::fs; - /// use wolfssl::wolfcrypt::random::RNG; - /// use wolfssl::wolfcrypt::rsa::RSA; + /// use wolfssl_wolfcrypt::random::RNG; + /// use wolfssl_wolfcrypt::rsa::RSA; /// /// let mut rng = RNG::new().expect("Error creating RNG"); /// let key_path = "../../../certs/client-keyPub.der"; @@ -1163,8 +1163,8 @@ impl RSA { /// #[cfg(random)] /// { /// use std::fs; - /// use wolfssl::wolfcrypt::random::RNG; - /// use wolfssl::wolfcrypt::rsa::RSA; + /// use wolfssl_wolfcrypt::random::RNG; + /// use wolfssl_wolfcrypt::rsa::RSA; /// /// let mut rng = RNG::new().expect("Error creating RNG"); /// @@ -1224,8 +1224,8 @@ impl RSA { /// #[cfg(random)] /// { /// use std::fs; - /// use wolfssl::wolfcrypt::random::RNG; - /// use wolfssl::wolfcrypt::rsa::RSA; + /// use wolfssl_wolfcrypt::random::RNG; + /// use wolfssl_wolfcrypt::rsa::RSA; /// /// let mut rng = RNG::new().expect("Error creating RNG"); /// diff --git a/wrapper/rust/wolfssl/src/wolfcrypt/sha.rs b/wrapper/rust/wolfssl-wolfcrypt/src/sha.rs similarity index 95% rename from wrapper/rust/wolfssl/src/wolfcrypt/sha.rs rename to wrapper/rust/wolfssl-wolfcrypt/src/sha.rs index ff5533837..95911f8d2 100644 --- a/wrapper/rust/wolfssl/src/wolfcrypt/sha.rs +++ b/wrapper/rust/wolfssl-wolfcrypt/src/sha.rs @@ -47,7 +47,7 @@ impl SHA { /// # Example /// /// ```rust - /// use wolfssl::wolfcrypt::sha::SHA; + /// use wolfssl_wolfcrypt::sha::SHA; /// let sha = SHA::new().expect("Error with new()"); /// ``` pub fn new() -> Result { @@ -69,7 +69,7 @@ impl SHA { /// # Example /// /// ```rust - /// use wolfssl::wolfcrypt::sha::SHA; + /// use wolfssl_wolfcrypt::sha::SHA; /// let sha = SHA::new_ex(None, None).expect("Error with new_ex()"); /// ``` pub fn new_ex(heap: Option<*mut std::os::raw::c_void>, dev_id: Option) -> Result { @@ -104,7 +104,7 @@ impl SHA { /// # Example /// /// ```rust - /// use wolfssl::wolfcrypt::sha::SHA; + /// use wolfssl_wolfcrypt::sha::SHA; /// let mut sha = SHA::new().expect("Error with new()"); /// sha.init().expect("Error with init()"); /// ``` @@ -131,7 +131,7 @@ impl SHA { /// # Example /// /// ```rust - /// use wolfssl::wolfcrypt::sha::SHA; + /// use wolfssl_wolfcrypt::sha::SHA; /// let mut sha = SHA::new().expect("Error with new()"); /// sha.init_ex(None, None).expect("Error with init_ex()"); /// ``` @@ -165,7 +165,7 @@ impl SHA { /// # Example /// /// ```rust - /// use wolfssl::wolfcrypt::sha::SHA; + /// use wolfssl_wolfcrypt::sha::SHA; /// let mut sha = SHA::new().expect("Error with new()"); /// sha.update(b"input").expect("Error with update()"); /// ``` @@ -195,7 +195,7 @@ impl SHA { /// # Example /// /// ```rust - /// use wolfssl::wolfcrypt::sha::SHA; + /// use wolfssl_wolfcrypt::sha::SHA; /// let mut sha = SHA::new().expect("Error with new()"); /// sha.update(b"input").expect("Error with update()"); /// let mut hash = [0u8; SHA::DIGEST_SIZE]; @@ -250,7 +250,7 @@ impl SHA224 { /// # Example /// /// ```rust - /// use wolfssl::wolfcrypt::sha::SHA224; + /// use wolfssl_wolfcrypt::sha::SHA224; /// let sha = SHA224::new().expect("Error with new()"); /// ``` pub fn new() -> Result { @@ -272,7 +272,7 @@ impl SHA224 { /// # Example /// /// ```rust - /// use wolfssl::wolfcrypt::sha::SHA224; + /// use wolfssl_wolfcrypt::sha::SHA224; /// let sha = SHA224::new_ex(None, None).expect("Error with new_ex()"); /// ``` pub fn new_ex(heap: Option<*mut std::os::raw::c_void>, dev_id: Option) -> Result { @@ -307,7 +307,7 @@ impl SHA224 { /// # Example /// /// ```rust - /// use wolfssl::wolfcrypt::sha::SHA224; + /// use wolfssl_wolfcrypt::sha::SHA224; /// let mut sha = SHA224::new().expect("Error with new()"); /// sha.init().expect("Error with init()"); /// ``` @@ -334,7 +334,7 @@ impl SHA224 { /// # Example /// /// ```rust - /// use wolfssl::wolfcrypt::sha::SHA224; + /// use wolfssl_wolfcrypt::sha::SHA224; /// let mut sha = SHA224::new().expect("Error with new()"); /// sha.init_ex(None, None).expect("Error with init_ex()"); /// ``` @@ -368,7 +368,7 @@ impl SHA224 { /// # Example /// /// ```rust - /// use wolfssl::wolfcrypt::sha::SHA224; + /// use wolfssl_wolfcrypt::sha::SHA224; /// let mut sha = SHA224::new().expect("Error with new()"); /// sha.update(b"input").expect("Error with update()"); /// ``` @@ -398,7 +398,7 @@ impl SHA224 { /// # Example /// /// ```rust - /// use wolfssl::wolfcrypt::sha::SHA224; + /// use wolfssl_wolfcrypt::sha::SHA224; /// let mut sha = SHA224::new().expect("Error with new()"); /// sha.update(b"input").expect("Error with update()"); /// let mut hash = [0u8; SHA224::DIGEST_SIZE]; @@ -453,7 +453,7 @@ impl SHA256 { /// # Example /// /// ```rust - /// use wolfssl::wolfcrypt::sha::SHA256; + /// use wolfssl_wolfcrypt::sha::SHA256; /// let sha = SHA256::new().expect("Error with new()"); /// ``` pub fn new() -> Result { @@ -475,7 +475,7 @@ impl SHA256 { /// # Example /// /// ```rust - /// use wolfssl::wolfcrypt::sha::SHA256; + /// use wolfssl_wolfcrypt::sha::SHA256; /// let sha = SHA256::new_ex(None, None).expect("Error with new_ex()"); /// ``` pub fn new_ex(heap: Option<*mut std::os::raw::c_void>, dev_id: Option) -> Result { @@ -510,7 +510,7 @@ impl SHA256 { /// # Example /// /// ```rust - /// use wolfssl::wolfcrypt::sha::SHA256; + /// use wolfssl_wolfcrypt::sha::SHA256; /// let mut sha = SHA256::new().expect("Error with new()"); /// sha.init().expect("Error with init()"); /// ``` @@ -537,7 +537,7 @@ impl SHA256 { /// # Example /// /// ```rust - /// use wolfssl::wolfcrypt::sha::SHA256; + /// use wolfssl_wolfcrypt::sha::SHA256; /// let mut sha = SHA256::new().expect("Error with new()"); /// sha.init_ex(None, None).expect("Error with init_ex()"); /// ``` @@ -571,7 +571,7 @@ impl SHA256 { /// # Example /// /// ```rust - /// use wolfssl::wolfcrypt::sha::SHA256; + /// use wolfssl_wolfcrypt::sha::SHA256; /// let mut sha = SHA256::new().expect("Error with new()"); /// sha.update(b"input").expect("Error with update()"); /// ``` @@ -601,7 +601,7 @@ impl SHA256 { /// # Example /// /// ```rust - /// use wolfssl::wolfcrypt::sha::SHA256; + /// use wolfssl_wolfcrypt::sha::SHA256; /// let mut sha = SHA256::new().expect("Error with new()"); /// sha.update(b"input").expect("Error with update()"); /// let mut hash = [0u8; SHA256::DIGEST_SIZE]; @@ -656,7 +656,7 @@ impl SHA384 { /// # Example /// /// ```rust - /// use wolfssl::wolfcrypt::sha::SHA384; + /// use wolfssl_wolfcrypt::sha::SHA384; /// let sha = SHA384::new().expect("Error with new()"); /// ``` pub fn new() -> Result { @@ -678,7 +678,7 @@ impl SHA384 { /// # Example /// /// ```rust - /// use wolfssl::wolfcrypt::sha::SHA384; + /// use wolfssl_wolfcrypt::sha::SHA384; /// let sha = SHA384::new_ex(None, None).expect("Error with new_ex()"); /// ``` pub fn new_ex(heap: Option<*mut std::os::raw::c_void>, dev_id: Option) -> Result { @@ -713,7 +713,7 @@ impl SHA384 { /// # Example /// /// ```rust - /// use wolfssl::wolfcrypt::sha::SHA384; + /// use wolfssl_wolfcrypt::sha::SHA384; /// let mut sha = SHA384::new().expect("Error with new()"); /// sha.init().expect("Error with init()"); /// ``` @@ -740,7 +740,7 @@ impl SHA384 { /// # Example /// /// ```rust - /// use wolfssl::wolfcrypt::sha::SHA384; + /// use wolfssl_wolfcrypt::sha::SHA384; /// let mut sha = SHA384::new().expect("Error with new()"); /// sha.init_ex(None, None).expect("Error with init_ex()"); /// ``` @@ -774,7 +774,7 @@ impl SHA384 { /// # Example /// /// ```rust - /// use wolfssl::wolfcrypt::sha::SHA384; + /// use wolfssl_wolfcrypt::sha::SHA384; /// let mut sha = SHA384::new().expect("Error with new()"); /// sha.update(b"input").expect("Error with update()"); /// ``` @@ -804,7 +804,7 @@ impl SHA384 { /// # Example /// /// ```rust - /// use wolfssl::wolfcrypt::sha::SHA384; + /// use wolfssl_wolfcrypt::sha::SHA384; /// let mut sha = SHA384::new().expect("Error with new()"); /// sha.update(b"input").expect("Error with update()"); /// let mut hash = [0u8; SHA384::DIGEST_SIZE]; @@ -859,7 +859,7 @@ impl SHA512 { /// # Example /// /// ```rust - /// use wolfssl::wolfcrypt::sha::SHA512; + /// use wolfssl_wolfcrypt::sha::SHA512; /// let sha = SHA512::new().expect("Error with new()"); /// ``` pub fn new() -> Result { @@ -881,7 +881,7 @@ impl SHA512 { /// # Example /// /// ```rust - /// use wolfssl::wolfcrypt::sha::SHA512; + /// use wolfssl_wolfcrypt::sha::SHA512; /// let sha = SHA512::new_ex(None, None).expect("Error with new_ex()"); /// ``` pub fn new_ex(heap: Option<*mut std::os::raw::c_void>, dev_id: Option) -> Result { @@ -916,7 +916,7 @@ impl SHA512 { /// # Example /// /// ```rust - /// use wolfssl::wolfcrypt::sha::SHA512; + /// use wolfssl_wolfcrypt::sha::SHA512; /// let mut sha = SHA512::new().expect("Error with new()"); /// sha.init().expect("Error with init()"); /// ``` @@ -943,7 +943,7 @@ impl SHA512 { /// # Example /// /// ```rust - /// use wolfssl::wolfcrypt::sha::SHA512; + /// use wolfssl_wolfcrypt::sha::SHA512; /// let mut sha = SHA512::new().expect("Error with new()"); /// sha.init_ex(None, None).expect("Error with init_ex()"); /// ``` @@ -977,7 +977,7 @@ impl SHA512 { /// # Example /// /// ```rust - /// use wolfssl::wolfcrypt::sha::SHA512; + /// use wolfssl_wolfcrypt::sha::SHA512; /// let mut sha = SHA512::new().expect("Error with new()"); /// sha.update(b"input").expect("Error with update()"); /// ``` @@ -1007,7 +1007,7 @@ impl SHA512 { /// # Example /// /// ```rust - /// use wolfssl::wolfcrypt::sha::SHA512; + /// use wolfssl_wolfcrypt::sha::SHA512; /// let mut sha = SHA512::new().expect("Error with new()"); /// sha.update(b"input").expect("Error with update()"); /// let mut hash = [0u8; SHA512::DIGEST_SIZE]; @@ -1062,7 +1062,7 @@ impl SHA3_224 { /// # Example /// /// ```rust - /// use wolfssl::wolfcrypt::sha::SHA3_224; + /// use wolfssl_wolfcrypt::sha::SHA3_224; /// let sha = SHA3_224::new().expect("Error with new()"); /// ``` pub fn new() -> Result { @@ -1084,7 +1084,7 @@ impl SHA3_224 { /// # Example /// /// ```rust - /// use wolfssl::wolfcrypt::sha::SHA3_224; + /// use wolfssl_wolfcrypt::sha::SHA3_224; /// let sha = SHA3_224::new_ex(None, None).expect("Error with new_ex()"); /// ``` pub fn new_ex(heap: Option<*mut std::os::raw::c_void>, dev_id: Option) -> Result { @@ -1119,7 +1119,7 @@ impl SHA3_224 { /// # Example /// /// ```rust - /// use wolfssl::wolfcrypt::sha::SHA3_224; + /// use wolfssl_wolfcrypt::sha::SHA3_224; /// let mut sha = SHA3_224::new().expect("Error with new()"); /// sha.init().expect("Error with init()"); /// ``` @@ -1146,7 +1146,7 @@ impl SHA3_224 { /// # Example /// /// ```rust - /// use wolfssl::wolfcrypt::sha::SHA3_224; + /// use wolfssl_wolfcrypt::sha::SHA3_224; /// let mut sha = SHA3_224::new().expect("Error with new()"); /// sha.init_ex(None, None).expect("Error with init_ex()"); /// ``` @@ -1180,7 +1180,7 @@ impl SHA3_224 { /// # Example /// /// ```rust - /// use wolfssl::wolfcrypt::sha::SHA3_224; + /// use wolfssl_wolfcrypt::sha::SHA3_224; /// let mut sha = SHA3_224::new().expect("Error with new()"); /// sha.update(b"input").expect("Error with update()"); /// ``` @@ -1210,7 +1210,7 @@ impl SHA3_224 { /// # Example /// /// ```rust - /// use wolfssl::wolfcrypt::sha::SHA3_224; + /// use wolfssl_wolfcrypt::sha::SHA3_224; /// let mut sha = SHA3_224::new().expect("Error with new()"); /// sha.update(b"input").expect("Error with update()"); /// let mut hash = [0u8; SHA3_224::DIGEST_SIZE]; @@ -1265,7 +1265,7 @@ impl SHA3_256 { /// # Example /// /// ```rust - /// use wolfssl::wolfcrypt::sha::SHA3_256; + /// use wolfssl_wolfcrypt::sha::SHA3_256; /// let sha = SHA3_256::new().expect("Error with new()"); /// ``` pub fn new() -> Result { @@ -1287,7 +1287,7 @@ impl SHA3_256 { /// # Example /// /// ```rust - /// use wolfssl::wolfcrypt::sha::SHA3_256; + /// use wolfssl_wolfcrypt::sha::SHA3_256; /// let sha = SHA3_256::new_ex(None, None).expect("Error with new_ex()"); /// ``` pub fn new_ex(heap: Option<*mut std::os::raw::c_void>, dev_id: Option) -> Result { @@ -1322,7 +1322,7 @@ impl SHA3_256 { /// # Example /// /// ```rust - /// use wolfssl::wolfcrypt::sha::SHA3_256; + /// use wolfssl_wolfcrypt::sha::SHA3_256; /// let mut sha = SHA3_256::new().expect("Error with new()"); /// sha.init().expect("Error with init()"); /// ``` @@ -1349,7 +1349,7 @@ impl SHA3_256 { /// # Example /// /// ```rust - /// use wolfssl::wolfcrypt::sha::SHA3_256; + /// use wolfssl_wolfcrypt::sha::SHA3_256; /// let mut sha = SHA3_256::new().expect("Error with new()"); /// sha.init_ex(None, None).expect("Error with init_ex()"); /// ``` @@ -1383,7 +1383,7 @@ impl SHA3_256 { /// # Example /// /// ```rust - /// use wolfssl::wolfcrypt::sha::SHA3_256; + /// use wolfssl_wolfcrypt::sha::SHA3_256; /// let mut sha = SHA3_256::new().expect("Error with new()"); /// sha.update(b"input").expect("Error with update()"); /// ``` @@ -1413,7 +1413,7 @@ impl SHA3_256 { /// # Example /// /// ```rust - /// use wolfssl::wolfcrypt::sha::SHA3_256; + /// use wolfssl_wolfcrypt::sha::SHA3_256; /// let mut sha = SHA3_256::new().expect("Error with new()"); /// sha.update(b"input").expect("Error with update()"); /// let mut hash = [0u8; SHA3_256::DIGEST_SIZE]; @@ -1468,7 +1468,7 @@ impl SHA3_384 { /// # Example /// /// ```rust - /// use wolfssl::wolfcrypt::sha::SHA3_384; + /// use wolfssl_wolfcrypt::sha::SHA3_384; /// let sha = SHA3_384::new().expect("Error with new()"); /// ``` pub fn new() -> Result { @@ -1490,7 +1490,7 @@ impl SHA3_384 { /// # Example /// /// ```rust - /// use wolfssl::wolfcrypt::sha::SHA3_384; + /// use wolfssl_wolfcrypt::sha::SHA3_384; /// let sha = SHA3_384::new_ex(None, None).expect("Error with new_ex()"); /// ``` pub fn new_ex(heap: Option<*mut std::os::raw::c_void>, dev_id: Option) -> Result { @@ -1525,7 +1525,7 @@ impl SHA3_384 { /// # Example /// /// ```rust - /// use wolfssl::wolfcrypt::sha::SHA3_384; + /// use wolfssl_wolfcrypt::sha::SHA3_384; /// let mut sha = SHA3_384::new().expect("Error with new()"); /// sha.init().expect("Error with init()"); /// ``` @@ -1552,7 +1552,7 @@ impl SHA3_384 { /// # Example /// /// ```rust - /// use wolfssl::wolfcrypt::sha::SHA3_384; + /// use wolfssl_wolfcrypt::sha::SHA3_384; /// let mut sha = SHA3_384::new().expect("Error with new()"); /// sha.init_ex(None, None).expect("Error with init_ex()"); /// ``` @@ -1586,7 +1586,7 @@ impl SHA3_384 { /// # Example /// /// ```rust - /// use wolfssl::wolfcrypt::sha::SHA3_384; + /// use wolfssl_wolfcrypt::sha::SHA3_384; /// let mut sha = SHA3_384::new().expect("Error with new()"); /// sha.update(b"input").expect("Error with update()"); /// ``` @@ -1616,7 +1616,7 @@ impl SHA3_384 { /// # Example /// /// ```rust - /// use wolfssl::wolfcrypt::sha::SHA3_384; + /// use wolfssl_wolfcrypt::sha::SHA3_384; /// let mut sha = SHA3_384::new().expect("Error with new()"); /// sha.update(b"input").expect("Error with update()"); /// let mut hash = [0u8; SHA3_384::DIGEST_SIZE]; @@ -1671,7 +1671,7 @@ impl SHA3_512 { /// # Example /// /// ```rust - /// use wolfssl::wolfcrypt::sha::SHA3_512; + /// use wolfssl_wolfcrypt::sha::SHA3_512; /// let sha = SHA3_512::new().expect("Error with new()"); /// ``` pub fn new() -> Result { @@ -1693,7 +1693,7 @@ impl SHA3_512 { /// # Example /// /// ```rust - /// use wolfssl::wolfcrypt::sha::SHA3_512; + /// use wolfssl_wolfcrypt::sha::SHA3_512; /// let sha = SHA3_512::new_ex(None, None).expect("Error with new_ex()"); /// ``` pub fn new_ex(heap: Option<*mut std::os::raw::c_void>, dev_id: Option) -> Result { @@ -1728,7 +1728,7 @@ impl SHA3_512 { /// # Example /// /// ```rust - /// use wolfssl::wolfcrypt::sha::SHA3_512; + /// use wolfssl_wolfcrypt::sha::SHA3_512; /// let mut sha = SHA3_512::new().expect("Error with new()"); /// sha.init().expect("Error with init()"); /// ``` @@ -1755,7 +1755,7 @@ impl SHA3_512 { /// # Example /// /// ```rust - /// use wolfssl::wolfcrypt::sha::SHA3_512; + /// use wolfssl_wolfcrypt::sha::SHA3_512; /// let mut sha = SHA3_512::new().expect("Error with new()"); /// sha.init_ex(None, None).expect("Error with init_ex()"); /// ``` @@ -1789,7 +1789,7 @@ impl SHA3_512 { /// # Example /// /// ```rust - /// use wolfssl::wolfcrypt::sha::SHA3_512; + /// use wolfssl_wolfcrypt::sha::SHA3_512; /// let mut sha = SHA3_512::new().expect("Error with new()"); /// sha.update(b"input").expect("Error with update()"); /// ``` @@ -1819,7 +1819,7 @@ impl SHA3_512 { /// # Example /// /// ```rust - /// use wolfssl::wolfcrypt::sha::SHA3_512; + /// use wolfssl_wolfcrypt::sha::SHA3_512; /// let mut sha = SHA3_512::new().expect("Error with new()"); /// sha.update(b"input").expect("Error with update()"); /// let mut hash = [0u8; SHA3_512::DIGEST_SIZE]; @@ -1874,7 +1874,7 @@ impl SHAKE128 { /// # Example /// /// ```rust - /// use wolfssl::wolfcrypt::sha::SHAKE128; + /// use wolfssl_wolfcrypt::sha::SHAKE128; /// let sha = SHAKE128::new().expect("Error with new()"); /// ``` pub fn new() -> Result { @@ -1896,7 +1896,7 @@ impl SHAKE128 { /// # Example /// /// ```rust - /// use wolfssl::wolfcrypt::sha::SHAKE128; + /// use wolfssl_wolfcrypt::sha::SHAKE128; /// let sha = SHAKE128::new_ex(None, None).expect("Error with new_ex()"); /// ``` pub fn new_ex(heap: Option<*mut std::os::raw::c_void>, dev_id: Option) -> Result { @@ -1933,7 +1933,7 @@ impl SHAKE128 { /// # Example /// /// ```rust - /// use wolfssl::wolfcrypt::sha::SHAKE128; + /// use wolfssl_wolfcrypt::sha::SHAKE128; /// let mut sha = SHAKE128::new().expect("Error with new()"); /// sha.init().expect("Error with init()"); /// ``` @@ -1960,7 +1960,7 @@ impl SHAKE128 { /// # Example /// /// ```rust - /// use wolfssl::wolfcrypt::sha::SHAKE128; + /// use wolfssl_wolfcrypt::sha::SHAKE128; /// let mut sha = SHAKE128::new().expect("Error with new()"); /// sha.init_ex(None, None).expect("Error with init_ex()"); /// ``` @@ -1996,7 +1996,7 @@ impl SHAKE128 { /// # Example /// /// ```rust - /// use wolfssl::wolfcrypt::sha::SHAKE128; + /// use wolfssl_wolfcrypt::sha::SHAKE128; /// let mut sha = SHAKE128::new().expect("Error with new()"); /// sha.update(b"input").expect("Error with update()"); /// ``` @@ -2025,7 +2025,7 @@ impl SHAKE128 { /// # Example /// /// ```rust - /// use wolfssl::wolfcrypt::sha::SHAKE128; + /// use wolfssl_wolfcrypt::sha::SHAKE128; /// let mut sha = SHAKE128::new().expect("Error with new()"); /// sha.update(b"input").expect("Error with update()"); /// let mut hash = [0u8; 32]; @@ -2056,7 +2056,7 @@ impl SHAKE128 { /// # Example /// /// ```rust - /// use wolfssl::wolfcrypt::sha::SHAKE128; + /// use wolfssl_wolfcrypt::sha::SHAKE128; /// let mut sha = SHAKE128::new().expect("Error with new()"); /// sha.absorb(b"input").expect("Error with absorb()"); /// ``` @@ -2087,7 +2087,7 @@ impl SHAKE128 { /// # Example /// /// ```rust - /// use wolfssl::wolfcrypt::sha::SHAKE128; + /// use wolfssl_wolfcrypt::sha::SHAKE128; /// let mut sha = SHAKE128::new().expect("Error with new()"); /// sha.absorb(b"input").expect("Error with absorb()"); /// let mut buffer = [0u8; 2 * SHAKE128::SQUEEZE_BLOCK_SIZE]; @@ -2144,7 +2144,7 @@ impl SHAKE256 { /// # Example /// /// ```rust - /// use wolfssl::wolfcrypt::sha::SHAKE256; + /// use wolfssl_wolfcrypt::sha::SHAKE256; /// let sha = SHAKE256::new().expect("Error with new()"); /// ``` pub fn new() -> Result { @@ -2166,7 +2166,7 @@ impl SHAKE256 { /// # Example /// /// ```rust - /// use wolfssl::wolfcrypt::sha::SHAKE256; + /// use wolfssl_wolfcrypt::sha::SHAKE256; /// let sha = SHAKE256::new_ex(None, None).expect("Error with new_ex()"); /// ``` pub fn new_ex(heap: Option<*mut std::os::raw::c_void>, dev_id: Option) -> Result { @@ -2203,7 +2203,7 @@ impl SHAKE256 { /// # Example /// /// ```rust - /// use wolfssl::wolfcrypt::sha::SHAKE256; + /// use wolfssl_wolfcrypt::sha::SHAKE256; /// let mut sha = SHAKE256::new().expect("Error with new()"); /// sha.init().expect("Error with init()"); /// ``` @@ -2230,7 +2230,7 @@ impl SHAKE256 { /// # Example /// /// ```rust - /// use wolfssl::wolfcrypt::sha::SHAKE256; + /// use wolfssl_wolfcrypt::sha::SHAKE256; /// let mut sha = SHAKE256::new().expect("Error with new()"); /// sha.init_ex(None, None).expect("Error with init_ex()"); /// ``` @@ -2266,7 +2266,7 @@ impl SHAKE256 { /// # Example /// /// ```rust - /// use wolfssl::wolfcrypt::sha::SHAKE256; + /// use wolfssl_wolfcrypt::sha::SHAKE256; /// let mut sha = SHAKE256::new().expect("Error with new()"); /// sha.update(b"input").expect("Error with update()"); /// ``` @@ -2295,7 +2295,7 @@ impl SHAKE256 { /// # Example /// /// ```rust - /// use wolfssl::wolfcrypt::sha::SHAKE256; + /// use wolfssl_wolfcrypt::sha::SHAKE256; /// let mut sha = SHAKE256::new().expect("Error with new()"); /// sha.update(b"input").expect("Error with update()"); /// let mut hash = [0u8; 32]; @@ -2326,7 +2326,7 @@ impl SHAKE256 { /// # Example /// /// ```rust - /// use wolfssl::wolfcrypt::sha::SHAKE256; + /// use wolfssl_wolfcrypt::sha::SHAKE256; /// let mut sha = SHAKE256::new().expect("Error with new()"); /// sha.absorb(b"input").expect("Error with absorb()"); /// ``` @@ -2357,7 +2357,7 @@ impl SHAKE256 { /// # Example /// /// ```rust - /// use wolfssl::wolfcrypt::sha::SHAKE256; + /// use wolfssl_wolfcrypt::sha::SHAKE256; /// let mut sha = SHAKE256::new().expect("Error with new()"); /// sha.absorb(b"input").expect("Error with absorb()"); /// let mut buffer = [0u8; 2 * SHAKE256::SQUEEZE_BLOCK_SIZE]; diff --git a/wrapper/rust/wolfssl/src/sys.rs b/wrapper/rust/wolfssl-wolfcrypt/src/sys.rs similarity index 100% rename from wrapper/rust/wolfssl/src/sys.rs rename to wrapper/rust/wolfssl-wolfcrypt/src/sys.rs diff --git a/wrapper/rust/wolfssl/tests/test_aes.rs b/wrapper/rust/wolfssl-wolfcrypt/tests/test_aes.rs similarity index 99% rename from wrapper/rust/wolfssl/tests/test_aes.rs rename to wrapper/rust/wolfssl-wolfcrypt/tests/test_aes.rs index 0f58c72de..7cd15f367 100644 --- a/wrapper/rust/wolfssl/tests/test_aes.rs +++ b/wrapper/rust/wolfssl-wolfcrypt/tests/test_aes.rs @@ -1,6 +1,6 @@ #![cfg(aes)] -use wolfssl::wolfcrypt::aes::*; +use wolfssl_wolfcrypt::aes::*; const BIG_MSG: [u8; 384] = [ 0x41,0x6c,0x6c,0x20,0x77,0x6f,0x72,0x6b, diff --git a/wrapper/rust/wolfssl/tests/test_cmac.rs b/wrapper/rust/wolfssl-wolfcrypt/tests/test_cmac.rs similarity index 97% rename from wrapper/rust/wolfssl/tests/test_cmac.rs rename to wrapper/rust/wolfssl-wolfcrypt/tests/test_cmac.rs index 9858c2c96..09dabcb8b 100644 --- a/wrapper/rust/wolfssl/tests/test_cmac.rs +++ b/wrapper/rust/wolfssl-wolfcrypt/tests/test_cmac.rs @@ -1,6 +1,6 @@ #![cfg(cmac)] -use wolfssl::wolfcrypt::cmac::CMAC; +use wolfssl_wolfcrypt::cmac::CMAC; #[test] #[cfg(aes)] diff --git a/wrapper/rust/wolfssl/tests/test_dh.rs b/wrapper/rust/wolfssl-wolfcrypt/tests/test_dh.rs similarity index 99% rename from wrapper/rust/wolfssl/tests/test_dh.rs rename to wrapper/rust/wolfssl-wolfcrypt/tests/test_dh.rs index ae74ad93c..99094e658 100644 --- a/wrapper/rust/wolfssl/tests/test_dh.rs +++ b/wrapper/rust/wolfssl-wolfcrypt/tests/test_dh.rs @@ -1,9 +1,9 @@ #![cfg(dh)] #[cfg(any(all(dh_keygen, dh_ffdhe_2048), random))] -use wolfssl::wolfcrypt::dh::DH; +use wolfssl_wolfcrypt::dh::DH; #[cfg(random)] -use wolfssl::wolfcrypt::random::RNG; +use wolfssl_wolfcrypt::random::RNG; #[test] #[cfg(all(dh_keygen, dh_ffdhe_2048))] diff --git a/wrapper/rust/wolfssl/tests/test_ecc.rs b/wrapper/rust/wolfssl-wolfcrypt/tests/test_ecc.rs similarity index 99% rename from wrapper/rust/wolfssl/tests/test_ecc.rs rename to wrapper/rust/wolfssl-wolfcrypt/tests/test_ecc.rs index 29868b9af..4ff4a8529 100644 --- a/wrapper/rust/wolfssl/tests/test_ecc.rs +++ b/wrapper/rust/wolfssl-wolfcrypt/tests/test_ecc.rs @@ -2,9 +2,9 @@ #[cfg(any(all(ecc_import, ecc_export, ecc_sign, ecc_verify, random), random))] use std::fs; -use wolfssl::wolfcrypt::ecc::*; +use wolfssl_wolfcrypt::ecc::*; #[cfg(random)] -use wolfssl::wolfcrypt::random::RNG; +use wolfssl_wolfcrypt::random::RNG; #[test] #[cfg(random)] diff --git a/wrapper/rust/wolfssl/tests/test_ed25519.rs b/wrapper/rust/wolfssl-wolfcrypt/tests/test_ed25519.rs similarity index 99% rename from wrapper/rust/wolfssl/tests/test_ed25519.rs rename to wrapper/rust/wolfssl-wolfcrypt/tests/test_ed25519.rs index 880b0fc6b..a61f132e0 100644 --- a/wrapper/rust/wolfssl/tests/test_ed25519.rs +++ b/wrapper/rust/wolfssl-wolfcrypt/tests/test_ed25519.rs @@ -1,7 +1,7 @@ #![cfg(ed25519)] -use wolfssl::wolfcrypt::random::RNG; -use wolfssl::wolfcrypt::ed25519::*; +use wolfssl_wolfcrypt::random::RNG; +use wolfssl_wolfcrypt::ed25519::*; #[test] #[cfg(all(ed25519_import, ed25519_export))] diff --git a/wrapper/rust/wolfssl/tests/test_ed448.rs b/wrapper/rust/wolfssl-wolfcrypt/tests/test_ed448.rs similarity index 99% rename from wrapper/rust/wolfssl/tests/test_ed448.rs rename to wrapper/rust/wolfssl-wolfcrypt/tests/test_ed448.rs index ca26d053e..2bd5582fc 100644 --- a/wrapper/rust/wolfssl/tests/test_ed448.rs +++ b/wrapper/rust/wolfssl-wolfcrypt/tests/test_ed448.rs @@ -1,7 +1,7 @@ #![cfg(ed448)] -use wolfssl::wolfcrypt::random::RNG; -use wolfssl::wolfcrypt::ed448::*; +use wolfssl_wolfcrypt::random::RNG; +use wolfssl_wolfcrypt::ed448::*; #[test] #[cfg(all(ed448_import, ed448_export))] diff --git a/wrapper/rust/wolfssl/tests/test_hkdf.rs b/wrapper/rust/wolfssl-wolfcrypt/tests/test_hkdf.rs similarity index 92% rename from wrapper/rust/wolfssl/tests/test_hkdf.rs rename to wrapper/rust/wolfssl-wolfcrypt/tests/test_hkdf.rs index 6d66e22c7..44b25580d 100644 --- a/wrapper/rust/wolfssl/tests/test_hkdf.rs +++ b/wrapper/rust/wolfssl-wolfcrypt/tests/test_hkdf.rs @@ -1,8 +1,8 @@ #![cfg(hkdf)] -use wolfssl::wolfcrypt::hkdf::*; -use wolfssl::wolfcrypt::hmac::HMAC; -use wolfssl::wolfcrypt::sha::SHA256; +use wolfssl_wolfcrypt::hkdf::*; +use wolfssl_wolfcrypt::hmac::HMAC; +use wolfssl_wolfcrypt::sha::SHA256; #[test] fn test_hkdf_extract_expand() { diff --git a/wrapper/rust/wolfssl/tests/test_hmac.rs b/wrapper/rust/wolfssl-wolfcrypt/tests/test_hmac.rs similarity index 97% rename from wrapper/rust/wolfssl/tests/test_hmac.rs rename to wrapper/rust/wolfssl-wolfcrypt/tests/test_hmac.rs index 26bcf6aeb..6af78e1cc 100644 --- a/wrapper/rust/wolfssl/tests/test_hmac.rs +++ b/wrapper/rust/wolfssl-wolfcrypt/tests/test_hmac.rs @@ -1,7 +1,7 @@ #![cfg(hmac)] -use wolfssl::wolfcrypt::hmac::*; -use wolfssl::wolfcrypt::sha::SHA256; +use wolfssl_wolfcrypt::hmac::*; +use wolfssl_wolfcrypt::sha::SHA256; #[test] fn test_hmac_sha256() { diff --git a/wrapper/rust/wolfssl/tests/test_kdf.rs b/wrapper/rust/wolfssl-wolfcrypt/tests/test_kdf.rs similarity index 98% rename from wrapper/rust/wolfssl/tests/test_kdf.rs rename to wrapper/rust/wolfssl-wolfcrypt/tests/test_kdf.rs index 51c554e8d..e540a5244 100644 --- a/wrapper/rust/wolfssl/tests/test_kdf.rs +++ b/wrapper/rust/wolfssl-wolfcrypt/tests/test_kdf.rs @@ -1,10 +1,10 @@ #![cfg(any(kdf_srtp, all(hmac, any(kdf_pbkdf2, kdf_ssh, kdf_tls13))))] #[cfg(all(hmac, any(kdf_pbkdf2, kdf_tls13)))] -use wolfssl::wolfcrypt::hmac::HMAC; -use wolfssl::wolfcrypt::kdf::*; +use wolfssl_wolfcrypt::hmac::HMAC; +use wolfssl_wolfcrypt::kdf::*; #[cfg(all(hmac, kdf_tls13))] -use wolfssl::wolfcrypt::sha::SHA256; +use wolfssl_wolfcrypt::sha::SHA256; #[test] #[cfg(all(hmac, kdf_pbkdf2))] diff --git a/wrapper/rust/wolfssl/tests/test_prf.rs b/wrapper/rust/wolfssl-wolfcrypt/tests/test_prf.rs similarity index 97% rename from wrapper/rust/wolfssl/tests/test_prf.rs rename to wrapper/rust/wolfssl-wolfcrypt/tests/test_prf.rs index 81ae1dbce..511a8a07e 100644 --- a/wrapper/rust/wolfssl/tests/test_prf.rs +++ b/wrapper/rust/wolfssl-wolfcrypt/tests/test_prf.rs @@ -1,6 +1,6 @@ #![cfg(all(prf, sha384))] -use wolfssl::wolfcrypt::prf::*; +use wolfssl_wolfcrypt::prf::*; #[test] fn test_prf() { diff --git a/wrapper/rust/wolfssl/tests/test_random.rs b/wrapper/rust/wolfssl-wolfcrypt/tests/test_random.rs similarity index 98% rename from wrapper/rust/wolfssl/tests/test_random.rs rename to wrapper/rust/wolfssl-wolfcrypt/tests/test_random.rs index fdf7808fc..4b94ff091 100644 --- a/wrapper/rust/wolfssl/tests/test_random.rs +++ b/wrapper/rust/wolfssl-wolfcrypt/tests/test_random.rs @@ -1,6 +1,6 @@ #![cfg(random)] -use wolfssl::wolfcrypt::random::RNG; +use wolfssl_wolfcrypt::random::RNG; // Test that RNG::new() returns successfully and that drop() does not panic. #[test] diff --git a/wrapper/rust/wolfssl/tests/test_rsa.rs b/wrapper/rust/wolfssl-wolfcrypt/tests/test_rsa.rs similarity index 98% rename from wrapper/rust/wolfssl/tests/test_rsa.rs rename to wrapper/rust/wolfssl-wolfcrypt/tests/test_rsa.rs index 600cceacd..7ab9aaf9a 100644 --- a/wrapper/rust/wolfssl/tests/test_rsa.rs +++ b/wrapper/rust/wolfssl-wolfcrypt/tests/test_rsa.rs @@ -3,9 +3,9 @@ #[cfg(any(all(sha256, random, rsa_pss), random, rsa_direct))] use std::fs; #[cfg(random)] -use wolfssl::wolfcrypt::random::RNG; +use wolfssl_wolfcrypt::random::RNG; #[cfg(any(random, rsa_direct, rsa_keygen))] -use wolfssl::wolfcrypt::rsa::*; +use wolfssl_wolfcrypt::rsa::*; #[test] #[cfg(rsa_keygen)] diff --git a/wrapper/rust/wolfssl/tests/test_sha.rs b/wrapper/rust/wolfssl-wolfcrypt/tests/test_sha.rs similarity index 99% rename from wrapper/rust/wolfssl/tests/test_sha.rs rename to wrapper/rust/wolfssl-wolfcrypt/tests/test_sha.rs index eea53cd8e..eadeafc60 100644 --- a/wrapper/rust/wolfssl/tests/test_sha.rs +++ b/wrapper/rust/wolfssl-wolfcrypt/tests/test_sha.rs @@ -1,4 +1,4 @@ -use wolfssl::wolfcrypt::sha::*; +use wolfssl_wolfcrypt::sha::*; #[test] #[cfg(sha)] diff --git a/wrapper/rust/wolfssl/tests/test_wolfcrypt.rs b/wrapper/rust/wolfssl-wolfcrypt/tests/test_wolfcrypt.rs similarity index 88% rename from wrapper/rust/wolfssl/tests/test_wolfcrypt.rs rename to wrapper/rust/wolfssl-wolfcrypt/tests/test_wolfcrypt.rs index 052eef8f9..768246fd3 100644 --- a/wrapper/rust/wolfssl/tests/test_wolfcrypt.rs +++ b/wrapper/rust/wolfssl-wolfcrypt/tests/test_wolfcrypt.rs @@ -1,4 +1,4 @@ -use wolfssl::wolfcrypt::*; +use wolfssl_wolfcrypt::*; #[test] fn test_wolfcrypt_init() { diff --git a/wrapper/rust/wolfssl/src/lib.rs b/wrapper/rust/wolfssl/src/lib.rs deleted file mode 100644 index 2be221d41..000000000 --- a/wrapper/rust/wolfssl/src/lib.rs +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright (C) 2025 wolfSSL Inc. - * - * This file is part of wolfSSL. - * - * wolfSSL is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * wolfSSL is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA - */ - -pub mod wolfcrypt; -pub mod sys; From 0a469d4a4d2a12080610d73546ad792af67f662c Mon Sep 17 00:00:00 2001 From: Josh Holtrop Date: Mon, 15 Dec 2025 13:02:55 -0500 Subject: [PATCH 2/9] Avoid unused variable warning in ECCPoint test --- wrapper/rust/wolfssl-wolfcrypt/tests/test_ecc.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wrapper/rust/wolfssl-wolfcrypt/tests/test_ecc.rs b/wrapper/rust/wolfssl-wolfcrypt/tests/test_ecc.rs index 4ff4a8529..802fba29d 100644 --- a/wrapper/rust/wolfssl-wolfcrypt/tests/test_ecc.rs +++ b/wrapper/rust/wolfssl-wolfcrypt/tests/test_ecc.rs @@ -311,7 +311,7 @@ fn test_ecc_point_import_compressed() { let mut ecc = ECC::generate_ex(curve_size, &mut rng, curve_id, None, None).expect("Error with generate()"); let mut ecc_point = ecc.make_pub_to_point(Some(&mut rng), None).expect("Error with make_pub_to_point()"); let mut der = [0u8; 128]; - let size = ecc_point.export_der_compressed(&mut der, curve_id).expect("Error with export_der_compressed()"); + let _size = ecc_point.export_der_compressed(&mut der, curve_id).expect("Error with export_der_compressed()"); ecc_point.forcezero(); } From 447ba11379288ffdd2015e13db5bb9e275575cab Mon Sep 17 00:00:00 2001 From: Josh Holtrop Date: Mon, 15 Dec 2025 15:22:44 -0500 Subject: [PATCH 3/9] Add README.md in wolfssl-wolfcrypt crate directory --- wrapper/rust/README.md | 40 +++------------------ wrapper/rust/wolfssl-wolfcrypt/Cargo.toml | 1 + wrapper/rust/wolfssl-wolfcrypt/README.md | 44 +++++++++++++++++++++++ 3 files changed, 49 insertions(+), 36 deletions(-) create mode 100644 wrapper/rust/wolfssl-wolfcrypt/README.md diff --git a/wrapper/rust/README.md b/wrapper/rust/README.md index 297e87225..791ae4fd2 100644 --- a/wrapper/rust/README.md +++ b/wrapper/rust/README.md @@ -1,17 +1,11 @@ # wolfSSL Rust Wrapper The wolfSSL Rust wrapper currently consists of a single Rust crate named -`wolfssl-wolfcrypt`. This crate provides wrappers for the cryptographic -algorithms supported by wolfCrypt in the wolfSSL library. +`wolfssl-wolfcrypt`. +The `wolfssl-wolfcrypt` crate is a Rust wrapper for the wolfCrypt cryptographic +algorithms portion of the wolfSSL C library. -The `wolfssl-wolfcrypt` crate is intended to be published to -[crates.io](https://crates.io/) and can be used by including it in your -project's `Cargo.toml` file. - -It can also be built locally from within the wolfssl C library repository to -test changes to the C library using the Rust API. - -## Locally building the wolfssl-wolfcrypt crate +## Locally building and testing the wolfSSL Rust Wrapper First, configure and build wolfssl C library. @@ -30,29 +24,3 @@ Run tests with: | `/wrapper/rust` | Top level container for all Rust wrapper functionality. | | `/wrapper/rust/wolfssl-wolfcrypt` | Top level for the `wolfssl-wolfcrypt` library crate. | | `/wrapper/rust/wolfssl-wolfcrypt/src` | Source directory for `wolfssl-wolfcrypt` crate top-level modules. | - -## API Coverage - -The wolfSSL Rust wrapper provides a wrapper API for the following C library -functionality: - - * AES - * CBC, CCM, CFB, CTR, EAX, ECB, GCM, OFB, XTS - * CMAC - * DH - * ECC - * Ed448 - * Ed25519 - * HKDF - * HMAC - * PBKDF2 - * PKCS #12 PBKDF - * PRF - * RSA - * RNG - * SHA - * SHA-1, SHA-224, SHA-256, SHA-384, SHA-512, SHA3-224, SHA3-256, SHA3-384, - SHA3-512, SHAKE128, SHAKE256 - * SRTP/SRTCP KDF - * SSH KDF - * TLSv1.3 HKDF diff --git a/wrapper/rust/wolfssl-wolfcrypt/Cargo.toml b/wrapper/rust/wolfssl-wolfcrypt/Cargo.toml index 027b3f848..479c99dcd 100644 --- a/wrapper/rust/wolfssl-wolfcrypt/Cargo.toml +++ b/wrapper/rust/wolfssl-wolfcrypt/Cargo.toml @@ -8,6 +8,7 @@ repository = "https://github.com/wolfSSL/wolfssl" documentation = "https://github.com/wolfSSL/wolfssl/tree/master/wrapper/rust" keywords = ["wolfssl", "fips", "security", "encryption", "cryptography"] categories = ["cryptography", "security", "api-bindings"] +readme = "README.md" [features] std = [] diff --git a/wrapper/rust/wolfssl-wolfcrypt/README.md b/wrapper/rust/wolfssl-wolfcrypt/README.md new file mode 100644 index 000000000..87db93864 --- /dev/null +++ b/wrapper/rust/wolfssl-wolfcrypt/README.md @@ -0,0 +1,44 @@ +# wolfssl-wolfcrypt crate + +The `wolfssl-wolfcrypt` crate is a Rust wrapper for the wolfCrypt cryptographic +algorithms portion of the wolfSSL C library. + +## Installation + +The `wolfssl` C library must be installed to be used by the Rust crate. + +The `wolfssl-wolfcrypt` crate can be used by including it as a dependency in +your project's `Cargo.toml` file. + +For example: + +``` +[dependencies] +wolfssl-wolfcrypt = "1.0" +``` + +## API Coverage + +This crate provides a wrapper API for the following wolfCrypt C library +functionality: + + * AES + * CBC, CCM, CFB, CTR, EAX, ECB, GCM, OFB, XTS + * CMAC + * DH + * ECC + * Ed448 + * Ed25519 + * HKDF + * HMAC + * PBKDF2 + * PKCS #12 PBKDF + * PRF + * RSA + * RNG + * SHA + * SHA-1, SHA-224, SHA-256, SHA-384, SHA-512, SHA3-224, SHA3-256, SHA3-384, + SHA3-512, SHAKE128, SHAKE256 + * SRTP/SRTCP KDF + * SSH KDF + * TLSv1.3 HKDF From a3cc7214e769cfe7dab3436778a125c4a9ada1c0 Mon Sep 17 00:00:00 2001 From: Josh Holtrop Date: Mon, 15 Dec 2025 16:28:26 -0500 Subject: [PATCH 4/9] Update include.am for Rust crate rename --- wrapper/rust/include.am | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/wrapper/rust/include.am b/wrapper/rust/include.am index fdba62f51..5b5338e31 100644 --- a/wrapper/rust/include.am +++ b/wrapper/rust/include.am @@ -7,23 +7,24 @@ EXTRA_DIST += wrapper/rust/README.md EXTRA_DIST += wrapper/rust/wolfssl-wolfcrypt/Cargo.lock EXTRA_DIST += wrapper/rust/wolfssl-wolfcrypt/Cargo.toml EXTRA_DIST += wrapper/rust/wolfssl-wolfcrypt/Makefile +EXTRA_DIST += wrapper/rust/wolfssl-wolfcrypt/README.md EXTRA_DIST += wrapper/rust/wolfssl-wolfcrypt/build.rs EXTRA_DIST += wrapper/rust/wolfssl-wolfcrypt/headers.h +EXTRA_DIST += wrapper/rust/wolfssl-wolfcrypt/src/aes.rs +EXTRA_DIST += wrapper/rust/wolfssl-wolfcrypt/src/cmac.rs +EXTRA_DIST += wrapper/rust/wolfssl-wolfcrypt/src/dh.rs +EXTRA_DIST += wrapper/rust/wolfssl-wolfcrypt/src/ecc.rs +EXTRA_DIST += wrapper/rust/wolfssl-wolfcrypt/src/ed25519.rs +EXTRA_DIST += wrapper/rust/wolfssl-wolfcrypt/src/ed448.rs +EXTRA_DIST += wrapper/rust/wolfssl-wolfcrypt/src/hkdf.rs +EXTRA_DIST += wrapper/rust/wolfssl-wolfcrypt/src/hmac.rs +EXTRA_DIST += wrapper/rust/wolfssl-wolfcrypt/src/kdf.rs EXTRA_DIST += wrapper/rust/wolfssl-wolfcrypt/src/lib.rs -EXTRA_DIST += wrapper/rust/wolfssl-wolfcrypt/src/wolfcrypt.rs -EXTRA_DIST += wrapper/rust/wolfssl-wolfcrypt/src/wolfcrypt/aes.rs -EXTRA_DIST += wrapper/rust/wolfssl-wolfcrypt/src/wolfcrypt/cmac.rs -EXTRA_DIST += wrapper/rust/wolfssl-wolfcrypt/src/wolfcrypt/dh.rs -EXTRA_DIST += wrapper/rust/wolfssl-wolfcrypt/src/wolfcrypt/ecc.rs -EXTRA_DIST += wrapper/rust/wolfssl-wolfcrypt/src/wolfcrypt/ed25519.rs -EXTRA_DIST += wrapper/rust/wolfssl-wolfcrypt/src/wolfcrypt/ed448.rs -EXTRA_DIST += wrapper/rust/wolfssl-wolfcrypt/src/wolfcrypt/hkdf.rs -EXTRA_DIST += wrapper/rust/wolfssl-wolfcrypt/src/wolfcrypt/hmac.rs -EXTRA_DIST += wrapper/rust/wolfssl-wolfcrypt/src/wolfcrypt/kdf.rs -EXTRA_DIST += wrapper/rust/wolfssl-wolfcrypt/src/wolfcrypt/prf.rs -EXTRA_DIST += wrapper/rust/wolfssl-wolfcrypt/src/wolfcrypt/random.rs -EXTRA_DIST += wrapper/rust/wolfssl-wolfcrypt/src/wolfcrypt/rsa.rs -EXTRA_DIST += wrapper/rust/wolfssl-wolfcrypt/src/wolfcrypt/sha.rs +EXTRA_DIST += wrapper/rust/wolfssl-wolfcrypt/src/prf.rs +EXTRA_DIST += wrapper/rust/wolfssl-wolfcrypt/src/random.rs +EXTRA_DIST += wrapper/rust/wolfssl-wolfcrypt/src/rsa.rs +EXTRA_DIST += wrapper/rust/wolfssl-wolfcrypt/src/sha.rs +EXTRA_DIST += wrapper/rust/wolfssl-wolfcrypt/src/sys.rs EXTRA_DIST += wrapper/rust/wolfssl-wolfcrypt/tests/test_aes.rs EXTRA_DIST += wrapper/rust/wolfssl-wolfcrypt/tests/test_cmac.rs EXTRA_DIST += wrapper/rust/wolfssl-wolfcrypt/tests/test_dh.rs @@ -37,3 +38,4 @@ EXTRA_DIST += wrapper/rust/wolfssl-wolfcrypt/tests/test_prf.rs EXTRA_DIST += wrapper/rust/wolfssl-wolfcrypt/tests/test_random.rs EXTRA_DIST += wrapper/rust/wolfssl-wolfcrypt/tests/test_rsa.rs EXTRA_DIST += wrapper/rust/wolfssl-wolfcrypt/tests/test_sha.rs +EXTRA_DIST += wrapper/rust/wolfssl-wolfcrypt/tests/test_wolfcrypt.rs From 357b8952c6342b1728af60032f19e2b7e2323e26 Mon Sep 17 00:00:00 2001 From: Josh Holtrop Date: Tue, 16 Dec 2025 09:02:34 -0500 Subject: [PATCH 5/9] Rust crate: only set link-search and link-arg for local repo build --- wrapper/rust/wolfssl-wolfcrypt/build.rs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/wrapper/rust/wolfssl-wolfcrypt/build.rs b/wrapper/rust/wolfssl-wolfcrypt/build.rs index 5a77eab0b..a60acf182 100644 --- a/wrapper/rust/wolfssl-wolfcrypt/build.rs +++ b/wrapper/rust/wolfssl-wolfcrypt/build.rs @@ -4,7 +4,7 @@ use regex::Regex; use std::env; use std::fs; use std::io::{self, Read, Result}; -use std::path::PathBuf; +use std::path::{Path,PathBuf}; /// Perform crate build. fn main() { @@ -69,12 +69,19 @@ fn generate_bindings() -> Result<()> { /// Returns `Ok(())` if successful, or an error if any step fails. fn setup_wolfssl_link() -> Result<()> { println!("cargo:rustc-link-lib=wolfssl"); - println!("cargo:rustc-link-search={}", wolfssl_lib_dir()?); - println!("cargo:rustc-link-arg=-Wl,-rpath,{}", wolfssl_lib_dir()?); // TODO: do we need this if only a static library is built? // println!("cargo:rustc-link-lib=static=wolfssl"); + let build_in_repo = Path::new(&wolfssl_lib_dir()?).exists(); + if build_in_repo { + // When the crate is built in the wolfssl repository, link with the + // locally build wolfssl library to allow testing any local changes + // and running unit tests even if library is not installed. + println!("cargo:rustc-link-search={}", wolfssl_lib_dir()?); + println!("cargo:rustc-link-arg=-Wl,-rpath,{}", wolfssl_lib_dir()?); + } + Ok(()) } From 52e780193918513b3b2eb6a62e6f918d7a5f4a9a Mon Sep 17 00:00:00 2001 From: Josh Holtrop Date: Tue, 16 Dec 2025 09:03:10 -0500 Subject: [PATCH 6/9] Rust crate: bump version --- wrapper/rust/wolfssl-wolfcrypt/Cargo.lock | 2 +- wrapper/rust/wolfssl-wolfcrypt/Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/wrapper/rust/wolfssl-wolfcrypt/Cargo.lock b/wrapper/rust/wolfssl-wolfcrypt/Cargo.lock index 6ac43f158..8e64d5c72 100644 --- a/wrapper/rust/wolfssl-wolfcrypt/Cargo.lock +++ b/wrapper/rust/wolfssl-wolfcrypt/Cargo.lock @@ -287,7 +287,7 @@ checksum = "271414315aff87387382ec3d271b52d7ae78726f5d44ac98b4f4030c91880486" [[package]] name = "wolfssl-wolfcrypt" -version = "0.1.0" +version = "0.1.1" dependencies = [ "bindgen", "regex", diff --git a/wrapper/rust/wolfssl-wolfcrypt/Cargo.toml b/wrapper/rust/wolfssl-wolfcrypt/Cargo.toml index 479c99dcd..41d14b7fc 100644 --- a/wrapper/rust/wolfssl-wolfcrypt/Cargo.toml +++ b/wrapper/rust/wolfssl-wolfcrypt/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wolfssl-wolfcrypt" -version = "0.1.0" +version = "0.1.1" edition = "2024" description = "Rust wrapper for wolfssl C library cryptographic functionality" license = "GPL-3.0" From 95e8276d55e9e3d500386f7974a7270af42a5fe1 Mon Sep 17 00:00:00 2001 From: Josh Holtrop Date: Tue, 16 Dec 2025 09:06:07 -0500 Subject: [PATCH 7/9] Rust crate: add CHANGELOG.md --- wrapper/rust/wolfssl-wolfcrypt/CHANGELOG.md | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 wrapper/rust/wolfssl-wolfcrypt/CHANGELOG.md diff --git a/wrapper/rust/wolfssl-wolfcrypt/CHANGELOG.md b/wrapper/rust/wolfssl-wolfcrypt/CHANGELOG.md new file mode 100644 index 000000000..a482636f9 --- /dev/null +++ b/wrapper/rust/wolfssl-wolfcrypt/CHANGELOG.md @@ -0,0 +1,9 @@ +# wolfssl-wolfcrypt Change Log + +## v0.1.1 + +- Only set link-search and link-arg for local repo build + +## v0.1.0 + +- Initial test version From 37fa1581d389c5a751a9b8f0d1dbd229bdbdbca0 Mon Sep 17 00:00:00 2001 From: Josh Holtrop Date: Tue, 16 Dec 2025 10:04:15 -0500 Subject: [PATCH 8/9] Rust crate: bump version to 1.0.0 --- wrapper/rust/wolfssl-wolfcrypt/Cargo.lock | 2 +- wrapper/rust/wolfssl-wolfcrypt/Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/wrapper/rust/wolfssl-wolfcrypt/Cargo.lock b/wrapper/rust/wolfssl-wolfcrypt/Cargo.lock index 8e64d5c72..5f8e0797a 100644 --- a/wrapper/rust/wolfssl-wolfcrypt/Cargo.lock +++ b/wrapper/rust/wolfssl-wolfcrypt/Cargo.lock @@ -287,7 +287,7 @@ checksum = "271414315aff87387382ec3d271b52d7ae78726f5d44ac98b4f4030c91880486" [[package]] name = "wolfssl-wolfcrypt" -version = "0.1.1" +version = "1.0.0" dependencies = [ "bindgen", "regex", diff --git a/wrapper/rust/wolfssl-wolfcrypt/Cargo.toml b/wrapper/rust/wolfssl-wolfcrypt/Cargo.toml index 41d14b7fc..545b5d9c3 100644 --- a/wrapper/rust/wolfssl-wolfcrypt/Cargo.toml +++ b/wrapper/rust/wolfssl-wolfcrypt/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wolfssl-wolfcrypt" -version = "0.1.1" +version = "1.0.0" edition = "2024" description = "Rust wrapper for wolfssl C library cryptographic functionality" license = "GPL-3.0" From 9020373405caeb4fec391e3a2b1ad898aa2a4399 Mon Sep 17 00:00:00 2001 From: Josh Holtrop Date: Tue, 16 Dec 2025 10:08:10 -0500 Subject: [PATCH 9/9] Rust crate: update CHANGELOG for v1.0.0 --- wrapper/rust/wolfssl-wolfcrypt/CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/wrapper/rust/wolfssl-wolfcrypt/CHANGELOG.md b/wrapper/rust/wolfssl-wolfcrypt/CHANGELOG.md index a482636f9..e2b54a48a 100644 --- a/wrapper/rust/wolfssl-wolfcrypt/CHANGELOG.md +++ b/wrapper/rust/wolfssl-wolfcrypt/CHANGELOG.md @@ -1,5 +1,9 @@ # wolfssl-wolfcrypt Change Log +## v1.0.0 + +- Bump version to 1.0 after testing + ## v0.1.1 - Only set link-search and link-arg for local repo build