Skip to content

Commit

Permalink
fix(dht): zeroize AEAD keys on drop (#4843)
Browse files Browse the repository at this point in the history
Description
---
Zeroizes authenticated encryption keys (via the `AuthenticatedCipherKey` struct) on drop. Fixes [issue 4842](#4842).

Motivation and Context
---
Authenticated encryption (AEAD) keys are intended to be zeroized on drop, but the relevant macros are not applied. This work adds the macros.

How Has This Been Tested?
---
Manually tested that `Zeroize` was not supported previously, and is supported now.
  • Loading branch information
AaronFeickert authored Oct 24, 2022
1 parent 3c97be4 commit 9957222
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions comms/dht/src/crypt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ use crate::{
#[derive(Debug, Clone, Zeroize)]
#[zeroize(drop)]
pub struct CipherKey(chacha20::Key);

#[derive(Debug, Clone, Zeroize)]
#[zeroize(drop)]
pub struct AuthenticatedCipherKey(chacha20poly1305::Key);

const MESSAGE_BASE_LENGTH: usize = 6000;
Expand Down

0 comments on commit 9957222

Please sign in to comment.