Updated changelog

This commit is contained in:
WolverinDEV 2019-07-07 18:41:41 +02:00
parent ee2bd4f4c5
commit 0bf70698e5

View File

@ -123,17 +123,19 @@ inline void keyMul(uint8_t* target_buffer, const uint8_t* publicKey /* compresse
} }
bool CryptionHandler::setupSharedSecretNew(const std::string &alpha, const std::string &beta, const char* privateKey /* uncompressed */, const char* publicKey /* compressed */) { bool CryptionHandler::setupSharedSecretNew(const std::string &alpha, const std::string &beta, const char* privateKey /* uncompressed */, const char* publicKey /* compressed */) {
assert(alpha.length() == 10); if(alpha.length() != 10 || beta.length() != 54)
assert(beta.length() == 54); return false;
uint8_t shared[32]; uint8_t shared[32];
uint8_t shared_iv[64]; uint8_t shared_iv[64];
ed25519_key_exchange(shared, (uint8_t*) publicKey, (uint8_t*) privateKey);
keyMul(shared, reinterpret_cast<const uint8_t *>(publicKey), reinterpret_cast<const uint8_t *>(privateKey), true); //Remote key get negated keyMul(shared, reinterpret_cast<const uint8_t *>(publicKey), reinterpret_cast<const uint8_t *>(privateKey), true); //Remote key get negated
digest::sha512((const char*) shared, 32, shared_iv); digest::sha512((char*) shared, 32, shared_iv);
auto xor_key = alpha + beta; auto xor_key = alpha + beta;
for(int i = 0; i < 64; i++) for(int i = 0; i < 64; i++)
shared_iv[i] ^= xor_key[i]; shared_iv[i] ^= (uint8_t) xor_key[i];
{ {
lock_guard lock(this->cache_key_lock); lock_guard lock(this->cache_key_lock);
@ -141,15 +143,13 @@ bool CryptionHandler::setupSharedSecretNew(const std::string &alpha, const std::
this->iv_struct_length = 64; this->iv_struct_length = 64;
uint8_t mac_buffer[SHA_DIGEST_LENGTH]; uint8_t mac_buffer[SHA_DIGEST_LENGTH];
digest::sha1((const char*) this->iv_struct, 64, mac_buffer); digest::sha1((char*) this->iv_struct, 64, mac_buffer);
memcpy(this->current_mac, mac_buffer, 8); memcpy(this->current_mac, mac_buffer, 8);
//auto digest_buffer = digest::sha1((char*) this->iv_struct, 64);
//memcpy(this->current_mac, digest_buffer.data(), 8);
this->useDefaultChipherKeyNonce = false; this->useDefaultChipherKeyNonce = false;
} }
return true; return true;
} }
bool CryptionHandler::generate_key_nonce(protocol::BasicPacket* packet, bool use_default, uint8_t(& key)[16], uint8_t(& nonce)[16]){ bool CryptionHandler::generate_key_nonce(protocol::BasicPacket* packet, bool use_default, uint8_t(& key)[16], uint8_t(& nonce)[16]){