Re: [PATCH] CryptAcquireContext and CryptGenRandom returns zero (FALSE) if fails.
On Tue, Nov 11, 2014 at 10:17 PM, Brent Cook wrote: > Yes, this is an intentional design feature: fail fast if there is no entropy. > > I'm looking at your other patches and testing with mingw 3.1.0, but am > having to fix a number of minor build failures. > > Out of curiosity, what version are you testing against? > I use mingw-w64, because it support both 32 bit and 64 bit, and accept patches very fast. git clone git://git.code.sf.net/p/mingw-w64/mingw-w64 http://sourceforge.net/p/mingw-w64/mingw-w64/commit_browser
Re: [PATCH] CryptAcquireContext and CryptGenRandom returns zero (FALSE) if fails.
Yes, this is an intentional design feature: fail fast if there is no entropy. I'm looking at your other patches and testing with mingw 3.1.0, but am having to fix a number of minor build failures. Out of curiosity, what version are you testing against? On Tue, Nov 11, 2014 at 8:07 AM, Dongsheng Song wrote: > On Tue, Nov 11, 2014 at 9:56 PM, Brent Cook wrote: >> Mystery solved! > > This patch fixed the exited immediately issue. > When getentropy failed, LibReSSL will call _getentropy_fail, it call > TerminateProcess(GetCurrentProcess(), 0) to exit.
Re: [PATCH] CryptAcquireContext and CryptGenRandom returns zero (FALSE) if fails.
On Tue, Nov 11, 2014 at 9:56 PM, Brent Cook wrote: > Mystery solved! This patch fixed the exited immediately issue. When getentropy failed, LibReSSL will call _getentropy_fail, it call TerminateProcess(GetCurrentProcess(), 0) to exit.
Re: [PATCH] CryptAcquireContext and CryptGenRandom returns zero (FALSE) if fails.
Thank you, applied. I tried out your win32 port branch yesterday and noticed that all of the tests and s_client all exited immediately, but it was too late to dig into it. Mystery solved! On Tue, Nov 11, 2014 at 1:21 AM, wrote: > From: Dongsheng Song > > Please see > http://msdn.microsoft.com/en-us/library/windows/desktop/aa379886(v=vs.85).aspx > and > http://msdn.microsoft.com/en-us/library/windows/desktop/aa379942%28v=vs.85%29.aspx > for more details. > --- > src/lib/libcrypto/crypto/getentropy_win.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/src/lib/libcrypto/crypto/getentropy_win.c > b/src/lib/libcrypto/crypto/getentropy_win.c > index f65e2b3..91e99c1 100644 > --- a/src/lib/libcrypto/crypto/getentropy_win.c > +++ b/src/lib/libcrypto/crypto/getentropy_win.c > @@ -1,7 +1,7 @@ > /* $OpenBSD: getentropy_win.c,v 1.1 2014/07/12 20:54:49 wouter Exp $ > */ > > /* > - * Copyright (c) 2014, Theo de Raadt > + * Copyright (c) 2014, Theo de Raadt > * Copyright (c) 2014, Bob Beck > * > * Permission to use, copy, modify, and distribute this software for any > @@ -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; > } > -- > 2.1.2 >
[PATCH] CryptAcquireContext and CryptGenRandom returns zero (FALSE) if fails.
From: Dongsheng Song Please see http://msdn.microsoft.com/en-us/library/windows/desktop/aa379886(v=vs.85).aspx and http://msdn.microsoft.com/en-us/library/windows/desktop/aa379942%28v=vs.85%29.aspx for more details. --- src/lib/libcrypto/crypto/getentropy_win.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/lib/libcrypto/crypto/getentropy_win.c b/src/lib/libcrypto/crypto/getentropy_win.c index f65e2b3..91e99c1 100644 --- a/src/lib/libcrypto/crypto/getentropy_win.c +++ b/src/lib/libcrypto/crypto/getentropy_win.c @@ -1,7 +1,7 @@ /* $OpenBSD: getentropy_win.c,v 1.1 2014/07/12 20:54:49 wouter Exp $ */ /* - * Copyright (c) 2014, Theo de Raadt + * Copyright (c) 2014, Theo de Raadt * Copyright (c) 2014, Bob Beck * * Permission to use, copy, modify, and distribute this software for any @@ -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; } -- 2.1.2