Skip to content

Commit 15ac071

Browse files
Rust wrapper: make zeroize functions private
1 parent 2f94121 commit 15ac071

17 files changed

Lines changed: 40 additions & 54 deletions

File tree

wrapper/rust/wolfssl-wolfcrypt/src/aes.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ impl CBC {
230230
}
231231
}
232232
#[cfg(aes_cbc)]
233-
impl Zeroize for CBC {
233+
impl CBC {
234234
fn zeroize(&mut self) {
235235
unsafe { crate::zeroize_raw(&mut self.ws_aes); }
236236
}
@@ -422,7 +422,7 @@ impl CCM {
422422
}
423423
}
424424
#[cfg(aes_ccm)]
425-
impl Zeroize for CCM {
425+
impl CCM {
426426
fn zeroize(&mut self) {
427427
unsafe { crate::zeroize_raw(&mut self.ws_aes); }
428428
}
@@ -897,7 +897,7 @@ impl CFB {
897897
}
898898
}
899899
#[cfg(aes_cfb)]
900-
impl Zeroize for CFB {
900+
impl CFB {
901901
fn zeroize(&mut self) {
902902
unsafe { crate::zeroize_raw(&mut self.ws_aes); }
903903
}
@@ -1072,7 +1072,7 @@ impl CTR {
10721072
}
10731073
}
10741074
#[cfg(aes_ctr)]
1075-
impl Zeroize for CTR {
1075+
impl CTR {
10761076
fn zeroize(&mut self) {
10771077
unsafe { crate::zeroize_raw(&mut self.ws_aes); }
10781078
}
@@ -1379,7 +1379,7 @@ impl ECB {
13791379
}
13801380
}
13811381
#[cfg(aes_ecb)]
1382-
impl Zeroize for ECB {
1382+
impl ECB {
13831383
fn zeroize(&mut self) {
13841384
unsafe { crate::zeroize_raw(&mut self.ws_aes); }
13851385
}
@@ -1577,7 +1577,7 @@ impl GCM {
15771577
}
15781578
}
15791579
#[cfg(aes_gcm)]
1580-
impl Zeroize for GCM {
1580+
impl GCM {
15811581
fn zeroize(&mut self) {
15821582
unsafe { crate::zeroize_raw(&mut self.ws_aes); }
15831583
}
@@ -2037,7 +2037,7 @@ impl GCMStream {
20372037
}
20382038
}
20392039
#[cfg(aes_gcm_stream)]
2040-
impl Zeroize for GCMStream {
2040+
impl GCMStream {
20412041
fn zeroize(&mut self) {
20422042
unsafe { crate::zeroize_raw(&mut self.ws_aes); }
20432043
}
@@ -2221,7 +2221,7 @@ impl OFB {
22212221
}
22222222
}
22232223
#[cfg(aes_ofb)]
2224-
impl Zeroize for OFB {
2224+
impl OFB {
22252225
fn zeroize(&mut self) {
22262226
unsafe { crate::zeroize_raw(&mut self.ws_aes); }
22272227
}
@@ -2587,7 +2587,7 @@ impl XTS {
25872587
}
25882588
}
25892589
#[cfg(aes_xts)]
2590-
impl Zeroize for XTS {
2590+
impl XTS {
25912591
fn zeroize(&mut self) {
25922592
unsafe { crate::zeroize_raw(&mut self.ws_xtsaes); }
25932593
}
@@ -2890,7 +2890,7 @@ impl XTSStream {
28902890
}
28912891
}
28922892
#[cfg(aes_xts_stream)]
2893-
impl Zeroize for XTSStream {
2893+
impl XTSStream {
28942894
fn zeroize(&mut self) {
28952895
unsafe { crate::zeroize_raw(&mut self.ws_xtsaes); }
28962896
}

wrapper/rust/wolfssl-wolfcrypt/src/blake2.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ functionality.
2727

2828
use crate::sys;
2929
use core::mem::MaybeUninit;
30-
use zeroize::Zeroize;
3130

3231
/// Context for BLAKE2b computation.
3332
#[cfg(blake2b)]
@@ -176,7 +175,7 @@ impl BLAKE2b {
176175

177176

178177
#[cfg(blake2b)]
179-
impl Zeroize for BLAKE2b {
178+
impl BLAKE2b {
180179
fn zeroize(&mut self) {
181180
unsafe { crate::zeroize_raw(&mut self.wc_blake2b); }
182181
}
@@ -327,7 +326,7 @@ impl BLAKE2bHmac {
327326

328327

329328
#[cfg(blake2b_hmac)]
330-
impl Zeroize for BLAKE2bHmac {
329+
impl BLAKE2bHmac {
331330
fn zeroize(&mut self) {
332331
unsafe { crate::zeroize_raw(&mut self.wc_blake2b); }
333332
}
@@ -487,7 +486,7 @@ impl BLAKE2s {
487486

488487

489488
#[cfg(blake2s)]
490-
impl Zeroize for BLAKE2s {
489+
impl BLAKE2s {
491490
fn zeroize(&mut self) {
492491
unsafe { crate::zeroize_raw(&mut self.wc_blake2s); }
493492
}
@@ -637,7 +636,7 @@ impl BLAKE2sHmac {
637636
}
638637

639638
#[cfg(blake2s_hmac)]
640-
impl Zeroize for BLAKE2sHmac {
639+
impl BLAKE2sHmac {
641640
fn zeroize(&mut self) {
642641
unsafe { crate::zeroize_raw(&mut self.wc_blake2s); }
643642
}

wrapper/rust/wolfssl-wolfcrypt/src/chacha20_poly1305.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ impl ChaCha20Poly1305 {
244244
}
245245
}
246246

247-
impl Zeroize for ChaCha20Poly1305 {
247+
impl ChaCha20Poly1305 {
248248
fn zeroize(&mut self) {
249249
unsafe { crate::zeroize_raw(&mut self.wc_ccp); }
250250
}

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ Message Authentication Code (CMAC) functionality.
2727

2828
use crate::sys;
2929
use core::mem::MaybeUninit;
30-
use zeroize::Zeroize;
3130

3231
/// The `CMAC` struct manages the lifecycle of a wolfSSL `Cmac` object.
3332
///
@@ -409,7 +408,7 @@ impl CMAC {
409408
Ok(rc == 0)
410409
}
411410
}
412-
impl Zeroize for CMAC {
411+
impl CMAC {
413412
fn zeroize(&mut self) {
414413
unsafe { crate::zeroize_raw(&mut self.ws_cmac); }
415414
}

wrapper/rust/wolfssl-wolfcrypt/src/curve25519.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ functionality.
2929
use crate::random::RNG;
3030
use crate::sys;
3131
use core::mem::MaybeUninit;
32-
use zeroize::Zeroize;
3332

3433
pub struct Curve25519Key {
3534
wc_key: sys::curve25519_key,
@@ -655,7 +654,7 @@ impl Curve25519Key {
655654
}
656655
}
657656

658-
impl Zeroize for Curve25519Key {
657+
impl Curve25519Key {
659658
fn zeroize(&mut self) {
660659
unsafe { crate::zeroize_raw(&mut self.wc_key); }
661660
}

wrapper/rust/wolfssl-wolfcrypt/src/dh.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ use crate::sys;
3232
#[cfg(random)]
3333
use crate::random::RNG;
3434
use core::mem::{MaybeUninit};
35-
use zeroize::Zeroize;
3635

3736
pub struct DH {
3837
wc_dhkey: sys::DhKey,
@@ -1580,7 +1579,7 @@ impl DH {
15801579
}
15811580
}
15821581

1583-
impl Zeroize for DH {
1582+
impl DH {
15841583
fn zeroize(&mut self) {
15851584
unsafe { crate::zeroize_raw(&mut self.wc_dhkey); }
15861585
}

wrapper/rust/wolfssl-wolfcrypt/src/dilithium.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ use crate::sys;
6262
#[cfg(all(random, any(dilithium_make_key, dilithium_sign)))]
6363
use crate::random::RNG;
6464
use core::mem::MaybeUninit;
65-
use zeroize::Zeroize;
6665

6766
/// Rust wrapper for a wolfSSL `dilithium_key` object.
6867
///
@@ -1300,7 +1299,7 @@ impl Dilithium {
13001299
}
13011300
}
13021301

1303-
impl Zeroize for Dilithium {
1302+
impl Dilithium {
13041303
fn zeroize(&mut self) {
13051304
unsafe { crate::zeroize_raw(&mut self.ws_key); }
13061305
}

wrapper/rust/wolfssl-wolfcrypt/src/ecc.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ use crate::sys;
3232
#[cfg(random)]
3333
use crate::random::RNG;
3434
use core::mem::{MaybeUninit};
35-
use zeroize::Zeroize;
3635

3736
/// Rust wrapper for wolfSSL `ecc_point` object.
3837
pub struct ECCPoint {
@@ -268,7 +267,7 @@ impl ECCPoint {
268267
}
269268
}
270269

271-
impl Zeroize for ECCPoint {
270+
impl ECCPoint {
272271
fn zeroize(&mut self) {
273272
self.wc_ecc_point = core::ptr::null_mut();
274273
self.heap = core::ptr::null_mut();
@@ -1966,7 +1965,7 @@ impl ECC {
19661965
}
19671966
}
19681967

1969-
impl Zeroize for ECC {
1968+
impl ECC {
19701969
fn zeroize(&mut self) {
19711970
unsafe { crate::zeroize_raw(&mut self.wc_ecc_key); }
19721971
}

wrapper/rust/wolfssl-wolfcrypt/src/ed25519.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ This module provides a Rust wrapper for the wolfCrypt library's EdDSA Curve
2828
use crate::sys;
2929
use crate::random::RNG;
3030
use core::mem::MaybeUninit;
31-
use zeroize::Zeroize;
3231

3332
/// The `Ed25519` struct manages the lifecycle of a wolfSSL `ed25519_key`
3433
/// object.
@@ -1431,7 +1430,7 @@ impl Ed25519 {
14311430
}
14321431
}
14331432

1434-
impl Zeroize for Ed25519 {
1433+
impl Ed25519 {
14351434
fn zeroize(&mut self) {
14361435
unsafe { crate::zeroize_raw(&mut self.ws_key); }
14371436
}

wrapper/rust/wolfssl-wolfcrypt/src/ed448.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ This module provides a Rust wrapper for the wolfCrypt library's EdDSA Curve
2828
use crate::sys;
2929
use crate::random::RNG;
3030
use core::mem::MaybeUninit;
31-
use zeroize::Zeroize;
3231

3332
/// The `Ed448` struct manages the lifecycle of a wolfSSL `ed448_key`
3433
/// object.
@@ -1356,7 +1355,7 @@ impl Ed448 {
13561355
}
13571356
}
13581357

1359-
impl Zeroize for Ed448 {
1358+
impl Ed448 {
13601359
fn zeroize(&mut self) {
13611360
unsafe { crate::zeroize_raw(&mut self.ws_key); }
13621361
}

0 commit comments

Comments
 (0)