Skip to content

Commit 8cd0c9b

Browse files
Rust wrapper: rename wolfssl crate to wolfssl-wolfcrypt
1 parent 52ee001 commit 8cd0c9b

38 files changed

Lines changed: 505 additions & 516 deletions

wrapper/rust/Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
.PHONY: all
22
all:
3-
+$(MAKE) -C wolfssl
3+
+$(MAKE) -C wolfssl-wolfcrypt
44

55
.PHONY: test
66
test:
7-
+$(MAKE) -C wolfssl test
7+
+$(MAKE) -C wolfssl-wolfcrypt test
88

99
.PHONY: clean
1010
clean:
11-
+$(MAKE) -C wolfssl clean
11+
+$(MAKE) -C wolfssl-wolfcrypt clean

wrapper/rust/README.md

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,17 @@
11
# wolfSSL Rust Wrapper
22

3-
## Building the wolfssl Rust Wrapper
3+
The wolfSSL Rust wrapper currently consists of a single Rust crate named
4+
`wolfssl-wolfcrypt`. This crate provides wrappers for the cryptographic
5+
algorithms supported by wolfCrypt in the wolfSSL library.
6+
7+
The `wolfssl-wolfcrypt` crate is intended to be published to
8+
[crates.io](https://crates.io/) and can be used by including it in your
9+
project's `Cargo.toml` file.
10+
11+
It can also be built locally from within the wolfssl C library repository to
12+
test changes to the C library using the Rust API.
13+
14+
## Locally building the wolfssl-wolfcrypt crate
415

516
First, configure and build wolfssl C library.
617

@@ -17,9 +28,8 @@ Run tests with:
1728
| Repository Directory | Description |
1829
| --- | --- |
1930
| `/wrapper/rust` | Top level container for all Rust wrapper functionality. |
20-
| `/wrapper/rust/wolfssl` | Top level for the `wolfssl` library crate. |
21-
| `/wrapper/rust/wolfssl/src` | Source directory for `wolfssl` crate top-level modules. |
22-
| `/wrapper/rust/wolfssl/src/wolfcrypt` | Source directory for submodules of `wolfssl::wolfcrypt` module. |
31+
| `/wrapper/rust/wolfssl-wolfcrypt` | Top level for the `wolfssl-wolfcrypt` library crate. |
32+
| `/wrapper/rust/wolfssl-wolfcrypt/src` | Source directory for `wolfssl-wolfcrypt` crate top-level modules. |
2333

2434
## API Coverage
2535

wrapper/rust/include.am

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -4,36 +4,36 @@
44

55
EXTRA_DIST += wrapper/rust/Makefile
66
EXTRA_DIST += wrapper/rust/README.md
7-
EXTRA_DIST += wrapper/rust/wolfssl/Cargo.lock
8-
EXTRA_DIST += wrapper/rust/wolfssl/Cargo.toml
9-
EXTRA_DIST += wrapper/rust/wolfssl/Makefile
10-
EXTRA_DIST += wrapper/rust/wolfssl/build.rs
11-
EXTRA_DIST += wrapper/rust/wolfssl/headers.h
12-
EXTRA_DIST += wrapper/rust/wolfssl/src/lib.rs
13-
EXTRA_DIST += wrapper/rust/wolfssl/src/wolfcrypt.rs
14-
EXTRA_DIST += wrapper/rust/wolfssl/src/wolfcrypt/aes.rs
15-
EXTRA_DIST += wrapper/rust/wolfssl/src/wolfcrypt/cmac.rs
16-
EXTRA_DIST += wrapper/rust/wolfssl/src/wolfcrypt/dh.rs
17-
EXTRA_DIST += wrapper/rust/wolfssl/src/wolfcrypt/ecc.rs
18-
EXTRA_DIST += wrapper/rust/wolfssl/src/wolfcrypt/ed25519.rs
19-
EXTRA_DIST += wrapper/rust/wolfssl/src/wolfcrypt/ed448.rs
20-
EXTRA_DIST += wrapper/rust/wolfssl/src/wolfcrypt/hkdf.rs
21-
EXTRA_DIST += wrapper/rust/wolfssl/src/wolfcrypt/hmac.rs
22-
EXTRA_DIST += wrapper/rust/wolfssl/src/wolfcrypt/kdf.rs
23-
EXTRA_DIST += wrapper/rust/wolfssl/src/wolfcrypt/prf.rs
24-
EXTRA_DIST += wrapper/rust/wolfssl/src/wolfcrypt/random.rs
25-
EXTRA_DIST += wrapper/rust/wolfssl/src/wolfcrypt/rsa.rs
26-
EXTRA_DIST += wrapper/rust/wolfssl/src/wolfcrypt/sha.rs
27-
EXTRA_DIST += wrapper/rust/wolfssl/tests/test_aes.rs
28-
EXTRA_DIST += wrapper/rust/wolfssl/tests/test_cmac.rs
29-
EXTRA_DIST += wrapper/rust/wolfssl/tests/test_dh.rs
30-
EXTRA_DIST += wrapper/rust/wolfssl/tests/test_ecc.rs
31-
EXTRA_DIST += wrapper/rust/wolfssl/tests/test_ed25519.rs
32-
EXTRA_DIST += wrapper/rust/wolfssl/tests/test_ed448.rs
33-
EXTRA_DIST += wrapper/rust/wolfssl/tests/test_hkdf.rs
34-
EXTRA_DIST += wrapper/rust/wolfssl/tests/test_hmac.rs
35-
EXTRA_DIST += wrapper/rust/wolfssl/tests/test_kdf.rs
36-
EXTRA_DIST += wrapper/rust/wolfssl/tests/test_prf.rs
37-
EXTRA_DIST += wrapper/rust/wolfssl/tests/test_random.rs
38-
EXTRA_DIST += wrapper/rust/wolfssl/tests/test_rsa.rs
39-
EXTRA_DIST += wrapper/rust/wolfssl/tests/test_sha.rs
7+
EXTRA_DIST += wrapper/rust/wolfssl-wolfcrypt/Cargo.lock
8+
EXTRA_DIST += wrapper/rust/wolfssl-wolfcrypt/Cargo.toml
9+
EXTRA_DIST += wrapper/rust/wolfssl-wolfcrypt/Makefile
10+
EXTRA_DIST += wrapper/rust/wolfssl-wolfcrypt/build.rs
11+
EXTRA_DIST += wrapper/rust/wolfssl-wolfcrypt/headers.h
12+
EXTRA_DIST += wrapper/rust/wolfssl-wolfcrypt/src/lib.rs
13+
EXTRA_DIST += wrapper/rust/wolfssl-wolfcrypt/src/wolfcrypt.rs
14+
EXTRA_DIST += wrapper/rust/wolfssl-wolfcrypt/src/wolfcrypt/aes.rs
15+
EXTRA_DIST += wrapper/rust/wolfssl-wolfcrypt/src/wolfcrypt/cmac.rs
16+
EXTRA_DIST += wrapper/rust/wolfssl-wolfcrypt/src/wolfcrypt/dh.rs
17+
EXTRA_DIST += wrapper/rust/wolfssl-wolfcrypt/src/wolfcrypt/ecc.rs
18+
EXTRA_DIST += wrapper/rust/wolfssl-wolfcrypt/src/wolfcrypt/ed25519.rs
19+
EXTRA_DIST += wrapper/rust/wolfssl-wolfcrypt/src/wolfcrypt/ed448.rs
20+
EXTRA_DIST += wrapper/rust/wolfssl-wolfcrypt/src/wolfcrypt/hkdf.rs
21+
EXTRA_DIST += wrapper/rust/wolfssl-wolfcrypt/src/wolfcrypt/hmac.rs
22+
EXTRA_DIST += wrapper/rust/wolfssl-wolfcrypt/src/wolfcrypt/kdf.rs
23+
EXTRA_DIST += wrapper/rust/wolfssl-wolfcrypt/src/wolfcrypt/prf.rs
24+
EXTRA_DIST += wrapper/rust/wolfssl-wolfcrypt/src/wolfcrypt/random.rs
25+
EXTRA_DIST += wrapper/rust/wolfssl-wolfcrypt/src/wolfcrypt/rsa.rs
26+
EXTRA_DIST += wrapper/rust/wolfssl-wolfcrypt/src/wolfcrypt/sha.rs
27+
EXTRA_DIST += wrapper/rust/wolfssl-wolfcrypt/tests/test_aes.rs
28+
EXTRA_DIST += wrapper/rust/wolfssl-wolfcrypt/tests/test_cmac.rs
29+
EXTRA_DIST += wrapper/rust/wolfssl-wolfcrypt/tests/test_dh.rs
30+
EXTRA_DIST += wrapper/rust/wolfssl-wolfcrypt/tests/test_ecc.rs
31+
EXTRA_DIST += wrapper/rust/wolfssl-wolfcrypt/tests/test_ed25519.rs
32+
EXTRA_DIST += wrapper/rust/wolfssl-wolfcrypt/tests/test_ed448.rs
33+
EXTRA_DIST += wrapper/rust/wolfssl-wolfcrypt/tests/test_hkdf.rs
34+
EXTRA_DIST += wrapper/rust/wolfssl-wolfcrypt/tests/test_hmac.rs
35+
EXTRA_DIST += wrapper/rust/wolfssl-wolfcrypt/tests/test_kdf.rs
36+
EXTRA_DIST += wrapper/rust/wolfssl-wolfcrypt/tests/test_prf.rs
37+
EXTRA_DIST += wrapper/rust/wolfssl-wolfcrypt/tests/test_random.rs
38+
EXTRA_DIST += wrapper/rust/wolfssl-wolfcrypt/tests/test_rsa.rs
39+
EXTRA_DIST += wrapper/rust/wolfssl-wolfcrypt/tests/test_sha.rs
Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
[package]
2-
name = "wolfssl"
2+
name = "wolfssl-wolfcrypt"
33
version = "0.1.0"
44
edition = "2024"
5-
description = "Rust wrapper for wolfssl C library"
5+
description = "Rust wrapper for wolfssl C library cryptographic functionality"
66
license = "GPL-3.0"
77
repository = "https://github.com/wolfSSL/wolfssl"
88
documentation = "https://github.com/wolfSSL/wolfssl/tree/master/wrapper/rust"
Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ use std::mem::{size_of_val, MaybeUninit};
3434
/// ```rust
3535
/// #[cfg(aes_cbc)]
3636
/// {
37-
/// use wolfssl::wolfcrypt::aes::CBC;
37+
/// use wolfssl_wolfcrypt::aes::CBC;
3838
/// let mut cbc = CBC::new().expect("Failed to create CBC");
3939
/// let key: &[u8; 16] = b"0123456789abcdef";
4040
/// let iv: &[u8; 16] = b"1234567890abcdef";
@@ -220,7 +220,7 @@ impl Drop for CBC {
220220
/// ```rust
221221
/// #[cfg(aes_ccm)]
222222
/// {
223-
/// use wolfssl::wolfcrypt::aes::CCM;
223+
/// use wolfssl_wolfcrypt::aes::CCM;
224224
/// let key: [u8; 16] = [
225225
/// 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7,
226226
/// 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf
@@ -415,7 +415,7 @@ impl Drop for CCM {
415415
/// ```rust
416416
/// #[cfg(aes_cfb)]
417417
/// {
418-
/// use wolfssl::wolfcrypt::aes::CFB;
418+
/// use wolfssl_wolfcrypt::aes::CFB;
419419
/// let mut cfb = CFB::new().expect("Failed to create CFB");
420420
/// let key: [u8; 16] = [
421421
/// 0x2b,0x7e,0x15,0x16,0x28,0xae,0xd2,0xa6,
@@ -722,7 +722,7 @@ impl Drop for CFB {
722722
/// ```rust
723723
/// #[cfg(aes_ctr)]
724724
/// {
725-
/// use wolfssl::wolfcrypt::aes::CTR;
725+
/// use wolfssl_wolfcrypt::aes::CTR;
726726
/// let iv: [u8; 16] = [
727727
/// 0xf0,0xf1,0xf2,0xf3,0xf4,0xf5,0xf6,0xf7,
728728
/// 0xf8,0xf9,0xfa,0xfb,0xfc,0xfd,0xfe,0xff
@@ -892,7 +892,7 @@ impl Drop for CTR {
892892
/// ```rust
893893
/// #[cfg(aes_eax)]
894894
/// {
895-
/// use wolfssl::wolfcrypt::aes::EAX;
895+
/// use wolfssl_wolfcrypt::aes::EAX;
896896
/// let key: [u8; 16] = [
897897
/// 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
898898
/// 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f
@@ -1022,7 +1022,7 @@ impl EAX {
10221022
/// ```rust
10231023
/// #[cfg(aes_ecb)]
10241024
/// {
1025-
/// use wolfssl::wolfcrypt::aes::ECB;
1025+
/// use wolfssl_wolfcrypt::aes::ECB;
10261026
/// let mut ecb = ECB::new().expect("Failed to create ECB");
10271027
/// let key_128: &[u8; 16] = b"0123456789abcdef";
10281028
/// let msg: [u8; 16] = [
@@ -1203,7 +1203,7 @@ impl Drop for ECB {
12031203
/// ```rust
12041204
/// #[cfg(aes_gcm)]
12051205
/// {
1206-
/// use wolfssl::wolfcrypt::aes::GCM;
1206+
/// use wolfssl_wolfcrypt::aes::GCM;
12071207
/// let key: [u8; 16] = [
12081208
/// 0x29, 0x8e, 0xfa, 0x1c, 0xcf, 0x29, 0xcf, 0x62,
12091209
/// 0xae, 0x68, 0x24, 0xbf, 0xc1, 0x95, 0x57, 0xfc
@@ -1398,7 +1398,7 @@ impl Drop for GCM {
13981398
/// ```rust
13991399
/// #[cfg(aes_gcm_stream)]
14001400
/// {
1401-
/// use wolfssl::wolfcrypt::aes::GCMStream;
1401+
/// use wolfssl_wolfcrypt::aes::GCMStream;
14021402
/// let plain: [u8; 60] = [
14031403
/// 0xd9, 0x31, 0x32, 0x25, 0xf8, 0x84, 0x06, 0xe5,
14041404
/// 0xa5, 0x59, 0x09, 0xc5, 0xaf, 0xf5, 0x26, 0x9a,
@@ -1678,7 +1678,7 @@ impl Drop for GCMStream {
16781678
/// ```rust
16791679
/// #[cfg(aes_ofb)]
16801680
/// {
1681-
/// use wolfssl::wolfcrypt::aes::OFB;
1681+
/// use wolfssl_wolfcrypt::aes::OFB;
16821682
/// let key: [u8; 32] = [
16831683
/// 0xc4,0xc7,0xfa,0xd6,0x53,0x5c,0xb8,0x71,
16841684
/// 0x4a,0x5c,0x40,0x77,0x9a,0x8b,0xa1,0xd2,
@@ -1863,7 +1863,7 @@ impl Drop for OFB {
18631863
/// ```rust
18641864
/// #[cfg(aes_xts)]
18651865
/// {
1866-
/// use wolfssl::wolfcrypt::aes::XTS;
1866+
/// use wolfssl_wolfcrypt::aes::XTS;
18671867
/// let key: [u8; 32] = [
18681868
/// 0xa1, 0xb9, 0x0c, 0xba, 0x3f, 0x06, 0xac, 0x35,
18691869
/// 0x3b, 0x2c, 0x34, 0x38, 0x76, 0x08, 0x17, 0x62,
@@ -2234,7 +2234,7 @@ impl Drop for XTS {
22342234
/// ```rust
22352235
/// #[cfg(aes_xts_stream)]
22362236
/// {
2237-
/// use wolfssl::wolfcrypt::aes::XTSStream;
2237+
/// use wolfssl_wolfcrypt::aes::XTSStream;
22382238
/// let keys: [u8; 32] = [
22392239
/// 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
22402240
/// 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,

wrapper/rust/wolfssl/src/wolfcrypt/cmac.rs renamed to wrapper/rust/wolfssl-wolfcrypt/src/cmac.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ impl CMAC {
5555
/// ```rust
5656
/// #[cfg(aes)]
5757
/// {
58-
/// use wolfssl::wolfcrypt::cmac::CMAC;
58+
/// use wolfssl_wolfcrypt::cmac::CMAC;
5959
/// let key = [
6060
/// 0x2bu8, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6,
6161
/// 0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c
@@ -98,7 +98,7 @@ impl CMAC {
9898
/// # Example
9999
///
100100
/// ```rust
101-
/// use wolfssl::wolfcrypt::cmac::CMAC;
101+
/// use wolfssl_wolfcrypt::cmac::CMAC;
102102
/// let key = [
103103
/// 0x2bu8, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6,
104104
/// 0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c
@@ -126,7 +126,7 @@ impl CMAC {
126126
/// # Example
127127
///
128128
/// ```rust
129-
/// use wolfssl::wolfcrypt::cmac::CMAC;
129+
/// use wolfssl_wolfcrypt::cmac::CMAC;
130130
/// let key = [
131131
/// 0x2bu8, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6,
132132
/// 0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c
@@ -176,7 +176,7 @@ impl CMAC {
176176
/// ```rust
177177
/// #[cfg(aes)]
178178
/// {
179-
/// use wolfssl::wolfcrypt::cmac::CMAC;
179+
/// use wolfssl_wolfcrypt::cmac::CMAC;
180180
/// let key = [
181181
/// 0x2bu8, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6,
182182
/// 0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c
@@ -227,7 +227,7 @@ impl CMAC {
227227
/// ```rust
228228
/// #[cfg(aes)]
229229
/// {
230-
/// use wolfssl::wolfcrypt::cmac::CMAC;
230+
/// use wolfssl_wolfcrypt::cmac::CMAC;
231231
/// let key = [
232232
/// 0x2bu8, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6,
233233
/// 0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c
@@ -280,7 +280,7 @@ impl CMAC {
280280
/// # Example
281281
///
282282
/// ```rust
283-
/// use wolfssl::wolfcrypt::cmac::CMAC;
283+
/// use wolfssl_wolfcrypt::cmac::CMAC;
284284
/// let key = [
285285
/// 0x2bu8, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6,
286286
/// 0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c
@@ -320,7 +320,7 @@ impl CMAC {
320320
/// # Example
321321
///
322322
/// ```rust
323-
/// use wolfssl::wolfcrypt::cmac::CMAC;
323+
/// use wolfssl_wolfcrypt::cmac::CMAC;
324324
/// let key = [
325325
/// 0x2bu8, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6,
326326
/// 0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c
@@ -367,7 +367,7 @@ impl CMAC {
367367
/// ```rust
368368
/// #[cfg(aes)]
369369
/// {
370-
/// use wolfssl::wolfcrypt::cmac::CMAC;
370+
/// use wolfssl_wolfcrypt::cmac::CMAC;
371371
/// let key = [
372372
/// 0x2bu8, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6,
373373
/// 0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c

0 commit comments

Comments
 (0)