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

Function GetAuthCookie

libi2pd/LeaseSet.cpp:629–643  ·  view source on GitHub ↗

helper for ExtractClientAuthData

Source from the content-addressed store, hash-verified

627
628 // helper for ExtractClientAuthData
629 static inline bool GetAuthCookie (const uint8_t * authClients, int numClients, const uint8_t * okm, uint8_t * authCookie)
630 {
631 // try to find clientCookie_i for clientID_i = okm[44:51]
632 for (int i = 0; i < numClients; i++)
633 {
634 if (!memcmp (okm + 44, authClients + i*40, 8)) // clientID_i
635 {
636 // clientKey_i = okm[0:31]
637 // clientIV_i = okm[32:43]
638 i2p::crypto::ChaCha20 (authClients + i*40 + 8, 32, okm, okm + 32, authCookie); // clientCookie_i
639 return true;
640 }
641 }
642 return false;
643 }
644
645 size_t LeaseSet2::ExtractClientAuthData (const uint8_t * buf, size_t len, const uint8_t * secret, const uint8_t * subcredential, uint8_t * authCookie) const
646 {

Callers 1

ExtractClientAuthDataMethod · 0.85

Calls 1

ChaCha20Function · 0.85

Tested by

no test coverage detected