Some debug info

This commit is contained in:
WolverinDEV 2019-07-07 14:47:07 +02:00
parent 4dec407132
commit 65b3ffb370

View File

@ -5,6 +5,7 @@
#include <ed25519/ed25519.h> #include <ed25519/ed25519.h>
#include <ed25519/ge.h> #include <ed25519/ge.h>
#include <log/LogUtils.h> #include <log/LogUtils.h>
#include <src/misc/base64.h>
#include "misc/memtracker.h" #include "misc/memtracker.h"
#include "misc/digest.h" #include "misc/digest.h"
#include "CryptionHandler.h" #include "CryptionHandler.h"
@ -45,6 +46,7 @@ bool CryptionHandler::setupSharedSecret(const std::string& alpha, const std::str
error = "Could not calculate shared secret. Message: " + string(error_to_string(err)); error = "Could not calculate shared secret. Message: " + string(error_to_string(err));
return false; return false;
} }
debugMessage(0, "ecc_shared_secret: {}", base64::encode((char*) buffer, buffer_length));
auto result = this->setupSharedSecret(alpha, beta, string((const char*) buffer, buffer_length), error); auto result = this->setupSharedSecret(alpha, beta, string((const char*) buffer, buffer_length), error);
return result; return result;
@ -65,10 +67,12 @@ bool CryptionHandler::setupSharedSecret(const std::string& alpha, const std::str
lock_guard lock(this->cache_key_lock); lock_guard lock(this->cache_key_lock);
memcpy(this->iv_struct, ivStruct, SHA_DIGEST_LENGTH); memcpy(this->iv_struct, ivStruct, SHA_DIGEST_LENGTH);
this->iv_struct_length = SHA_DIGEST_LENGTH; this->iv_struct_length = SHA_DIGEST_LENGTH;
debugMessage(0, "iv_struct: {}", base64::encode((char*) this->iv_struct, SHA_DIGEST_LENGTH));
auto iv_hash = digest::sha1(ivStruct, SHA_DIGEST_LENGTH); auto iv_hash = digest::sha1(ivStruct, SHA_DIGEST_LENGTH);
memcpy(this->current_mac, iv_hash.data(), 8); memcpy(this->current_mac, iv_hash.data(), 8);
debugMessage(0, "Mac: {}", base64::encode((char*) this->current_mac, 8));
this->useDefaultChipherKeyNonce = false; this->useDefaultChipherKeyNonce = false;
} }