diff options
author | Caolán McNamara <caolan.mcnamara@collabora.com> | 2024-05-03 16:33:11 +0100 |
---|---|---|
committer | Caolán McNamara <caolan.mcnamara@collabora.com> | 2024-05-08 11:29:54 +0200 |
commit | e5aa87aeeb66a8f8068b41275d23c491f2dbd0f2 (patch) | |
tree | d3ac3b25fdbfec19e77599fd860016f661f9f5fb /sc | |
parent | 1eaae3966db362b5094feee4ac9a462ee9993d90 (diff) |
drop requirement for rtl_random_getBytes to have "Pool" arg
Seeing as since:
commit e9531b792ddf0cfc2db11713b574c5fc7ae09e2c
Date: Tue Feb 6 14:39:47 2024 +0100
sal: rtlRandomPool: require OS random device, abort if not present
Both rtl_random_createPool() and rtl_random_getBytes() first try to get
random data from the OS, via /dev/urandom or rand_s() (documented to
call RtlGenRandom(), see [1]).
we don't use the initial arg to rtl_random_getBytes anymore, drop the
requirement to have one. Then simplify our usages of that, and
addtionally deprecate rtl_random_createPool and rtl_random_destroyPool.
Change-Id: I13dcc067714a8a741a4e8f2bfcf2006373f832c4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167067
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/filter/excel/xeroot.cxx | 4 | ||||
-rw-r--r-- | sc/source/filter/excel/xestream.cxx | 4 |
2 files changed, 2 insertions, 6 deletions
diff --git a/sc/source/filter/excel/xeroot.cxx b/sc/source/filter/excel/xeroot.cxx index 3d3b4c0b922b..bcc1a7c10ce0 100644 --- a/sc/source/filter/excel/xeroot.cxx +++ b/sc/source/filter/excel/xeroot.cxx @@ -315,13 +315,11 @@ uno::Sequence< beans::NamedValue > XclExpRoot::GenerateEncryptionData( std::u16s if ( !aPass.empty() && aPass.size() < 16 ) { - rtlRandomPool aRandomPool = rtl_random_createPool (); sal_uInt8 pnDocId[16]; - if (rtl_random_getBytes(aRandomPool, pnDocId, 16) != rtl_Random_E_None) + if (rtl_random_getBytes(nullptr, pnDocId, 16) != rtl_Random_E_None) { throw uno::RuntimeException("rtl_random_getBytes failed"); } - rtl_random_destroyPool( aRandomPool ); sal_uInt16 pnPasswd[16] = {}; for( size_t nChar = 0; nChar < aPass.size(); ++nChar ) diff --git a/sc/source/filter/excel/xestream.cxx b/sc/source/filter/excel/xestream.cxx index 32cecf352de3..93c1e7bcbc35 100644 --- a/sc/source/filter/excel/xestream.cxx +++ b/sc/source/filter/excel/xestream.cxx @@ -563,12 +563,10 @@ void XclExpBiff8Encrypter::Init( const Sequence< NamedValue >& rEncryptionData ) maCodec.GetDocId( mpnDocId ); // generate the salt here - rtlRandomPool aRandomPool = rtl_random_createPool (); - if (rtl_random_getBytes(aRandomPool, mpnSalt, 16) != rtl_Random_E_None) + if (rtl_random_getBytes(nullptr, mpnSalt, 16) != rtl_Random_E_None) { throw uno::RuntimeException("rtl_random_getBytes failed"); } - rtl_random_destroyPool( aRandomPool ); memset( mpnSaltDigest, 0, sizeof( mpnSaltDigest ) ); |