From ff664adcf5ca48fe1dfe80c0298907ffafe75350 Mon Sep 17 00:00:00 2001 From: anythingtechpro Date: Sat, 3 Mar 2018 18:31:28 -0500 Subject: [PATCH] crypto: only allocate enough memory for the corresponding pow algorithm --- src/crypto/slow-hash.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/crypto/slow-hash.c b/src/crypto/slow-hash.c index 108114e..dff7502 100644 --- a/src/crypto/slow-hash.c +++ b/src/crypto/slow-hash.c @@ -178,7 +178,7 @@ STATIC INLINE void aesni_pseudo_round(const uint8_t *in, uint8_t *out, void cn_slow_hash(const void *data, size_t length, char *hash, int dark) { - uint8_t long_state[MEMORY]; + uint8_t long_state[(MEMORY / (dark?4:1))]; uint8_t text[INIT_SIZE_BYTE]; uint8_t a[AES_BLOCK_SIZE]; uint8_t b[AES_BLOCK_SIZE];