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 /include/rtl | |
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 'include/rtl')
-rw-r--r-- | include/rtl/random.h | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/include/rtl/random.h b/include/rtl/random.h index bc43d8ca5563..1833fa362ce0 100644 --- a/include/rtl/random.h +++ b/include/rtl/random.h @@ -53,15 +53,29 @@ enum __rtl_RandomError */ typedef enum __rtl_RandomError rtlRandomError; +/** Retrieve random bytes + @param[in] Pool use NULL, non-NULL Random Pools are deprecated + @param[in,out] Buffer a buffer to receive the random bytes. + @param[in] Bytes the number of bytes to write to the buffer. + @retval rtl_Random_E_None upon success. + */ +SAL_DLLPUBLIC rtlRandomError SAL_CALL rtl_random_getBytes ( + rtlRandomPool Pool, + void *Buffer, + sal_Size Bytes +) SAL_THROW_EXTERN_C(); + /** Create a Random Pool. @return initialized Random Pool, or NULL upon failure. + @deprecated Instead use rtl_random_getBytes with a NULL Pool */ SAL_DLLPUBLIC rtlRandomPool SAL_CALL rtl_random_createPool (void) SAL_THROW_EXTERN_C(); /** Destroy a Random Pool. @param[in] Pool a Random Pool. + @deprecated Instead use rtl_random_getBytes with a NULL Pool */ SAL_DLLPUBLIC void SAL_CALL rtl_random_destroyPool ( rtlRandomPool Pool @@ -73,7 +87,8 @@ SAL_DLLPUBLIC void SAL_CALL rtl_random_destroyPool ( @param[in] Buffer a buffer containing the bytes to add. @param[in] Bytes the number of bytes to read from the buffer. @retval rtl_Random_E_None upon success. - @deprecated This now does nothing. + @deprecated This now does nothing, instead use rtl_random_getBytes with a + NULL Pool */ SAL_DLLPUBLIC rtlRandomError SAL_CALL rtl_random_addBytes ( rtlRandomPool Pool, @@ -82,18 +97,6 @@ SAL_DLLPUBLIC rtlRandomError SAL_CALL rtl_random_addBytes ( ) SAL_THROW_EXTERN_C(); -/** Retrieve bytes from a Random Pool. - @param[in] Pool a Random Pool. - @param[in,out] Buffer a buffer to receive the random bytes. - @param[in] Bytes the number of bytes to write to the buffer. - @retval rtl_Random_E_None upon success. - */ -SAL_DLLPUBLIC rtlRandomError SAL_CALL rtl_random_getBytes ( - rtlRandomPool Pool, - void *Buffer, - sal_Size Bytes -) SAL_THROW_EXTERN_C(); - #ifdef __cplusplus } #endif |