random.windows: Saw in the pastebin that some Windows installs still don't

start with this code. Just set the system and secure RNGs to f, and
calling them will throw an error. The Mersenne Twister is still the
default anyway.
db4
Doug Coleman 2013-07-27 13:28:20 -07:00
parent b63c9154c3
commit 2f2e04ca45
1 changed files with 6 additions and 2 deletions

View File

@ -46,8 +46,12 @@ M: windows-crypto-context random-bytes* ( n windows-crypto-context -- bytes )
handle>> swap [ ] [ <byte-array> ] bi
[ CryptGenRandom win32-error=0/f ] keep ;
: try-crypto-providers ( seq -- windows-crypto-context )
[ first2 <windows-crypto-context> ] attempt-all ;
! Some Windows installations still don't work, so just set
! system and secure rngs to f
: try-crypto-providers ( seq -- windows-crypto-context/f )
[
[ first2 <windows-crypto-context> ] attempt-all
] [ 2drop f ] recover ;
[
{