Fix for cnv2_double_main_loop upx/fastv2

- Added more tests
This commit is contained in:
Ben Gräf 2019-01-24 20:02:40 +01:00
parent 317b521c76
commit 98a09c25c2
4 changed files with 29 additions and 11 deletions

View file

@ -546,6 +546,11 @@ bool CryptoNight::selfTest(int algo)
cryptonight_hash_ctx[0](asmOptimization, PowVariant::POW_V2, test_input, 76, output, scratchPads);
resultUltraLite = resultUltraLite && memcmp(output, test_output_turtle, 32) == 0;
#if MAX_NUM_HASH_BLOCKS > 1
cryptonight_hash_ctx[1](asmOptimization, PowVariant::POW_V2, test_input, 76, output, scratchPads);
resultUltraLite = resultUltraLite && memcmp(output, test_output_turtle, 64) == 0;
#endif
} else {
// cn v0 aka orignal
@ -646,6 +651,11 @@ bool CryptoNight::selfTest(int algo)
cryptonight_hash_ctx[0](asmOptimization, PowVariant::POW_FAST_2, test_input, 76, output, scratchPads);
result = result && memcmp(output, test_output_xtl_v9, 32) == 0;
#if MAX_NUM_HASH_BLOCKS > 1
cryptonight_hash_ctx[1](asmOptimization, PowVariant::POW_FAST_2, test_input, 76, output, scratchPads);
result = result && memcmp(output, test_output_xtl_v9, 64) == 0;
#endif
}
for (size_t i = 0; i < MAX_NUM_HASH_BLOCKS; ++i) {

View file

@ -123,9 +123,11 @@ const static uint8_t test_output_xfh[32] = {
};
// CN XTL V9
const static uint8_t test_output_xtl_v9[32] = {
const static uint8_t test_output_xtl_v9[64] = {
0x5D, 0x4F, 0xBC, 0x35, 0x60, 0x97, 0xEA, 0x64, 0x40, 0xB0, 0x88, 0x8E, 0xDE, 0xB6, 0x35, 0xDD,
0xC8, 0x4A, 0x0E, 0x39, 0x7C, 0x86, 0x84, 0x56, 0x89, 0x5C, 0x3F, 0x29, 0xBE, 0x73, 0x12, 0xA7
0xC8, 0x4A, 0x0E, 0x39, 0x7C, 0x86, 0x84, 0x56, 0x89, 0x5C, 0x3F, 0x29, 0xBE, 0x73, 0x12, 0xA7,
0x02, 0xE6, 0x1D, 0x2B, 0xBC, 0x84, 0xB6, 0x71, 0x96, 0x71, 0xD5, 0x0C, 0xAC, 0x76, 0x0E, 0x6B,
0xF1, 0xF0, 0x55, 0x34, 0x15, 0x29, 0x93, 0x04, 0x2D, 0xED, 0xD2, 0x33, 0x50, 0x6E, 0xBE, 0x25
};
// CN-LITE
@ -213,9 +215,11 @@ const static uint8_t test_output_heavy_tube[96] = {
};
// CN-Ultralite/Turtle
const static uint8_t test_output_turtle[32] = {
const static uint8_t test_output_turtle[64] = {
0x08, 0xF4, 0x21, 0xD7, 0x83, 0x31, 0x17, 0x30, 0x0E, 0xDA, 0x66, 0xE9, 0x8F, 0x4A, 0x25, 0x69,
0x09, 0x3D, 0xF3, 0x00, 0x50, 0x01, 0x73, 0x94, 0x4E, 0xFC, 0x40, 0x1E, 0x9A, 0x4A, 0x17, 0xAF
0x09, 0x3D, 0xF3, 0x00, 0x50, 0x01, 0x73, 0x94, 0x4E, 0xFC, 0x40, 0x1E, 0x9A, 0x4A, 0x17, 0xAF,
0xB2, 0x17, 0x2E, 0xC9, 0x46, 0x6E, 0x1A, 0xEE, 0x70, 0xEC, 0x85, 0x72, 0xA1, 0x4C, 0x23, 0x3E,
0xE3, 0x54, 0x58, 0x2B, 0xCB, 0x93, 0xF8, 0x69, 0xD4, 0x29, 0x74, 0x4D, 0xE5, 0x72, 0x6A, 0x26
};
#endif /* __CRYPTONIGHT_TEST_H__ */

View file

@ -18,7 +18,7 @@
mov r10, QWORD PTR [rcx+32]
mov r8, rcx
xor r10, QWORD PTR [rcx]
mov r14d, 524288
mov r14d, ${ITERATIONS}
mov r11, QWORD PTR [rcx+40]
xor r11, QWORD PTR [rcx+8]
mov rsi, QWORD PTR [rdx+224]
@ -41,7 +41,7 @@
movaps XMMWORD PTR [rsp+16], xmm15
mov rdx, r10
movq xmm4, QWORD PTR [r8+96]
and edx, 2097136
and edx, ${MASK}
mov rax, QWORD PTR [rcx+48]
xorps xmm13, xmm13
xor rax, QWORD PTR [rcx+16]
@ -83,7 +83,7 @@
mov rcx, rdi
mov QWORD PTR [rsp+264], r11
movq xmm8, rax
and ecx, 2097136
and ecx, ${MASK}
punpcklqdq xmm8, xmm0
movq xmm0, QWORD PTR [r9+96]
punpcklqdq xmm4, xmm0
@ -124,7 +124,7 @@ cnv2_double_main_loop_${ALGO}_sandybridge:
movq r11, xmm9
mov edx, r11d
and edx, 2097136
and edx, ${MASK}
movdqa xmm0, xmm9
pxor xmm0, xmm7
movdqu XMMWORD PTR [r9], xmm0
@ -155,7 +155,7 @@ cnv2_double_main_loop_${ALGO}_sandybridge:
movdqu XMMWORD PTR [rax+rsi], xmm0
movq rcx, xmm10
and ecx, 2097136
and ecx, ${MASK}
movdqa xmm0, xmm10
pxor xmm0, xmm6
@ -203,7 +203,7 @@ cnv2_double_main_loop_${ALGO}_sandybridge:
mov QWORD PTR [rbx+8], rdx
xor rdx, r9
mov QWORD PTR [rsp+256], r11
and r11d, 2097136
and r11d, ${MASK}
mov QWORD PTR [rsp+264], rdx
mov QWORD PTR [rsp+8], r11
lea r15, QWORD PTR [r11+r13]
@ -317,7 +317,7 @@ sqrt_fix_2_ret_${ALGO}_sandybridge:
mov QWORD PTR [r13], rdi
xor rdi, r10
mov ecx, edi
and ecx, 2097136
and ecx, ${MASK}
lea r8, QWORD PTR [rcx+rsi]
mov rdx, QWORD PTR [r13+8]

View file

@ -150,6 +150,10 @@ PowVariant Job::powVariant() const
} else {
return PowVariant::POW_V0;
}
} else if (m_powVariant == PowVariant::POW_XTL) {
if (m_blob[0] >= 9) {
return PowVariant::POW_FAST_2;
}
} else if (m_powVariant == PowVariant::POW_MSR) {
if (m_blob[0] >= 8) {
return PowVariant::POW_FAST_2;