diff options
author | Brent Cook <bcook@cvs.openbsd.org> | 2014-11-11 13:54:34 +0000 |
---|---|---|
committer | Brent Cook <bcook@cvs.openbsd.org> | 2014-11-11 13:54:34 +0000 |
commit | 468de3bb3a6aeabc3a7f124039f1acf8fd861817 (patch) | |
tree | 40a9d1a2733ae95f9a1420d4d382e2a338c2e001 /lib/libcrypto/crypto | |
parent | 6ab915026ed0118b08d36f7ce0b8397796c9c85f (diff) |
correct the failure case for getentropy on win32
CryptAcquireContext and CryptGenRandom returns zero (FALSE) if fails.
From: Dongsheng Song <dongsheng.song@gmail.com>
Diffstat (limited to 'lib/libcrypto/crypto')
-rw-r--r-- | lib/libcrypto/crypto/getentropy_win.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/libcrypto/crypto/getentropy_win.c b/lib/libcrypto/crypto/getentropy_win.c index 1263ba4ca2f..da048ae157d 100644 --- a/lib/libcrypto/crypto/getentropy_win.c +++ b/lib/libcrypto/crypto/getentropy_win.c @@ -1,4 +1,4 @@ -/* $OpenBSD: getentropy_win.c,v 1.2 2014/07/13 13:03:09 deraadt Exp $ */ +/* $OpenBSD: getentropy_win.c,v 1.3 2014/11/11 13:54:33 bcook Exp $ */ /* * Copyright (c) 2014, Theo de Raadt <deraadt@openbsd.org> @@ -44,9 +44,9 @@ getentropy(void *buf, size_t len) } if (CryptAcquireContext(&provider, NULL, NULL, PROV_RSA_FULL, - CRYPT_VERIFYCONTEXT) != 0) + CRYPT_VERIFYCONTEXT) == 0) goto fail; - if (CryptGenRandom(provider, len, buf) != 0) { + if (CryptGenRandom(provider, len, buf) == 0) { CryptReleaseContext(provider, 0); goto fail; } |