aboutsummaryrefslogtreecommitdiff
path: root/src/crypto/random.c
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2018-01-26 10:35:13 +0000
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2018-02-01 13:32:46 +0000
commit851bd057ecfa2997252429f86362b0a710a1af8d (patch)
treeee07556385050124c85bcc76fea1cb1b81da65c5 /src/crypto/random.c
parentMerge pull request #3130 (diff)
downloadmonero-851bd057ecfa2997252429f86362b0a710a1af8d.tar.xz
call _exit instead of abort in release mode
Avoids cores being created, as they're nowadays often piped to some call home system
Diffstat (limited to '')
-rw-r--r--src/crypto/random.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/crypto/random.c b/src/crypto/random.c
index 691c31f62..14a028fc9 100644
--- a/src/crypto/random.c
+++ b/src/crypto/random.c
@@ -45,7 +45,11 @@ static void generate_system_random_bytes(size_t n, void *result);
static void generate_system_random_bytes(size_t n, void *result) {
HCRYPTPROV prov;
+#ifdef NDEBUG
+#define must_succeed(x) do if (!(x)) { fprintf(stderr, "Failed: " #x); _exit(1); } while (0)
+#else
#define must_succeed(x) do if (!(x)) abort(); while (0)
+#endif
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));