mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-04-16 06:02:18 +02:00
skip post-quantum keys if not supported
This commit is contained in:
parent
a40fa57ed4
commit
ecf19278e8
2 changed files with 22 additions and 12 deletions
|
@ -1022,10 +1022,15 @@ namespace client
|
|||
{
|
||||
try
|
||||
{
|
||||
i2p::data::CryptoKeyType preferredCryptoType = std::stoi(it1);
|
||||
if (!m_PreferredCryptoType && preferredCryptoType)
|
||||
m_PreferredCryptoType = preferredCryptoType; // first non-zero in the list
|
||||
encryptionKeyTypes.insert (preferredCryptoType);
|
||||
i2p::data::CryptoKeyType cryptoType = std::stoi(it1);
|
||||
#if !OPENSSL_PQ
|
||||
if (cryptoType <= i2p::data::CRYPTO_KEY_TYPE_ECIES_X25519_AEAD) // skip PQ keys if not supported
|
||||
#endif
|
||||
{
|
||||
if (!m_PreferredCryptoType && cryptoType)
|
||||
m_PreferredCryptoType = cryptoType; // first non-zero in the list
|
||||
encryptionKeyTypes.insert (cryptoType);
|
||||
}
|
||||
}
|
||||
catch (std::exception& ex)
|
||||
{
|
||||
|
|
|
@ -413,15 +413,20 @@ namespace data
|
|||
if (IsStoreLeases () && !preferredKeyFound) // create encryptor with leases only
|
||||
{
|
||||
// we pick max key type if preferred not found
|
||||
if (keyType == preferredKeyType || !m_Encryptor || keyType > m_EncryptionType)
|
||||
{
|
||||
auto encryptor = i2p::data::IdentityEx::CreateEncryptor (keyType, buf + offset);
|
||||
if (encryptor)
|
||||
#if !OPENSSL_PQ
|
||||
if (keyType <= i2p::data::CRYPTO_KEY_TYPE_ECIES_X25519_AEAD) // skip PQ keys if not supported
|
||||
#endif
|
||||
{
|
||||
if (keyType == preferredKeyType || !m_Encryptor || keyType > m_EncryptionType)
|
||||
{
|
||||
m_Encryptor = encryptor; // TODO: atomic
|
||||
m_EncryptionType = keyType;
|
||||
if (keyType == preferredKeyType) preferredKeyFound = true;
|
||||
}
|
||||
auto encryptor = i2p::data::IdentityEx::CreateEncryptor (keyType, buf + offset);
|
||||
if (encryptor)
|
||||
{
|
||||
m_Encryptor = encryptor; // TODO: atomic
|
||||
m_EncryptionType = keyType;
|
||||
if (keyType == preferredKeyType) preferredKeyFound = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
offset += encryptionKeyLen;
|
||||
|
|
Loading…
Add table
Reference in a new issue