From ee2bd4f4c5de9bfbcb049adddc514c37211880e2 Mon Sep 17 00:00:00 2001 From: WolverinDEV Date: Sun, 7 Jul 2019 18:40:03 +0200 Subject: [PATCH] Updated changelog --- src/protocol/CryptionHandler.cpp | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/protocol/CryptionHandler.cpp b/src/protocol/CryptionHandler.cpp index 8c4e21f..63fe6a7 100644 --- a/src/protocol/CryptionHandler.cpp +++ b/src/protocol/CryptionHandler.cpp @@ -126,20 +126,18 @@ bool CryptionHandler::setupSharedSecretNew(const std::string &alpha, const std:: assert(alpha.length() == 10); assert(beta.length() == 54); - string shared; - string sharedIv; - shared.resize(32, '\0'); - sharedIv.resize(64, '\0'); - keyMul((uint8_t*) shared.data(), reinterpret_cast(publicKey), reinterpret_cast(privateKey), true); //Remote key get negated - sharedIv = digest::sha512(shared); - digest::sha512(shared.data(), 32, sharedIv.data()); + uint8_t shared[32]; + uint8_t shared_iv[64]; + + keyMul(shared, reinterpret_cast(publicKey), reinterpret_cast(privateKey), true); //Remote key get negated + digest::sha512((const char*) shared, 32, shared_iv); auto xor_key = alpha + beta; for(int i = 0; i < 64; i++) - sharedIv[i] ^= xor_key[i]; + shared_iv[i] ^= xor_key[i]; { lock_guard lock(this->cache_key_lock); - memcpy(this->iv_struct, sharedIv.data(), 64); + memcpy(this->iv_struct, shared_iv, 64); this->iv_struct_length = 64; uint8_t mac_buffer[SHA_DIGEST_LENGTH];