Skip to content

Commit

Permalink
Corrected status check code in Windows.
Browse files Browse the repository at this point in the history
  • Loading branch information
tfpf committed Oct 1, 2023
1 parent ec658f7 commit ef1ea89
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/hdrbg.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ hdrbg_err = HDRBG_ERR_NONE;
#if defined _WIN32
#include <windows.h>
#include <bcrypt.h>
#include <ntdef.h>
#elif defined __linux__ || defined __CYGWIN__
#include <sys/random.h>
#endif
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit ef1ea89

Please sign in to comment.