diff options
author | Caolán McNamara <caolan.mcnamara@collabora.com> | 2024-05-03 16:33:11 +0100 |
---|---|---|
committer | Michael Meeks <michael.meeks@collabora.com> | 2024-05-10 18:25:27 +0200 |
commit | 3f15ad602da8a68d7cb63b02d9b456b0bd1d623b (patch) | |
tree | d13afbe3e22d68812a74f46d3ad78b8e18d7937e /svl | |
parent | e747e6df648a7ff076663ab376a4dbbc041b5180 (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/+/167335
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.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 90b27c29f7b0..d030b0a2cedf 100644 --- a/svl/source/passwordcontainer/passwordcontainer.cxx +++ b/svl/source/passwordcontainer/passwordcontainer.cxx @@ -652,9 +652,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 80fae574f175..2dbed6ee1399 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( |