mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-02-02 06:54:15 +00:00
check AES tag first
This commit is contained in:
parent
9f79bdae9b
commit
5337aa10f7
@ -435,13 +435,8 @@ namespace garlic
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
buf += 4; // length
|
buf += 4; // length
|
||||||
if (GetEncryptionType () == i2p::data::CRYPTO_KEY_TYPE_ECIES_X25519_AEAD_RARCHET)
|
|
||||||
{
|
|
||||||
HandleECIESx25519 (buf, length - 4);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// otherwise assume ElGamal/AES
|
|
||||||
auto it = m_Tags.find (SessionTag(buf));
|
auto it = m_Tags.find (SessionTag(buf));
|
||||||
|
// AES tag might be used even if encryption type is not ElGamal/AES
|
||||||
if (it != m_Tags.end ())
|
if (it != m_Tags.end ())
|
||||||
{
|
{
|
||||||
// tag found. Use AES
|
// tag found. Use AES
|
||||||
@ -460,7 +455,13 @@ namespace garlic
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// tag not found. Use ElGamal
|
// tag not found. Handle depending on encryption type
|
||||||
|
if (GetEncryptionType () == i2p::data::CRYPTO_KEY_TYPE_ECIES_X25519_AEAD_RARCHET)
|
||||||
|
{
|
||||||
|
HandleECIESx25519 (buf, length - 4);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// otherwise assume ElGamal/AES
|
||||||
ElGamalBlock elGamal;
|
ElGamalBlock elGamal;
|
||||||
if (length >= 514 && Decrypt (buf, (uint8_t *)&elGamal, m_Ctx))
|
if (length >= 514 && Decrypt (buf, (uint8_t *)&elGamal, m_Ctx))
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user