diff --git a/src/crypto/CryptoNight.cpp b/src/crypto/CryptoNight.cpp index 95119fa8..76fd9f8a 100644 --- a/src/crypto/CryptoNight.cpp +++ b/src/crypto/CryptoNight.cpp @@ -144,7 +144,7 @@ bool CryptoNight::init(int algo, int variant) bool CryptoNight::selfTest(int algo) { - if (cryptonight_hash_ctx_d == nullptr) { + if (cryptonight_hash_ctx_s == nullptr || cryptonight_hash_ctx_d == nullptr) { return false; } @@ -153,16 +153,10 @@ bool CryptoNight::selfTest(int algo) struct cryptonight_ctx *ctx = (struct cryptonight_ctx*) _mm_malloc(sizeof(struct cryptonight_ctx), 16); ctx->memory = (uint8_t *) _mm_malloc(MEMORY * 2, 16); - cryptonight_hash_ctx_d(test_input, 76, output, ctx); - - _mm_free(ctx->memory); - _mm_free(ctx); + cryptonight_hash_ctx_s(test_input, 76, output, ctx); bool resultSingle = memcmp(output, algo == Options::ALGO_CRYPTONIGHT_LITE ? test_output1 : test_output0, 32) == 0; - ctx = (struct cryptonight_ctx*) _mm_malloc(sizeof(struct cryptonight_ctx), 16); - ctx->memory = (uint8_t *) _mm_malloc(MEMORY * 2, 16); - cryptonight_hash_ctx_d(test_input, 76, output, ctx); _mm_free(ctx->memory);