Kaydet (Commit) f8371ae1 authored tarafından Rosemary's avatar Rosemary Kaydeden (comit) Markus Mohrhard

Generate random numbers for seed

Change-Id: I7527b0526a74c4d13036d58d904f2b7293c3463f
üst eeba0f6d
...@@ -370,7 +370,13 @@ VBAEncryption::VBAEncryption(const sal_uInt8* pData, const sal_uInt16 length, Sv ...@@ -370,7 +370,13 @@ VBAEncryption::VBAEncryption(const sal_uInt8* pData, const sal_uInt16 length, Sv
,mnVersionEnc(0) ,mnVersionEnc(0)
{ {
if (!pSeed) if (!pSeed)
mnSeed = 0xBE; // sample seed value TODO:Generate random seed values {
// mnSeed = 0xBE;
std::random_device rd;
std::mt19937 gen(rd());
std::uniform_int_distribution<> dis(0, 255);
mnSeed = dis(gen);
}
} }
void VBAEncryption::writeSeed() void VBAEncryption::writeSeed()
...@@ -412,7 +418,7 @@ void VBAEncryption::writeIgnoredEnc() ...@@ -412,7 +418,7 @@ void VBAEncryption::writeIgnoredEnc()
mnIgnoredLength = (mnSeed & 6) / 2; mnIgnoredLength = (mnSeed & 6) / 2;
for(sal_Int32 i = 1; i <= mnIgnoredLength; ++i) for(sal_Int32 i = 1; i <= mnIgnoredLength; ++i)
{ {
sal_uInt8 nTempValue = 0xBE; // TODO:Generate a random value sal_uInt8 nTempValue = 0xBE; // Any value can be assigned here
sal_uInt8 nByteEnc = nTempValue ^ (mnEncryptedByte2 + mnUnencryptedByte1); sal_uInt8 nByteEnc = nTempValue ^ (mnEncryptedByte2 + mnUnencryptedByte1);
exportHexString(mrEncryptedData, nByteEnc); exportHexString(mrEncryptedData, nByteEnc);
mnEncryptedByte2 = mnEncryptedByte1; mnEncryptedByte2 = mnEncryptedByte1;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment