summaryrefslogtreecommitdiff
path: root/platform/windows/os_windows.cpp
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2022-02-14 12:15:10 +0100
committerGitHub <noreply@github.com>2022-02-14 12:15:10 +0100
commit6e73aa0497b9cfc1c28863e655991106e677e69c (patch)
tree15191afb3e9dcfe51a7d271e0120c03797293874 /platform/windows/os_windows.cpp
parent8317753c24f6a05d4fdc8541fecf1cd2ec189b41 (diff)
parentf4a80f9ca7dd7241d418db341aa97613bebd6b8d (diff)
Merge pull request #57887 from Faless/crypto/4.x_os_get_entropy
Diffstat (limited to 'platform/windows/os_windows.cpp')
-rw-r--r--platform/windows/os_windows.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp
index d844531071..59f55b5dd2 100644
--- a/platform/windows/os_windows.cpp
+++ b/platform/windows/os_windows.cpp
@@ -46,6 +46,7 @@
#include "windows_terminal_logger.h"
#include <avrt.h>
+#include <bcrypt.h>
#include <direct.h>
#include <knownfolders.h>
#include <process.h>
@@ -192,6 +193,12 @@ void OS_Windows::finalize_core() {
NetSocketPosix::cleanup();
}
+Error OS_Windows::get_entropy(uint8_t *r_buffer, int p_bytes) {
+ NTSTATUS status = BCryptGenRandom(nullptr, r_buffer, p_bytes, BCRYPT_USE_SYSTEM_PREFERRED_RNG);
+ ERR_FAIL_COND_V(status, FAILED);
+ return OK;
+}
+
Error OS_Windows::open_dynamic_library(const String p_path, void *&p_library_handle, bool p_also_set_library_path) {
String path = p_path.replace("/", "\\");