[Libreoffice-commits] core.git: oox/source

Rosemary rosemaryseb8 at gmail.com
Thu Oct 8 11:33:24 PDT 2015


 oox/source/ole/vbaexport.cxx |   10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

New commits:
commit f8371ae1e8ac5c3a9be898095508b333d550457d
Author: Rosemary <rosemaryseb8 at gmail.com>
Date:   Thu Oct 8 21:30:34 2015 +0530

    Generate random numbers for seed
    
    Change-Id: I7527b0526a74c4d13036d58d904f2b7293c3463f

diff --git a/oox/source/ole/vbaexport.cxx b/oox/source/ole/vbaexport.cxx
index 97d7295..9d423f6 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;


More information about the Libreoffice-commits mailing list