From 66bf4314818facb2485e97a652beb324bf75ee46 Mon Sep 17 00:00:00 2001 From: orignal Date: Wed, 18 Jul 2018 16:27:43 -0400 Subject: [PATCH] correct KDF1 calculation --- libi2pd/NTCP2.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libi2pd/NTCP2.cpp b/libi2pd/NTCP2.cpp index 5bb866cf..4421f237 100644 --- a/libi2pd/NTCP2.cpp +++ b/libi2pd/NTCP2.cpp @@ -48,13 +48,15 @@ namespace transport 0x72, 0xe8, 0x42, 0xc5, 0x45, 0xe1, 0x80, 0x80, 0xd3, 0x9c, 0x44, 0x93, 0xbb, 0x91, 0xd7, 0xed, 0xf2, 0x28, 0x98, 0x17, 0x71, 0x21, 0x8c, 0x1f, 0x62, 0x4e, 0x20, 0x6f, 0x28, 0xd3, 0x2f, 0x71 }; // SHA256 ("Noise_XKaesobfse+hs2+hs3_25519_ChaChaPoly_SHA256") - static uint8_t h[64] = + static const uint8_t hh[32] = { 0x49, 0xff, 0x48, 0x3f, 0xc4, 0x04, 0xb9, 0xb2, 0x6b, 0x11, 0x94, 0x36, 0x72, 0xff, 0x05, 0xb5, 0x61, 0x27, 0x03, 0x31, 0xba, 0x89, 0xb8, 0xfc, 0x33, 0x15, 0x93, 0x87, 0x57, 0xdd, 0x3d, 0x1e }; // SHA256 (protocolNameHash) memcpy (m_CK, protocolNameHash, 32); // h = SHA256(h || rs) + uint8_t h[64]; + memcpy (h, hh, 32); memcpy (h + 32, rs, 32); SHA256 (h, 64, h); // h = SHA256(h || pub) @@ -645,7 +647,7 @@ namespace transport break; case eNTCP2BlkRouterInfo: { - LogPrint (eLogDebug, "NTCP2: RouterInfo flag=", frame[offset]); + LogPrint (eLogDebug, "NTCP2: RouterInfo flag=", (int)frame[offset]); i2p::data::netdb.AddRouterInfo (frame + offset + 1, size - 1); break; }