Updated changelog
This commit is contained in:
parent
0249ac35eb
commit
cb7bce6a6c
@ -112,7 +112,7 @@ void _fe_neg(fe h, const fe f) {
|
|||||||
h[9] = h9;
|
h[9] = h9;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void keyMul(uint8_t(& target_buffer)[32], const uint8_t* publicKey /* compressed */, const uint8_t* privateKey /* uncompressed */, bool negate){
|
inline void keyMul(uint8_t* target_buffer, const uint8_t* publicKey /* compressed */, const uint8_t* privateKey /* uncompressed */, bool negate){
|
||||||
ge_p3 keyA{};
|
ge_p3 keyA{};
|
||||||
ge_p2 result{};
|
ge_p2 result{};
|
||||||
|
|
||||||
@ -130,20 +130,34 @@ bool CryptionHandler::setupSharedSecretNew(const std::string &alpha, const std::
|
|||||||
if(alpha.length() != 10 || beta.length() != 54)
|
if(alpha.length() != 10 || beta.length() != 54)
|
||||||
return false;
|
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);
|
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((char*) shared, 32, shared_iv);
|
digest::sha512((char*) shared, 32, shared_iv);
|
||||||
|
*/
|
||||||
|
string shared;
|
||||||
|
string sharedIv;
|
||||||
|
shared.resize(32, '\0');
|
||||||
|
sharedIv.resize(64, '\0');
|
||||||
|
ed25519_key_exchange((uint8_t*) shared.data(), (uint8_t*) publicKey, (uint8_t*) privateKey);
|
||||||
|
keyMul(shared.data(), reinterpret_cast<const uint8_t *>(publicKey), reinterpret_cast<const uint8_t *>(privateKey), true); //Remote key get negated
|
||||||
|
sharedIv = digest::sha512(shared);
|
||||||
|
|
||||||
|
|
||||||
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] ^= xor_key[i];
|
||||||
|
sharedIv[i] ^= xor_key[i];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
lock_guard lock(this->cache_key_lock);
|
lock_guard lock(this->cache_key_lock);
|
||||||
memcpy(this->iv_struct, shared_iv, 64);
|
//memcpy(this->iv_struct, shared_iv, 64);
|
||||||
|
memcpy(this->iv_struct, sharedIv.data(), 64);
|
||||||
this->iv_struct_length = 64;
|
this->iv_struct_length = 64;
|
||||||
|
|
||||||
uint8_t mac_buffer[SHA_DIGEST_LENGTH];
|
uint8_t mac_buffer[SHA_DIGEST_LENGTH];
|
||||||
|
Loading…
Reference in New Issue
Block a user