mirror of https://code.videolan.org/videolan/vlc
Merge branch 'win_vlc_rand' into 'master'
Simplify vlc_rand_bytes on Windows See merge request videolan/vlc!5366
This commit is contained in:
commit
76a5bf2177
|
@ -27,15 +27,11 @@
|
|||
|
||||
#include <windows.h>
|
||||
#include <bcrypt.h>
|
||||
#include <assert.h>
|
||||
|
||||
void vlc_rand_bytes (void *buf, size_t len)
|
||||
{
|
||||
BCRYPT_ALG_HANDLE algo_handle;
|
||||
NTSTATUS ret = BCryptOpenAlgorithmProvider(&algo_handle, BCRYPT_RNG_ALGORITHM,
|
||||
MS_PRIMITIVE_PROVIDER, 0);
|
||||
if (BCRYPT_SUCCESS(ret))
|
||||
{
|
||||
BCryptGenRandom(algo_handle, buf, len, 0);
|
||||
BCryptCloseAlgorithmProvider(algo_handle, 0);
|
||||
}
|
||||
NTSTATUS ret;
|
||||
ret = BCryptGenRandom(0, buf, len, BCRYPT_USE_SYSTEM_PREFERRED_RNG);
|
||||
assert(BCRYPT_SUCCESS(ret));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue