Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions src/key.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
use alloc::vec::Vec;
use core::ops::Deref;
use core::{
hash::{Hash, Hasher},
ops::Deref,
};
use num_bigint::traits::ModInverse;
use num_bigint::Sign::Plus;
use num_bigint::{BigInt, BigUint};
Expand Down Expand Up @@ -39,6 +42,7 @@ pub struct RsaPrivateKey {
pub(crate) precomputed: Option<PrecomputedValues>,
}

impl Eq for RsaPrivateKey {}
impl PartialEq for RsaPrivateKey {
#[inline]
fn eq(&self, other: &RsaPrivateKey) -> bool {
Expand All @@ -48,7 +52,13 @@ impl PartialEq for RsaPrivateKey {
}
}

impl Eq for RsaPrivateKey {}
impl Hash for RsaPrivateKey {
fn hash<H: Hasher>(&self, state: &mut H) -> () {
// Domain separator for RSA private keys
state.write(b"RsaPrivateKey");
Hash::hash(&self.pubkey_components, state);
}
}

impl Zeroize for RsaPrivateKey {
fn zeroize(&mut self) {
Expand Down