diff --git a/src/crypto/CryptoNight.cpp b/src/crypto/CryptoNight.cpp index b605bfb8..82589222 100644 --- a/src/crypto/CryptoNight.cpp +++ b/src/crypto/CryptoNight.cpp @@ -47,6 +47,9 @@ void (*cryptonight_hash_ctx)(const uint8_t *input, size_t size, uint8_t *output, case xmrig::VARIANT_V1: \ return cryptonight_##NAME##_hash(input, size, output, ctx); \ \ + case xmrig::VARIANT_V2: \ + return cryptonight_##NAME##_hash(input, size, output, ctx); \ + \ case xmrig::VARIANT_NONE: \ return cryptonight_##NAME##_hash(input, size, output, ctx); \ \ @@ -61,6 +64,11 @@ static void cryptonight_av1_aesni(const uint8_t *input, size_t size, uint8_t *ou # endif } +static void cryptonight_av2_aesni(const uint8_t *input, size_t size, uint8_t *output, struct cryptonight_ctx *ctx, int variant) { +# if !defined(XMRIG_ARMv7) + CRYPTONIGHT_HASH(single, MONERO_ITER, MONERO_MEMORY, MONERO_MASK, false) +# endif +} static void cryptonight_av2_aesni_double(const uint8_t *input, size_t size, uint8_t *output, cryptonight_ctx *ctx, int variant) { # if !defined(XMRIG_ARMv7) @@ -103,8 +111,9 @@ static void cryptonight_lite_av4_softaes_double(const uint8_t *input, size_t siz CRYPTONIGHT_HASH(double, AEON_ITER, AEON_MEMORY, AEON_MASK, true) } -void (*cryptonight_variations[8])(const uint8_t *input, size_t size, uint8_t *output, cryptonight_ctx *ctx, int variant) = { +void (*cryptonight_variations[9])(const uint8_t *input, size_t size, uint8_t *output, cryptonight_ctx *ctx, int variant) = { cryptonight_av1_aesni, + cryptonight_av2_aesni, cryptonight_av2_aesni_double, cryptonight_av3_softaes, cryptonight_av4_softaes_double, @@ -114,8 +123,9 @@ void (*cryptonight_variations[8])(const uint8_t *input, size_t size, uint8_t *ou cryptonight_lite_av4_softaes_double }; #else -void (*cryptonight_variations[4])(const uint8_t *input, size_t size, uint8_t *output, cryptonight_ctx *ctx, int variant) = { +void (*cryptonight_variations[5])(const uint8_t *input, size_t size, uint8_t *output, cryptonight_ctx *ctx, int variant) = { cryptonight_av1_aesni, + cryptonight_av2_aesni, cryptonight_av2_aesni_double, cryptonight_av3_softaes, cryptonight_av4_softaes_double @@ -145,7 +155,7 @@ bool CryptoNight::init(int algo, int variant) cryptonight_hash_ctx = cryptonight_variations[index]; - return selfTest(algo); + return true; } diff --git a/src/crypto/CryptoNight_monero.h b/src/crypto/CryptoNight_monero.h index a667a3b3..51e2fa5d 100644 --- a/src/crypto/CryptoNight_monero.h +++ b/src/crypto/CryptoNight_monero.h @@ -45,12 +45,19 @@ #endif #define VARIANT1_1(p) \ - if (VARIANT > 0) { \ - const uint8_t tmp = reinterpret_cast(p)[11]; \ - static const uint32_t table = 0x75310; \ - const uint8_t index = (((tmp >> 3) & 6) | (tmp & 1)) << 1; \ - ((uint8_t*)(p))[11] = tmp ^ ((table >> index) & 0x30); \ - } + if (variant > 1) \ + { \ + const uint8_t tmp = reinterpret_cast(p)[11]; \ + static const uint32_t table = 0x75312; \ + const uint8_t index = (((tmp >> 4) & 6) | (tmp & 1)) << 1; \ + ((uint8_t*)(p))[11] = tmp ^ ((table >> index) & 0x30); \ + } \ + else{ \ + const uint8_t tmp = reinterpret_cast(p)[11]; \ + static const uint32_t table = 0x75310; \ + const uint8_t index = (((tmp >> 3) & 6) | (tmp & 1)) << 1; \ + ((uint8_t*)(p))[11] = tmp ^ ((table >> index) & 0x30); \ +} #define VARIANT1_2(p, part) \ if (VARIANT > 0) { \ diff --git a/src/net/Job.cpp b/src/net/Job.cpp index 7d137fac..a5b743e2 100644 --- a/src/net/Job.cpp +++ b/src/net/Job.cpp @@ -176,7 +176,9 @@ void Job::setVariant(int variant) case xmrig::VARIANT_V1: m_variant = variant; break; - + case xmrig::VARIANT_V2: + m_variant = variant; + break; default: break; } diff --git a/src/net/Url.cpp b/src/net/Url.cpp index 99fe9dc2..32930248 100644 --- a/src/net/Url.cpp +++ b/src/net/Url.cpp @@ -222,6 +222,9 @@ void Url::setVariant(int variant) case xmrig::VARIANT_V1: m_variant = variant; break; + case xmrig::VARIANT_V1: + m_variant = variant; + break; default: break; diff --git a/src/xmrig.h b/src/xmrig.h index 103e8a68..3a724d7c 100644 --- a/src/xmrig.h +++ b/src/xmrig.h @@ -38,7 +38,8 @@ enum Algo { enum Variant { VARIANT_AUTO = -1, VARIANT_NONE = 0, - VARIANT_V1 = 1 + VARIANT_V1 = 1, + VARIANT_V2 = 2 }; } /* xmrig */