Skip to content

Commit

Permalink
Added zeroization to deserialization too
Browse files Browse the repository at this point in the history
  • Loading branch information
rozbb committed Jul 5, 2024
1 parent b03f055 commit cf82654
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions crates/bonsaidb-local/src/hpke_util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,12 @@ macro_rules! impl_serde {
pub(crate) fn deserialize<'de, D: Deserializer<'de>>(
deserializer: D,
) -> Result<$t, D::Error> {
let arr = GenericArray::<u8, <$t as Serializable>::OutputSize>::deserialize(
let mut arr = GenericArray::<u8, <$t as Serializable>::OutputSize>::deserialize(
deserializer,
)?;
<$t>::from_bytes(&arr).map_err(D::Error::custom)
let ret = <$t>::from_bytes(&arr).map_err(D::Error::custom);
arr.zeroize();
ret
}
}
};
Expand Down

0 comments on commit cf82654

Please sign in to comment.