Kaydet (Commit) c83b09ab authored tarafından Thorsten Behrens's avatar Thorsten Behrens Kaydeden (comit) Michael Stahl

rtlRandomPool: remove pointless seeding with system time

Change-Id: I88647a66a72d092303560a4348ce3dc55ee6c321
Reviewed-on: https://gerrit.libreoffice.org/46055Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarMichael Stahl <mstahl@redhat.com>
üst d46dc8e5
......@@ -248,10 +248,7 @@ Sequence< sal_Int8 > DocPasswordHelper::GetXLHashAsSequence(
{
uno::Sequence< sal_Int8 > aResult( nLength );
TimeValue aTime;
osl_getSystemTime( &aTime );
rtlRandomPool aRandomPool = rtl_random_createPool ();
rtl_random_addBytes ( aRandomPool, &aTime, 8 );
rtl_random_getBytes ( aRandomPool, aResult.getArray(), nLength );
rtl_random_destroyPool ( aRandomPool );
......
......@@ -436,11 +436,7 @@ uno::Sequence< beans::NamedValue > OStorageHelper::CreateGpgPackageEncryptionDat
// generate session key
// --------------------
// Get a random number generator and seed it with current timestamp
TimeValue aTime;
osl_getSystemTime( &aTime );
rtlRandomPool aRandomPool = rtl_random_createPool();
rtl_random_addBytes(aRandomPool, &aTime, 8);
// get 16 random chars out of it
uno::Sequence < sal_Int8 > aVector(16);
......
......@@ -30,10 +30,7 @@ namespace
void lclRandomGenerateValues(sal_uInt8* aArray, sal_uInt32 aSize)
{
TimeValue aTime;
osl_getSystemTime(&aTime);
rtlRandomPool aRandomPool = rtl_random_createPool();
rtl_random_addBytes(aRandomPool, &aTime, 8);
rtl_random_getBytes(aRandomPool, aArray, aSize);
rtl_random_destroyPool(aRandomPool);
}
......
......@@ -1100,11 +1100,7 @@ namespace
public:
RandomPool()
{
// Get a random number generator and seed it with current timestamp
TimeValue aTime;
osl_getSystemTime( &aTime );
m_aRandomPool = rtl_random_createPool ();
rtl_random_addBytes (m_aRandomPool, &aTime, 8);
}
rtlRandomPool get()
{
......
......@@ -314,11 +314,7 @@ uno::Sequence< beans::NamedValue > XclExpRoot::GenerateEncryptionData( const OUS
if ( !aPass.isEmpty() && aPass.getLength() < 16 )
{
TimeValue aTime;
osl_getSystemTime( &aTime );
rtlRandomPool aRandomPool = rtl_random_createPool ();
rtl_random_addBytes ( aRandomPool, &aTime, 8 );
sal_uInt8 pnDocId[16];
rtl_random_getBytes( aRandomPool, pnDocId, 16 );
......
......@@ -547,10 +547,7 @@ void XclExpBiff8Encrypter::Init( const Sequence< NamedValue >& rEncryptionData )
maCodec.GetDocId( mpnDocId );
// generate the salt here
TimeValue aTime;
osl_getSystemTime( &aTime );
rtlRandomPool aRandomPool = rtl_random_createPool ();
rtl_random_addBytes( aRandomPool, &aTime, 8 );
rtl_random_getBytes( aRandomPool, mpnSalt, 16 );
rtl_random_destroyPool( aRandomPool );
......
......@@ -3230,11 +3230,7 @@ bool SwWW8Writer::InitStd97CodecUpdateMedium( ::msfilter::MSCodec_Std97& rCodec
if ( pPasswordItem && !pPasswordItem->GetValue().isEmpty() && pPasswordItem->GetValue().getLength() <= 15 )
{
// Generate random number with a seed of time as salt.
TimeValue aTime;
osl_getSystemTime( &aTime );
rtlRandomPool aRandomPool = rtl_random_createPool ();
rtl_random_addBytes ( aRandomPool, &aTime, 8 );
sal_uInt8 pDocId[ 16 ];
rtl_random_getBytes( aRandomPool, pDocId, 16 );
......
......@@ -5589,12 +5589,7 @@ namespace
// in the MediaDescriptor
::msfilter::MSCodec_Std97 aCodec97;
// Generate random number with a seed of time as salt.
TimeValue aTime;
osl_getSystemTime( &aTime );
rtlRandomPool aRandomPool = rtl_random_createPool();
rtl_random_addBytes ( aRandomPool, &aTime, 8 );
sal_uInt8 pDocId[ 16 ];
rtl_random_getBytes( aRandomPool, pDocId, 16 );
......
......@@ -203,10 +203,7 @@ uno::Sequence< ::sal_Int8 > SAL_CALL OCipherContext::finalizeCipherContextAndDis
if ( nPaddingSize > 1 )
{
TimeValue aTime;
osl_getSystemTime( &aTime );
rtlRandomPool aRandomPool = rtl_random_createPool();
rtl_random_addBytes( aRandomPool, &aTime, 8 );
rtl_random_getBytes( aRandomPool, m_aLastBlock.getArray() + nOldLastBlockLen, nPaddingSize - 1 );
rtl_random_destroyPool ( aRandomPool );
}
......
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