Skip to content

Commit

Permalink
ed448: fix build (#834)
Browse files Browse the repository at this point in the history
The crate doesn't currently have a `zeroize` feature but has code gated
under it.

This removes the code in question to fix the build until such a time as
a proper `zeroize` feature can be added.
  • Loading branch information
tarcieri authored Jul 26, 2024
1 parent 73a8922 commit 44f6c0b
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions ed448/src/pkcs8.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ impl KeypairBytes {
impl EncodePrivateKey for KeypairBytes {
fn to_pkcs8_der(&self) -> Result<SecretDocument> {
// Serialize private key as nested OCTET STRING
// TODO(tarcieri): zeroize `private_key`
let mut private_key = [0u8; 2 + (Self::BYTE_SIZE / 2)];
private_key[0] = 0x04;
private_key[1] = 0x39;
Expand All @@ -118,12 +119,7 @@ impl EncodePrivateKey for KeypairBytes {
public_key: self.public_key.as_ref().map(|pk| pk.0.as_slice()),
};

let result = SecretDocument::encode_msg(&private_key_info)?;

#[cfg(feature = "zeroize")]
private_key.zeroize();

Ok(result)
Ok(SecretDocument::encode_msg(&private_key_info)?)
}
}

Expand Down

0 comments on commit 44f6c0b

Please sign in to comment.