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 /svl | |
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 'svl')
-rw-r--r-- | svl/source/passwordcontainer/passwordcontainer.cxx | 3 | ||||
-rw-r--r-- | svl/source/passwordcontainer/passwordcontainer.hxx | 23 |
2 files changed, 2 insertions, 24 deletions
diff --git a/svl/source/passwordcontainer/passwordcontainer.cxx b/svl/source/passwordcontainer/passwordcontainer.cxx index 4d93a8aa3a7e..538a8890516b 100644 --- a/svl/source/passwordcontainer/passwordcontainer.cxx +++ b/svl/source/passwordcontainer/passwordcontainer.cxx @@ -650,9 +650,8 @@ void SAL_CALL PasswordContainer::addPersistent( const OUString& Url, const OUStr OUString PasswordContainer::createIV() { - rtlRandomPool randomPool = mRandomPool.get(); unsigned char iv[RTL_DIGEST_LENGTH_MD5]; - if (rtl_random_getBytes(randomPool, iv, RTL_DIGEST_LENGTH_MD5) != rtl_Random_E_None) + if (rtl_random_getBytes(nullptr, iv, RTL_DIGEST_LENGTH_MD5) != rtl_Random_E_None) { throw uno::RuntimeException("rtl_random_getBytes failed"); } diff --git a/svl/source/passwordcontainer/passwordcontainer.hxx b/svl/source/passwordcontainer/passwordcontainer.hxx index 81190f689f91..4a0b4f1e46d4 100644 --- a/svl/source/passwordcontainer/passwordcontainer.hxx +++ b/svl/source/passwordcontainer/passwordcontainer.hxx @@ -245,28 +245,7 @@ private: css::uno::Reference< css::lang::XComponent > mComponent; SysCredentialsConfig mUrlContainer; - class RandomPool - { - private: - rtlRandomPool m_aRandomPool; - public: - RandomPool() : m_aRandomPool(rtl_random_createPool()) - { - } - rtlRandomPool get() - { - return m_aRandomPool; - } - ~RandomPool() - { - // Clean up random pool memory - rtl_random_destroyPool(m_aRandomPool); - } - }; - - RandomPool mRandomPool; - - OUString createIV(); + static OUString createIV(); /// @throws css::uno::RuntimeException css::uno::Sequence< css::task::UserRecord > CopyToUserRecordSequence( |