MCPcopy Create free account
hub / github.com/PurpleI2P/i2pd / Init

Method Init

libi2pd/Crypto.cpp:809–821  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

807// Noise
808
809 void NoiseSymmetricState::Init (const uint8_t * ck, const uint8_t * hh, const uint8_t * pub)
810 {
811 // pub is Bob's public static key, hh = SHA256(h)
812 memcpy (m_CK, ck, 32);
813
814 EVP_MD_CTX *ctx = EVP_MD_CTX_new ();
815 EVP_DigestInit_ex(ctx, EVP_sha256 (), NULL);
816 EVP_DigestUpdate (ctx, hh, 32);
817 EVP_DigestUpdate (ctx, pub, 32);
818 EVP_DigestFinal_ex (ctx, m_H, nullptr); // h = MixHash(pub) = SHA256(hh || pub)
819 EVP_MD_CTX_free (ctx);
820 m_N = 0;
821 }
822
823 void NoiseSymmetricState::MixHash (const uint8_t * buf, size_t len)
824 {

Callers 4

InitNoiseNStateFunction · 0.45
InitNoiseXKStateFunction · 0.45
InitNoiseXKState1Function · 0.45
InitNoiseIKStateFunction · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected