diff options
author | 2014-11-11 13:54:33 +0000 | |
---|---|---|
committer | 2014-11-11 13:54:33 +0000 | |
commit | fad586ed4d23f29fa2e44e87b12b187a28415a14 (patch) | |
tree | 6a1f66e9c52d6ef1b56ccc840d0a436b43d328b4 /lib | |
parent | Do not reset the base address of the control endpoint's ring when (diff) | |
download | wireguard-openbsd-fad586ed4d23f29fa2e44e87b12b187a28415a14.tar.xz wireguard-openbsd-fad586ed4d23f29fa2e44e87b12b187a28415a14.zip |
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')
-rw-r--r-- | lib/libcrypto/arc4random/getentropy_win.c | 6 | ||||
-rw-r--r-- | lib/libcrypto/crypto/getentropy_win.c | 6 |
2 files changed, 6 insertions, 6 deletions
diff --git a/lib/libcrypto/arc4random/getentropy_win.c b/lib/libcrypto/arc4random/getentropy_win.c index 1263ba4ca2f..da048ae157d 100644 --- a/lib/libcrypto/arc4random/getentropy_win.c +++ b/lib/libcrypto/arc4random/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; } 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; } |