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
|
try
|
||||||
{
|
{
|
||||||
i2p::data::CryptoKeyType preferredCryptoType = std::stoi(it1);
|
i2p::data::CryptoKeyType cryptoType = std::stoi(it1);
|
||||||
if (!m_PreferredCryptoType && preferredCryptoType)
|
#if !OPENSSL_PQ
|
||||||
m_PreferredCryptoType = preferredCryptoType; // first non-zero in the list
|
if (cryptoType <= i2p::data::CRYPTO_KEY_TYPE_ECIES_X25519_AEAD) // skip PQ keys if not supported
|
||||||
encryptionKeyTypes.insert (preferredCryptoType);
|
#endif
|
||||||
|
{
|
||||||
|
if (!m_PreferredCryptoType && cryptoType)
|
||||||
|
m_PreferredCryptoType = cryptoType; // first non-zero in the list
|
||||||
|
encryptionKeyTypes.insert (cryptoType);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (std::exception& ex)
|
catch (std::exception& ex)
|
||||||
{
|
{
|
||||||
|
|
|
@ -413,6 +413,10 @@ namespace data
|
||||||
if (IsStoreLeases () && !preferredKeyFound) // create encryptor with leases only
|
if (IsStoreLeases () && !preferredKeyFound) // create encryptor with leases only
|
||||||
{
|
{
|
||||||
// we pick max key type if preferred not found
|
// we pick max key type if preferred not found
|
||||||
|
#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)
|
if (keyType == preferredKeyType || !m_Encryptor || keyType > m_EncryptionType)
|
||||||
{
|
{
|
||||||
auto encryptor = i2p::data::IdentityEx::CreateEncryptor (keyType, buf + offset);
|
auto encryptor = i2p::data::IdentityEx::CreateEncryptor (keyType, buf + offset);
|
||||||
|
@ -424,6 +428,7 @@ namespace data
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
offset += encryptionKeyLen;
|
offset += encryptionKeyLen;
|
||||||
}
|
}
|
||||||
// leases
|
// leases
|
||||||
|
|
Loading…
Add table
Reference in a new issue