Merge pull request #9542 from holtrop-wolfssl/rust-wolfssl-wolfcrypt-crate

Create wolfssl-wolfcrypt Rust crate
This commit is contained in:
JacobBarthelmeh
2025-12-17 12:17:51 -07:00
committed by GitHub
40 changed files with 572 additions and 548 deletions

View File

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

View File

@@ -1,6 +1,11 @@
# wolfSSL Rust Wrapper
## Building the wolfssl Rust Wrapper
The wolfSSL Rust wrapper currently consists of a single Rust crate named
`wolfssl-wolfcrypt`.
The `wolfssl-wolfcrypt` crate is a Rust wrapper for the wolfCrypt cryptographic
algorithms portion of the wolfSSL C library.
## Locally building and testing the wolfSSL Rust Wrapper
First, configure and build wolfssl C library.
@@ -17,32 +22,5 @@ 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. |
## 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
| `/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. |

View File

@@ -4,36 +4,38 @@
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/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/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
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
EXTRA_DIST += wrapper/rust/wolfssl-wolfcrypt/tests/test_wolfcrypt.rs

View File

@@ -0,0 +1,13 @@
# 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
## v0.1.0
- Initial test version

View File

@@ -286,8 +286,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "271414315aff87387382ec3d271b52d7ae78726f5d44ac98b4f4030c91880486"
[[package]]
name = "wolfssl"
version = "0.1.0"
name = "wolfssl-wolfcrypt"
version = "1.0.0"
dependencies = [
"bindgen",
"regex",

View File

@@ -1,13 +1,14 @@
[package]
name = "wolfssl"
version = "0.1.0"
name = "wolfssl-wolfcrypt"
version = "1.0.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"
keywords = ["wolfssl", "fips", "security", "encryption", "cryptography"]
categories = ["cryptography", "security", "api-bindings"]
readme = "README.md"
[features]
std = []

View File

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

View File

@@ -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(())
}

View File

@@ -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,

View File

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

View File

@@ -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];

View File

@@ -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<u8> = 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<u8> = 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<u8> = 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<u8> = 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];

View File

@@ -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<Self, i32> {
@@ -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<i32>) -> Result<Self, i32> {
@@ -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()");

View File

@@ -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<Self, i32> {
@@ -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<i32>) -> Result<Self, i32> {
@@ -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()");

View File

@@ -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";

View File

@@ -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()");

View File

@@ -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);
/// }
/// ```

View File

@@ -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> {

View File

@@ -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,

View File

@@ -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()");

View File

@@ -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");
///

View File

@@ -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<Self, i32> {
@@ -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<i32>) -> Result<Self, i32> {
@@ -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<Self, i32> {
@@ -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<i32>) -> Result<Self, i32> {
@@ -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<Self, i32> {
@@ -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<i32>) -> Result<Self, i32> {
@@ -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<Self, i32> {
@@ -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<i32>) -> Result<Self, i32> {
@@ -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<Self, i32> {
@@ -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<i32>) -> Result<Self, i32> {
@@ -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<Self, i32> {
@@ -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<i32>) -> Result<Self, i32> {
@@ -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<Self, i32> {
@@ -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<i32>) -> Result<Self, i32> {
@@ -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<Self, i32> {
@@ -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<i32>) -> Result<Self, i32> {
@@ -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<Self, i32> {
@@ -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<i32>) -> Result<Self, i32> {
@@ -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<Self, i32> {
@@ -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<i32>) -> Result<Self, i32> {
@@ -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<Self, i32> {
@@ -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<i32>) -> Result<Self, i32> {
@@ -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];

View File

@@ -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,

View File

@@ -1,6 +1,6 @@
#![cfg(cmac)]
use wolfssl::wolfcrypt::cmac::CMAC;
use wolfssl_wolfcrypt::cmac::CMAC;
#[test]
#[cfg(aes)]

View File

@@ -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))]

View File

@@ -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)]
@@ -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();
}

View File

@@ -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))]

View File

@@ -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))]

View File

@@ -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() {

View File

@@ -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() {

View File

@@ -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))]

View File

@@ -1,6 +1,6 @@
#![cfg(all(prf, sha384))]
use wolfssl::wolfcrypt::prf::*;
use wolfssl_wolfcrypt::prf::*;
#[test]
fn test_prf() {

View File

@@ -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]

View File

@@ -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)]

View File

@@ -1,4 +1,4 @@
use wolfssl::wolfcrypt::sha::*;
use wolfssl_wolfcrypt::sha::*;
#[test]
#[cfg(sha)]

View File

@@ -1,4 +1,4 @@
use wolfssl::wolfcrypt::*;
use wolfssl_wolfcrypt::*;
#[test]
fn test_wolfcrypt_init() {

View File

@@ -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;