diff options
author | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2018-01-26 10:35:13 +0000 |
---|---|---|
committer | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2018-02-01 13:32:46 +0000 |
commit | 851bd057ecfa2997252429f86362b0a710a1af8d (patch) | |
tree | ee07556385050124c85bcc76fea1cb1b81da65c5 /src/crypto/keccak.c | |
parent | Merge pull request #3130 (diff) | |
download | monero-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 'src/crypto/keccak.c')
-rw-r--r-- | src/crypto/keccak.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/src/crypto/keccak.c b/src/crypto/keccak.c index fc6d487c2..528a5406b 100644 --- a/src/crypto/keccak.c +++ b/src/crypto/keccak.c @@ -4,9 +4,20 @@ #include <stdio.h> #include <stdlib.h> +#include <unistd.h> #include "hash-ops.h" #include "keccak.h" +static void local_abort(const char *msg) +{ + fprintf(stderr, "%s\n", msg); +#ifdef NDEBUG + _exit(1); +#else + abort(); +#endif +} + const uint64_t keccakf_rndc[24] = { 0x0000000000000001, 0x0000000000008082, 0x800000000000808a, @@ -83,8 +94,7 @@ void keccak(const uint8_t *in, size_t inlen, uint8_t *md, int mdlen) if (mdlen <= 0 || mdlen > 200 || sizeof(st) != 200) { - fprintf(stderr, "Bad keccak use"); - abort(); + local_abort("Bad keccak use"); } rsiz = sizeof(state_t) == mdlen ? HASH_DATA_AREA : 200 - 2 * mdlen; @@ -101,8 +111,7 @@ void keccak(const uint8_t *in, size_t inlen, uint8_t *md, int mdlen) // last block and padding if (inlen >= sizeof(temp) || inlen > rsiz || rsiz - inlen + inlen + 1 >= sizeof(temp) || rsiz == 0 || rsiz - 1 >= sizeof(temp) || rsizw * 8 > sizeof(temp)) { - fprintf(stderr, "Bad keccak use"); - abort(); + local_abort("Bad keccak use"); } memcpy(temp, in, inlen); |