mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2026-09-01 22:18:31 +00:00
all ratchets types are eligible for ECIESx25519
This commit is contained in:
@@ -1533,6 +1533,12 @@ namespace client
|
||||
#endif
|
||||
}
|
||||
|
||||
bool ClientDestination::SupportsRatchets () const
|
||||
{
|
||||
if (m_EncryptionKeys.empty ()) return false;
|
||||
return m_EncryptionKeys.rbegin ()->first >= i2p::data::CRYPTO_KEY_TYPE_ECIES_X25519_AEAD;
|
||||
}
|
||||
|
||||
const uint8_t * ClientDestination::GetEncryptionPublicKey (i2p::data::CryptoKeyType keyType) const
|
||||
{
|
||||
auto it = m_EncryptionKeys.find (keyType);
|
||||
|
||||
@@ -296,6 +296,8 @@ namespace client
|
||||
|
||||
protected:
|
||||
|
||||
// GarlicDestionation
|
||||
bool SupportsRatchets () const override;
|
||||
// LeaseSetDestination
|
||||
void CleanupDestination () override;
|
||||
i2p::data::CryptoKeyType GetPreferredCryptoType () const override { return m_PreferredCryptoType; }
|
||||
|
||||
+2
-2
@@ -498,7 +498,7 @@ namespace garlic
|
||||
buf += 4; // length
|
||||
|
||||
bool found = false;
|
||||
if (SupportsEncryptionType (i2p::data::CRYPTO_KEY_TYPE_ECIES_X25519_AEAD))
|
||||
if (SupportsRatchets ())
|
||||
// try ECIESx25519 tag
|
||||
found = HandleECIESx25519TagMessage (buf, length);
|
||||
if (!found)
|
||||
@@ -535,7 +535,7 @@ namespace garlic
|
||||
decryption->Decrypt(buf + 514, length - 514, iv, buf + 514);
|
||||
HandleAESBlock (buf + 514, length - 514, decryption, msg->from);
|
||||
}
|
||||
else if (SupportsEncryptionType (i2p::data::CRYPTO_KEY_TYPE_ECIES_X25519_AEAD))
|
||||
else if (SupportsRatchets ())
|
||||
{
|
||||
// otherwise ECIESx25519
|
||||
auto ts = i2p::util::GetMillisecondsSinceEpoch ();
|
||||
|
||||
@@ -279,6 +279,8 @@ namespace garlic
|
||||
void SaveTags ();
|
||||
void LoadTags ();
|
||||
|
||||
virtual bool SupportsRatchets () const { return GetIdentity ()->GetCryptoKeyType () >= i2p::data::CRYPTO_KEY_TYPE_ECIES_X25519_AEAD; }
|
||||
|
||||
private:
|
||||
|
||||
void HandleAESBlock (uint8_t * buf, size_t len, std::shared_ptr<AESDecryption> decryption,
|
||||
|
||||
@@ -108,6 +108,8 @@ namespace client
|
||||
|
||||
protected:
|
||||
|
||||
// GarlicDestination
|
||||
bool SupportsRatchets () const override { return (bool)m_ECIESx25519Decryptor; }
|
||||
// LeaseSetDestination
|
||||
void CleanupDestination () override;
|
||||
i2p::data::CryptoKeyType GetPreferredCryptoType () const override;
|
||||
|
||||
Reference in New Issue
Block a user