Skip to content

Commit 57e2660

Browse files
committed
Merge openssl AES key-wrap IV fix (upstream PR: thisiscam#1)
2 parents 9919063 + 6b64772 commit 57e2660

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/util.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1588,7 +1588,7 @@ pub fn rfc6637_wrap_key<T: HasPublic>(public_key: &CompactECKey<T>, key: &[u8],
15881588
*i = padding_count as u8;
15891589
}
15901590

1591-
let mut c = Crypter::new(Cipher::from_nid(Nid::ID_AES128_WRAP).unwrap(), Mode::Encrypt, &aes_key[..16], None)?;
1591+
let mut c = Crypter::new(Cipher::from_nid(Nid::ID_AES128_WRAP).unwrap(), Mode::Encrypt, &aes_key[..16], Some(&[0xa6u8; 8]))?;
15921592
let mut out = vec![0u8; message.len() + 16];
15931593

15941594
let mut count = c.update(&message, &mut out)?;
@@ -1618,7 +1618,7 @@ pub fn rfc6637_unwrap_key(private_key: &CompactECKey<Private>, wrapped_key: &[u8
16181618
// RFC6637 KDF
16191619
let hash = rfc6637_kdf(fingerprint, &secret);
16201620

1621-
let unwrapped = decrypt(Cipher::from_nid(Nid::ID_AES128_WRAP).unwrap(), &hash[..16], None, &unpacked.wrapped)?;
1621+
let unwrapped = decrypt(Cipher::from_nid(Nid::ID_AES128_WRAP).unwrap(), &hash[..16], Some(&[0xa6u8; 8]), &unpacked.wrapped)?;
16221622

16231623
let padding_len = *unwrapped.last().unwrap() as usize;
16241624
for i in 0..padding_len {

0 commit comments

Comments
 (0)