aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfanquake <fanquake@gmail.com>2024-01-09 17:07:28 +0000
committerfanquake <fanquake@gmail.com>2024-01-09 17:08:06 +0000
commit5a121bcdeed2904d94c9489d352d39d22d52fc7c (patch)
tree6fd3c224733fb1aef6388f6320f71c1ee210accb
parentb3b19be20deafef550e229355cf6008f55af7a11 (diff)
parent9d728916b27e18efc6f8839770ed5ec14789fc08 (diff)
downloadbitcoin-5a121bcdeed2904d94c9489d352d39d22d52fc7c.tar.xz
Merge bitcoin/bitcoin#29200: net: create I2P sessions using both ECIES-X25519 and ElGamal encryption
9d728916b27e18efc6f8839770ed5ec14789fc08 net: create I2P sessions with both ECIES-X25519 and ElGamal encryption (Jon Atack) Pull request description: A Bitcoin Core node may only connect to a peer destination via I2P if both sides have sessions with the same encryption type. Encryption type is a property of the session, not the destination. Sessions may support multiple encryption types. As Bitcoin Core is not currently setting the encryption type when creating I2P sessions, it uses the older default, ElGamal (type 0). This pull updates our I2P session creation to use both ECIES-X25519 and ElGamal (types 4 and 0, respectively). This allows to connect to I2P peers of either type, and the newer, faster ECIES-X25519 will be preferred. See also: - discussion around https://github.com/qbittorrent/qBittorrent/issues/19625#issuecomment-1879582395 - recently updated "Signature and Encryption Types" in https://geti2p.net/en/docs/api/samv3 Thank you and credit to zzzi2p for reporting and to vort for the patch. Closes https://github.com/bitcoin/bitcoin/issues/29197. ACKs for top commit: zzzi2p: ACK 9d728916b27e18efc6f8839770ed5ec14789fc08 recursive-rat4: ACK 9d728916b27e18efc6f8839770ed5ec14789fc08 kristapsk: cr utACK 9d728916b27e18efc6f8839770ed5ec14789fc08 brunoerg: crACK 9d728916b27e18efc6f8839770ed5ec14789fc08 shaavan: crACK 9d728916b27e18efc6f8839770ed5ec14789fc08 Tree-SHA512: 0912fc01af9706914a7854f7479b9d82fc86c9530466cad8674e30f7eb4894d90d514efbc1aee8b7ea690faa6ff4a23b62cf5de8737cffdbc463300082c9b917
-rw-r--r--src/i2p.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/i2p.cpp b/src/i2p.cpp
index 685b43ba18..c891562d00 100644
--- a/src/i2p.cpp
+++ b/src/i2p.cpp
@@ -427,7 +427,7 @@ void Session::CreateIfNotCreatedAlready()
const Reply& reply = SendRequestAndGetReply(
*sock,
strprintf("SESSION CREATE STYLE=STREAM ID=%s DESTINATION=TRANSIENT SIGNATURE_TYPE=7 "
- "inbound.quantity=1 outbound.quantity=1",
+ "i2cp.leaseSetEncType=4,0 inbound.quantity=1 outbound.quantity=1",
session_id));
m_private_key = DecodeI2PBase64(reply.Get("DESTINATION"));
@@ -445,7 +445,7 @@ void Session::CreateIfNotCreatedAlready()
SendRequestAndGetReply(*sock,
strprintf("SESSION CREATE STYLE=STREAM ID=%s DESTINATION=%s "
- "inbound.quantity=3 outbound.quantity=3",
+ "i2cp.leaseSetEncType=4,0 inbound.quantity=3 outbound.quantity=3",
session_id,
private_key_b64));
}