Skip to content

Commit

Permalink
Fix construction of wrapped_cek
Browse files Browse the repository at this point in the history
  • Loading branch information
bkstein committed Dec 4, 2023
1 parent ee851f5 commit 7b23a0f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions cms/src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -784,10 +784,10 @@ where
Error::Builder("Content encryption key length must not exceed 255".to_string())
})?;
let mut wrapped_cek: Vec<u8> = Vec::with_capacity(4 + padding_length);
wrapped_cek.insert(0, cek_byte_count);
wrapped_cek.insert(0xff ^ content_encryption_key[0]);
wrapped_cek.insert(0xff ^ content_encryption_key[1]);
wrapped_cek.insert(0xff ^ content_encryption_key[2]);
wrapped_cek.push(cek_byte_count);
wrapped_cek.push(0xff ^ content_encryption_key[0]);
wrapped_cek.push(0xff ^ content_encryption_key[1]);
wrapped_cek.push(0xff ^ content_encryption_key[2]);
if padding_length > 0 {
let mut padding = vec![0_u8; padding_length];
self.rng.fill_bytes(padding.as_mut_slice());
Expand Down

0 comments on commit 7b23a0f

Please sign in to comment.