Updated changelog
This commit is contained in:
parent
cb7bce6a6c
commit
037850d381
@ -111,8 +111,23 @@ void _fe_neg(fe h, const fe f) {
|
|||||||
h[8] = h8;
|
h[8] = h8;
|
||||||
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){
|
||||||
|
ge_p3 keyA{};
|
||||||
|
ge_p2 result{};
|
||||||
|
|
||||||
inline void keyMul(uint8_t* target_buffer, const uint8_t* publicKey /* compressed */, const uint8_t* privateKey /* uncompressed */, bool negate){
|
ge_frombytes_negate_vartime(&keyA, publicKey);
|
||||||
|
if(negate) {
|
||||||
|
_fe_neg(*(fe*) &keyA.X, *(const fe*) &keyA.X); /* undo negate /
|
||||||
|
_fe_neg(*(fe*) &keyA.T, *(const fe*) &keyA.T); /* undo negate /
|
||||||
|
}
|
||||||
|
ge_scalarmult_vartime(&result, privateKey, &keyA);
|
||||||
|
|
||||||
|
ge_tobytes(target_buffer, &result);
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
inline std::string keyMul(const uint8_t* publicKey /* compressed */, const uint8_t* privateKey /* uncompressed */, bool negate){
|
||||||
ge_p3 keyA{};
|
ge_p3 keyA{};
|
||||||
ge_p2 result{};
|
ge_p2 result{};
|
||||||
|
|
||||||
@ -123,9 +138,12 @@ inline void keyMul(uint8_t* target_buffer, const uint8_t* publicKey /* compresse
|
|||||||
}
|
}
|
||||||
ge_scalarmult_vartime(&result, privateKey, &keyA);
|
ge_scalarmult_vartime(&result, privateKey, &keyA);
|
||||||
|
|
||||||
ge_tobytes(target_buffer, &result);
|
char buffer[32];
|
||||||
|
ge_tobytes((uint8_t*) buffer, &result);
|
||||||
|
return string(buffer, 32);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
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 */) {
|
||||||
if(alpha.length() != 10 || beta.length() != 54)
|
if(alpha.length() != 10 || beta.length() != 54)
|
||||||
return false;
|
return false;
|
||||||
@ -143,7 +161,7 @@ bool CryptionHandler::setupSharedSecretNew(const std::string &alpha, const std::
|
|||||||
shared.resize(32, '\0');
|
shared.resize(32, '\0');
|
||||||
sharedIv.resize(64, '\0');
|
sharedIv.resize(64, '\0');
|
||||||
ed25519_key_exchange((uint8_t*) shared.data(), (uint8_t*) publicKey, (uint8_t*) privateKey);
|
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
|
shared = keyMul(reinterpret_cast<const uint8_t *>(publicKey), reinterpret_cast<const uint8_t *>(privateKey), true); //Remote key get negated
|
||||||
sharedIv = digest::sha512(shared);
|
sharedIv = digest::sha512(shared);
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user