Move Keypair Drop impl under Keypair impl
What changed, and why it matters
This commit simply moves an existing implementation of the Drop trait for the Keypair type to a different location in the same source file. It does not change what the code does, only where it appears in the file. There is no security impact.
No action needed; this is a non-functional refactor.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The diff relocates impl Drop for Keypair from below the LegacyPublicKey code block to immediately after the impl Keypair block. The body of the Drop implementation (self.0.non_secure_erase()) is unchanged. This is a pure code-organization/refactoring change with no functional or security difference.
Changed components
crypto/src/key.rsInspect captured patch +5 / −5
diff --git a/crypto/src/key.rs b/crypto/src/key.rs
index e601565a..673f3703 100644
--- a/crypto/src/key.rs
+++ b/crypto/src/key.rs
@@ -112,6 +112,11 @@ mod encapsulate {
pub fn as_inner(&self) -> &secp256k1::Keypair { &self.0 }
}
+ impl Drop for Keypair {
+ #[inline]
+ fn drop(&mut self) { self.0.non_secure_erase(); }
+ }
+
/// A Bitcoin ECDSA public key.
#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct LegacyPublicKey {
@@ -153,11 +158,6 @@ mod encapsulate {
pub fn compressed(&self) -> bool { self.compressed }
}
- impl Drop for Keypair {
- #[inline]
- fn drop(&mut self) { self.0.non_secure_erase(); }
- }
-
/// An always-compressed Bitcoin ECDSA public key.
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct FullPublicKey(secp256k1::PublicKey);
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.