Skip to content
This repository was archived by the owner on Nov 6, 2020. It is now read-only.

Commit 2be44de

Browse files
committed
Use random IV for ECIES AES
1 parent b45020f commit 2be44de

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

util/src/crypto.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -334,9 +334,11 @@ pub mod ecies {
334334
{
335335
let msgd = &mut msg[1..];
336336
r.public().copy_to(&mut msgd[0..64]);
337+
let iv = H128::random();
338+
iv.copy_to(&mut msgd[64..(64+16)]);
337339
{
338340
let cipher = &mut msgd[(64 + 16)..(64 + 16 + plain.len())];
339-
aes::encrypt(ekey, &H128::new(), plain, cipher);
341+
aes::encrypt(ekey, &iv, plain, cipher);
340342
}
341343
let mut hmac = Hmac::new(Sha256::new(), &mkey);
342344
{

0 commit comments

Comments
 (0)