windows: Use BCryptGenRandom to implement os.urandom.

Fix urandom not working on windows (there's no /dev/urandom) by using
a proper cryptographic random function (same one as CPython >= 3.11).
This commit is contained in:
stijn
2022-06-07 11:24:42 +02:00
committed by Damien George
parent 5290bfaefe
commit 5bb2a85d74
3 changed files with 14 additions and 1 deletions

View File

@@ -33,7 +33,7 @@ INC += -I$(VARIANT_DIR)
# compiler settings
CFLAGS = $(INC) -Wall -Wpointer-arith -Wdouble-promotion -Werror -std=gnu99 -DUNIX -D__USE_MINGW_ANSI_STDIO=1 $(CFLAGS_MOD) $(COPT) $(CFLAGS_EXTRA)
LDFLAGS = $(LDFLAGS_MOD) -lm $(LDFLAGS_EXTRA)
LDFLAGS = $(LDFLAGS_MOD) -lm -lbcrypt $(LDFLAGS_EXTRA)
# Debugging/Optimization
ifdef DEBUG

View File

@@ -32,6 +32,7 @@
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<GenerateMapFile>true</GenerateMapFile>
<AdditionalDependencies>Bcrypt.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemGroup>