Merge pull request #1584 from SChernykh/dev

Fixed invalid AstroBWT hashes after algo switching
This commit is contained in:
xmrig 2020-03-07 22:47:17 +07:00 committed by GitHub
commit 5fee8ba288
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -65,6 +65,7 @@ static void Salsa20_XORKeyStream(const void* key, void* output, size_t size)
ECRYPT_keysetup(&ctx, static_cast<const uint8_t*>(key), 256, 64); ECRYPT_keysetup(&ctx, static_cast<const uint8_t*>(key), 256, 64);
ECRYPT_ivsetup(&ctx, iv); ECRYPT_ivsetup(&ctx, iv);
ECRYPT_keystream_bytes(&ctx, static_cast<uint8_t*>(output), size); ECRYPT_keystream_bytes(&ctx, static_cast<uint8_t*>(output), size);
memset(static_cast<uint8_t*>(output) - 16, 0, 16);
memset(static_cast<uint8_t*>(output) + size, 0, 16); memset(static_cast<uint8_t*>(output) + size, 0, 16);
} }
#else #else
@ -75,6 +76,7 @@ static void Salsa20_XORKeyStream(const void* key, void* output, size_t size)
const uint64_t iv = 0; const uint64_t iv = 0;
ZeroTier::Salsa20 s(key, &iv); ZeroTier::Salsa20 s(key, &iv);
s.XORKeyStream(output, size); s.XORKeyStream(output, size);
memset(static_cast<uint8_t*>(output) - 16, 0, 16);
memset(static_cast<uint8_t*>(output) + size, 0, 16); memset(static_cast<uint8_t*>(output) + size, 0, 16);
} }
#endif #endif