From 3f15ad602da8a68d7cb63b02d9b456b0bd1d623b Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Fri, 3 May 2024 16:33:11 +0100 Subject: 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 Tested-by: Jenkins CollaboraOffice --- oox/source/crypto/Standard2007Engine.cxx | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'oox') diff --git a/oox/source/crypto/Standard2007Engine.cxx b/oox/source/crypto/Standard2007Engine.cxx index 9fe18ad17e0c..bcc3dc558ff3 100644 --- a/oox/source/crypto/Standard2007Engine.cxx +++ b/oox/source/crypto/Standard2007Engine.cxx @@ -27,12 +27,10 @@ namespace void lclRandomGenerateValues(sal_uInt8* aArray, sal_uInt32 aSize) { - rtlRandomPool aRandomPool = rtl_random_createPool(); - if (rtl_random_getBytes(aRandomPool, aArray, aSize) != rtl_Random_E_None) + if (rtl_random_getBytes(nullptr, aArray, aSize) != rtl_Random_E_None) { throw css::uno::RuntimeException("rtl_random_getBytes failed"); } - rtl_random_destroyPool(aRandomPool); } constexpr OUString lclCspName = u"Microsoft Enhanced RSA and AES Cryptographic Provider"_ustr; -- cgit