Skip to content

Commit 20a8b8f

Browse files
committed
f Address comments
1 parent 43c8896 commit 20a8b8f

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/util/key_obfuscator.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@ impl KeyObfuscator {
8181
let (wrapped_nonce_bytes, wrapped_nonce_tag_bytes) = remaining.split_at(NONCE_LENGTH);
8282
let mut wrapped_nonce_tag = [0u8; TAG_LENGTH];
8383
wrapped_nonce_tag.copy_from_slice(wrapped_nonce_tag_bytes);
84-
debug_assert_eq!(wrapped_nonce_tag.len(), TAG_LENGTH);
8584

8685
// Unwrap wrapped_nonce to get nonce.
8786
let mut wrapped_nonce = [0u8; NONCE_LENGTH];

src/util/storable_builder.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,10 @@ impl<T: EntropySource> StorableBuilder<T> {
7272
let encryption_metadata = storable
7373
.encryption_metadata
7474
.ok_or_else(|| Error::new(ErrorKind::InvalidData, "Invalid Metadata"))?;
75+
76+
if encryption_metadata.nonce.len() != 12 {
77+
return Err(Error::new(ErrorKind::InvalidData, "Invalid Metadata"));
78+
}
7579
let mut nonce = [0u8; 12];
7680
nonce.copy_from_slice(&encryption_metadata.nonce);
7781

0 commit comments

Comments
 (0)