From ee700ac86101d127d568326b3778525039f6aa67 Mon Sep 17 00:00:00 2001 From: orignal Date: Fri, 10 Aug 2018 15:14:07 -0400 Subject: [PATCH] fixed incorrect iv for published NTCP2 addresses --- libi2pd/RouterContext.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/libi2pd/RouterContext.cpp b/libi2pd/RouterContext.cpp index ee895e32..d9bea661 100644 --- a/libi2pd/RouterContext.cpp +++ b/libi2pd/RouterContext.cpp @@ -84,11 +84,6 @@ namespace i2p routerInfo.AddSSUAddress (host.c_str(), port, routerInfo.GetIdentHash ()); routerInfo.AddNTCPAddress (host.c_str(), port); } - if (ntcp2) - { - if (!m_NTCP2Keys) NewNTCP2Keys (); - routerInfo.AddNTCP2Address (m_NTCP2Keys->staticPublicKey, m_NTCP2Keys->iv); - } routerInfo.SetCaps (i2p::data::RouterInfo::eReachable | i2p::data::RouterInfo::eSSUTesting | i2p::data::RouterInfo::eSSUIntroducer); // LR, BC @@ -97,6 +92,13 @@ namespace i2p routerInfo.CreateBuffer (m_Keys); m_RouterInfo.SetRouterIdentity (GetIdentity ()); m_RouterInfo.Update (routerInfo.GetBuffer (), routerInfo.GetBufferLen ()); + + if (ntcp2) // we don't store iv in the address if non published so we must update it from keys + { + if (!m_NTCP2Keys) NewNTCP2Keys (); + UpdateNTCP2Address (true); + } + } void RouterContext::UpdateRouterInfo ()