diff options
author | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2016-04-24 12:26:56 +0100 |
---|---|---|
committer | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2016-04-24 12:26:56 +0100 |
commit | 31587bdd153040fa641bd0f5967b69a3b0a9559f (patch) | |
tree | 43589600b348e614a4175c15c3937393aeb10380 /src/crypto | |
parent | Merge pull request #803 (diff) | |
download | monero-31587bdd153040fa641bd0f5967b69a3b0a9559f.tar.xz |
random: call abort(3) instead of assert in must_succeed macro
Avoids silent use of bad RNG in release builds, in case those
calls might actually fail.
Reported by smooth.
Diffstat (limited to 'src/crypto')
-rw-r--r-- | src/crypto/random.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/crypto/random.c b/src/crypto/random.c index d7fcb7e65..f8a50d850 100644 --- a/src/crypto/random.c +++ b/src/crypto/random.c @@ -45,7 +45,7 @@ static void generate_system_random_bytes(size_t n, void *result); static void generate_system_random_bytes(size_t n, void *result) { HCRYPTPROV prov; -#define must_succeed(x) do if (!(x)) assert(0); while (0) +#define must_succeed(x) do if (!(x)) abort(); while (0) must_succeed(CryptAcquireContext(&prov, NULL, NULL, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT | CRYPT_SILENT)); must_succeed(CryptGenRandom(prov, (DWORD)n, result)); must_succeed(CryptReleaseContext(prov, 0)); |