summaryrefslogtreecommitdiff
path: root/oox
diff options
context:
space:
mode:
authorRosemary <rosemaryseb8@gmail.com>2015-10-08 21:30:34 +0530
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2015-10-08 20:32:51 +0200
commitf8371ae1e8ac5c3a9be898095508b333d550457d (patch)
tree86352f5173c917e7819253f88878772d0235b461 /oox
parenteeba0f6db6775a459d64fb6a2e45c3bbdd451f41 (diff)
Generate random numbers for seed
Change-Id: I7527b0526a74c4d13036d58d904f2b7293c3463f
Diffstat (limited to 'oox')
-rw-r--r--oox/source/ole/vbaexport.cxx10
1 files changed, 8 insertions, 2 deletions
diff --git a/oox/source/ole/vbaexport.cxx b/oox/source/ole/vbaexport.cxx
index 97d7295fc9b2..9d423f64bc72 100644
--- a/oox/source/ole/vbaexport.cxx
+++ b/oox/source/ole/vbaexport.cxx
@@ -370,7 +370,13 @@ VBAEncryption::VBAEncryption(const sal_uInt8* pData, const sal_uInt16 length, Sv
,mnVersionEnc(0)
{
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()
@@ -412,7 +418,7 @@ void VBAEncryption::writeIgnoredEnc()
mnIgnoredLength = (mnSeed & 6) / 2;
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);
exportHexString(mrEncryptedData, nByteEnc);
mnEncryptedByte2 = mnEncryptedByte1;