Skip to content

Commit

Permalink
fix key reuse issue in SIV generation (#487)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #487

As title. We generate a new random key for SIV generation. This is for resolving the key resue issue in AES encryption and SIV generation.

Reviewed By: xyguo

Differential Revision: D43195438

fbshipit-source-id: 57e6dfc7b87c4de1aa9f90eb81c7bb0ce7711adb
  • Loading branch information
Chen Yuan authored and facebook-github-bot committed Feb 14, 2023
1 parent 07487f1 commit 6f29481
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,10 @@ UdpUtil::localEncryption(

__m128i s2vRes;
{
__m128i sivKey = fbpcf::engine::util::getRandomM128iFromSystemNoise();
const primitive::mac::S2vFactory s2vFactory;
std::vector<unsigned char> keyByte(kBlockSize);
_mm_storeu_si128((__m128i*)keyByte.data(), prgKey);
_mm_storeu_si128((__m128i*)keyByte.data(), sivKey);
const auto s2v = s2vFactory.create(keyByte);

std::vector<unsigned char> plaintextCombined;
Expand Down

0 comments on commit 6f29481

Please sign in to comment.