From 13bd5e4938f6752593c6b64ac88c9055db4ea1e3 Mon Sep 17 00:00:00 2001 From: zzz <zzz@i2pmail.org> Date: Fri, 1 Jan 2021 07:13:26 -0500 Subject: [PATCH] SSU: Remove router version check for random intro key, now that the release is out --- .../router/transport/udp/UDPTransport.java | 22 +++++++++---------- 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/router/java/src/net/i2p/router/transport/udp/UDPTransport.java b/router/java/src/net/i2p/router/transport/udp/UDPTransport.java index 378cabd644..d9147829c4 100644 --- a/router/java/src/net/i2p/router/transport/udp/UDPTransport.java +++ b/router/java/src/net/i2p/router/transport/udp/UDPTransport.java @@ -395,25 +395,23 @@ public class UDPTransport extends TransportImpl implements TimedWeightedPriority UDPPacket.clearCache(); if (_log.shouldLog(Log.WARN)) _log.warn("Starting SSU transport listening"); + + // set up random intro key, as of 0.9.48 byte[] ikey = new byte[SessionKey.KEYSIZE_BYTES]; _introKey = new SessionKey(ikey); - if (VersionComparator.comp(CoreVersion.VERSION, "0.9.48") >= 0) { - String sikey = _context.getProperty(PROP_INTRO_KEY); - if (sikey != null && - _context.getEstimatedDowntime() < MIN_DOWNTIME_TO_REKEY) { - byte[] saved = Base64.decode(sikey); - if (saved != null && saved.length == SessionKey.KEYSIZE_BYTES) { - System.arraycopy(saved, 0, ikey, 0, SessionKey.KEYSIZE_BYTES); - } else { - _context.random().nextBytes(ikey); - _context.router().saveConfig(PROP_INTRO_KEY, Base64.encode(ikey)); - } + String sikey = _context.getProperty(PROP_INTRO_KEY); + if (sikey != null && + _context.getEstimatedDowntime() < MIN_DOWNTIME_TO_REKEY) { + byte[] saved = Base64.decode(sikey); + if (saved != null && saved.length == SessionKey.KEYSIZE_BYTES) { + System.arraycopy(saved, 0, ikey, 0, SessionKey.KEYSIZE_BYTES); } else { _context.random().nextBytes(ikey); _context.router().saveConfig(PROP_INTRO_KEY, Base64.encode(ikey)); } } else { - System.arraycopy(_context.routerHash().getData(), 0, ikey, 0, SessionKey.KEYSIZE_BYTES); + _context.random().nextBytes(ikey); + _context.router().saveConfig(PROP_INTRO_KEY, Base64.encode(ikey)); } // bind host -- GitLab