From b7840d9ab67ff133eba468a2fbd615a091ce8b8d Mon Sep 17 00:00:00 2001 From: SChernykh Date: Sat, 7 Mar 2020 16:41:33 +0100 Subject: [PATCH] Fixed invalid AstroBWT hashes after algo switching --- src/crypto/astrobwt/AstroBWT.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/crypto/astrobwt/AstroBWT.cpp b/src/crypto/astrobwt/AstroBWT.cpp index f86a42cc5..ca325bff8 100644 --- a/src/crypto/astrobwt/AstroBWT.cpp +++ b/src/crypto/astrobwt/AstroBWT.cpp @@ -65,6 +65,7 @@ static void Salsa20_XORKeyStream(const void* key, void* output, size_t size) ECRYPT_keysetup(&ctx, static_cast(key), 256, 64); ECRYPT_ivsetup(&ctx, iv); ECRYPT_keystream_bytes(&ctx, static_cast(output), size); + memset(static_cast(output) - 16, 0, 16); memset(static_cast(output) + size, 0, 16); } #else @@ -75,6 +76,7 @@ static void Salsa20_XORKeyStream(const void* key, void* output, size_t size) const uint64_t iv = 0; ZeroTier::Salsa20 s(key, &iv); s.XORKeyStream(output, size); + memset(static_cast(output) - 16, 0, 16); memset(static_cast(output) + size, 0, 16); } #endif