Skip to content

Commit bc07187

Browse files
kernel: impl Zeroize for SecretKey
1 parent c66cf41 commit bc07187

3 files changed

Lines changed: 4 additions & 1 deletion

File tree

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

kernel/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ ripemd.workspace = true
4141
serde.workspace = true
4242
sha2.workspace = true
4343
sha3.workspace = true
44+
zeroize.workspace = true
4445

4546
[dev-dependencies]
4647
criterion.workspace = true

kernel/src/main/rust/ed25519.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ use core::fmt::{Debug, Formatter, Result as FmtResult};
2929
use core::mem::transmute;
3030
use data_encoding::{DecodeError, DecodeKind, HEXUPPER};
3131
use serde::{Deserialize, Serialize};
32+
use zeroize::Zeroize;
3233

3334
// For compatibility, implementation follows eddsa-java 0.3.0
3435
// https://eprint.iacr.org/2020/1244
@@ -163,7 +164,7 @@ pub fn to_public_key(secret_key: SecretKey) -> PublicKey {
163164
PublicKey(bytes)
164165
}
165166

166-
#[derive(Clone, Copy, Default)]
167+
#[derive(Clone, Copy, Default, Zeroize)]
167168
pub struct SecretKey([u8; 32]);
168169

169170
impl AsRef<[u8]> for SecretKey {

0 commit comments

Comments
 (0)