Skip to content

Commit

Permalink
Remove zeroize feature for solely the zeroize optional dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
kayabaNerve committed Nov 12, 2023
1 parent 37e7bc5 commit 23359e0
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 16 deletions.
3 changes: 1 addition & 2 deletions blake2/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ categories = ["cryptography", "no-std"]

[dependencies]
digest = { version = "0.10.7", features = ["mac"] }
zeroize_crate = { package = "zeroize", version = "1", default-features = false, optional = true }
zeroize = { version = "1", default-features = false, optional = true }

[dev-dependencies]
digest = { version = "0.10.7", features = ["dev"] }
Expand All @@ -27,4 +27,3 @@ simd = []
simd_opt = ["simd"]
simd_asm = ["simd_opt"]
size_opt = [] # Optimize for code size. Removes some `inline(always)`
zeroize = ["zeroize_crate"] # Implement ZeroizeOnDrop for Digest implementors
4 changes: 2 additions & 2 deletions blake2/src/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -246,13 +246,13 @@ macro_rules! blake2_impl {
#[cfg(feature = "zeroize")]
impl Drop for $name {
fn drop(&mut self) {
use zeroize_crate::Zeroize;
use zeroize::Zeroize;
self.h.zeroize();
self.t.zeroize();
}
}
#[cfg(feature = "zeroize")]
impl zeroize_crate::ZeroizeOnDrop for $name {}
impl zeroize::ZeroizeOnDrop for $name {}

impl fmt::Debug for $name {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
Expand Down
2 changes: 1 addition & 1 deletion blake2/src/simd/simdty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ decl_simd! {
}

#[cfg(feature = "zeroize")]
impl<T: zeroize_crate::Zeroize> zeroize_crate::Zeroize for Simd4<T> {
impl<T: zeroize::Zeroize> zeroize::Zeroize for Simd4<T> {
fn zeroize(&mut self) {
self.0.zeroize();
self.1.zeroize();
Expand Down
3 changes: 1 addition & 2 deletions sha1/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ categories = ["cryptography", "no-std"]
[dependencies]
digest = "0.10.7"
cfg-if = "1.0"
zeroize_crate = { package = "zeroize", version = "1", default-features = false, optional = true }
zeroize = { version = "1", default-features = false, optional = true }

[target.'cfg(any(target_arch = "aarch64", target_arch = "x86", target_arch = "x86_64"))'.dependencies]
cpufeatures = "0.2"
Expand All @@ -34,7 +34,6 @@ asm = ["sha1-asm"] # WARNING: this feature SHOULD NOT be enabled by library crat
loongarch64_asm = []
compress = [] # Expose compress function
force-soft = [] # Force software implementation
zeroize = ["zeroize_crate"] # Implement ZeroizeOnDrop for Digest implementors

[package.metadata.docs.rs]
all-features = true
Expand Down
4 changes: 2 additions & 2 deletions sha1/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,13 +153,13 @@ impl AlgorithmName for Sha1Core {
#[cfg(feature = "zeroize")]
impl Drop for Sha1Core {
fn drop(&mut self) {
use zeroize_crate::Zeroize;
use zeroize::Zeroize;
self.h.zeroize();
self.block_len.zeroize();
}
}
#[cfg(feature = "zeroize")]
impl zeroize_crate::ZeroizeOnDrop for Sha1Core {}
impl zeroize::ZeroizeOnDrop for Sha1Core {}

impl fmt::Debug for Sha1Core {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
Expand Down
3 changes: 1 addition & 2 deletions sha2/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ categories = ["cryptography", "no-std"]
[dependencies]
digest = "0.10.7"
cfg-if = "1.0"
zeroize_crate = { package = "zeroize", version = "1", default-features = false, optional = true }
zeroize = { version = "1", default-features = false, optional = true }

[target.'cfg(any(target_arch = "aarch64", target_arch = "x86_64", target_arch = "x86"))'.dependencies]
cpufeatures = "0.2"
Expand All @@ -38,7 +38,6 @@ loongarch64_asm = []
compress = [] # Expose compress functions
force-soft = [] # Force software implementation
asm-aarch64 = ["asm"] # DEPRECATED: use `asm` instead
zeroize = ["zeroize_crate"] # Implement ZeroizeOnDrop for Digest implementors

[package.metadata.docs.rs]
all-features = true
Expand Down
8 changes: 4 additions & 4 deletions sha2/src/core_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,13 @@ impl AlgorithmName for Sha256VarCore {
#[cfg(feature = "zeroize")]
impl Drop for Sha256VarCore {
fn drop(&mut self) {
use zeroize_crate::Zeroize;
use zeroize::Zeroize;
self.state.zeroize();
self.block_len.zeroize();
}
}
#[cfg(feature = "zeroize")]
impl zeroize_crate::ZeroizeOnDrop for Sha256VarCore {}
impl zeroize::ZeroizeOnDrop for Sha256VarCore {}

impl fmt::Debug for Sha256VarCore {
#[inline]
Expand Down Expand Up @@ -163,13 +163,13 @@ impl AlgorithmName for Sha512VarCore {
#[cfg(feature = "zeroize")]
impl Drop for Sha512VarCore {
fn drop(&mut self) {
use zeroize_crate::Zeroize;
use zeroize::Zeroize;
self.state.zeroize();
self.block_len.zeroize();
}
}
#[cfg(feature = "zeroize")]
impl zeroize_crate::ZeroizeOnDrop for Sha512VarCore {}
impl zeroize::ZeroizeOnDrop for Sha512VarCore {}

impl fmt::Debug for Sha512VarCore {
#[inline]
Expand Down
2 changes: 1 addition & 1 deletion sha3/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ hex-literal = "0.2.2"

[features]
default = ["std"]
std = ["digest/std", "zeroize?/std"]
std = ["digest/std"]

asm = ["keccak/asm"] # Enable ASM (currently ARMv8 only). WARNING: Bumps MSRV to 1.59
oid = ["digest/oid"] # Enable OID support. WARNING: Bumps MSRV to 1.57
Expand Down

0 comments on commit 23359e0

Please sign in to comment.