detect and check imcompatible crypto between local destination and LeaseSet

This commit is contained in:
orignal
2026-06-15 17:08:05 -04:00
parent 149def0a5e
commit a776441ce1
4 changed files with 23 additions and 10 deletions
+7 -3
View File
@@ -22,13 +22,14 @@ namespace i2p
namespace data
{
LeaseSet::LeaseSet (bool storeLeases):
m_IsValid (false), m_StoreLeases (storeLeases), m_ExpirationTime (0), m_EncryptionKey (nullptr),
m_Buffer (nullptr), m_BufferLen (0)
m_IsValid (false), m_IsIncompatibleCrypto (false), m_StoreLeases (storeLeases),
m_ExpirationTime (0), m_EncryptionKey (nullptr), m_Buffer (nullptr), m_BufferLen (0)
{
}
LeaseSet::LeaseSet (const uint8_t * buf, size_t len, bool storeLeases):
m_IsValid (true), m_StoreLeases (storeLeases), m_ExpirationTime (0), m_EncryptionKey (nullptr)
m_IsValid (true), m_IsIncompatibleCrypto (false), m_StoreLeases (storeLeases),
m_ExpirationTime (0), m_EncryptionKey (nullptr)
{
m_Buffer = new uint8_t[len];
memcpy (m_Buffer, buf, len);
@@ -410,6 +411,7 @@ namespace data
// key sections
CryptoKeyType preferredKeyType = m_EncryptionType;
m_EncryptionType = 0;
m_Encryptor = nullptr; // TODO: atomic
bool preferredKeyFound = false;
if (offset + 1 > len) return 0;
int numKeySections = buf[offset]; offset++;
@@ -441,6 +443,8 @@ namespace data
}
offset += encryptionKeyLen;
}
SetIsIncompatibleCrypto (!m_Encryptor);
// leases
if (offset + 1 > len) return 0;
int numLeases = buf[offset]; offset++;