From ef1ea89c33a7108544deaef2110ab177f6ee6218 Mon Sep 17 00:00:00 2001 From: Vishal Pankaj Chandratreya <19171016+tfpf@users.noreply.github.com> Date: Sun, 1 Oct 2023 19:03:39 +0530 Subject: [PATCH] Corrected status check code in Windows. --- lib/hdrbg.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/hdrbg.c b/lib/hdrbg.c index 424c2ab..0af45c2 100644 --- a/lib/hdrbg.c +++ b/lib/hdrbg.c @@ -31,6 +31,7 @@ hdrbg_err = HDRBG_ERR_NONE; #if defined _WIN32 #include #include +#include #elif defined __linux__ || defined __CYGWIN__ #include #endif @@ -208,7 +209,7 @@ streamtobytes(FILE *fptr_, uint8_t *m_bytes, size_t m_length) // an entropy source. #if defined _WIN32 && CHAR_BIT == 8 NTSTATUS status = BCryptGenRandom(NULL, m_bytes, m_length, BCRYPT_USE_SYSTEM_PREFERRED_RNG); - if(status != STATUS_SUCCESS) + if(NT_SUCCESS(status)) { hdrbg_err = HDRBG_ERR_NO_ENTROPY; return 0;