mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2026-08-23 23:00:23 +00:00
always pass ECIES tag as uin64_t
This commit is contained in:
@@ -881,9 +881,10 @@ namespace client
|
||||
request->excluded.insert (nextFloodfill->GetIdentHash ());
|
||||
request->requestTimeoutTimer.cancel ();
|
||||
|
||||
uint8_t replyKey[32], replyTag[32];
|
||||
uint8_t replyKey[32];
|
||||
uint64_t replyTag;
|
||||
RAND_bytes (replyKey, 32); // random session key
|
||||
RAND_bytes (replyTag, 8); // random session tag
|
||||
RAND_bytes ((uint8_t *)&replyTag, 8); // random session tag
|
||||
AddECIESx25519Key (replyKey, replyTag);
|
||||
|
||||
auto msg = WrapMessageForRouter (nextFloodfill,
|
||||
|
||||
@@ -471,13 +471,6 @@ namespace garlic
|
||||
}
|
||||
}
|
||||
|
||||
void GarlicDestination::AddECIESx25519Key (const uint8_t * key, const uint8_t * tag)
|
||||
{
|
||||
uint64_t t;
|
||||
memcpy (&t, tag, 8);
|
||||
AddECIESx25519Key (key, t);
|
||||
}
|
||||
|
||||
void GarlicDestination::AddECIESx25519Key (const uint8_t * key, uint64_t tag)
|
||||
{
|
||||
auto tagset = std::make_shared<SymmetricKeyTagSet>(this, key);
|
||||
|
||||
@@ -294,7 +294,6 @@ namespace garlic
|
||||
|
||||
protected:
|
||||
|
||||
void AddECIESx25519Key (const uint8_t * key, const uint8_t * tag); // one tag
|
||||
bool HandleECIESx25519TagMessage (uint8_t * buf, size_t len); // return true if found
|
||||
virtual void HandleI2NPMessage (const uint8_t * buf, size_t len) = 0; // called from clove only
|
||||
virtual bool HandleCloveI2NPMessage (I2NPMessageType typeID, const uint8_t * payload,
|
||||
|
||||
@@ -189,7 +189,7 @@ namespace i2p
|
||||
std::shared_ptr<I2NPMessage> CreateLeaseSetDatabaseLookupMsg (const i2p::data::IdentHash& dest,
|
||||
const std::unordered_set<i2p::data::IdentHash>& excludedFloodfills,
|
||||
std::shared_ptr<const i2p::tunnel::InboundTunnel> replyTunnel, const uint8_t * replyKey,
|
||||
const uint8_t * replyTag)
|
||||
uint64_t replyTag)
|
||||
{
|
||||
int cnt = excludedFloodfills.size ();
|
||||
auto m = cnt > 7 ? NewI2NPMessage () : NewI2NPShortMessage ();
|
||||
@@ -222,7 +222,7 @@ namespace i2p
|
||||
// encryption
|
||||
memcpy (buf, replyKey, 32);
|
||||
buf[32] = 1; // 1 tag
|
||||
memcpy (buf + 33, replyTag, 8); // 8 bytes tag
|
||||
memcpy (buf + 33, &replyTag, 8); // 8 bytes tag
|
||||
buf += 41;
|
||||
|
||||
m->len += (buf - m->GetPayload ());
|
||||
|
||||
@@ -278,7 +278,7 @@ namespace tunnel
|
||||
std::shared_ptr<I2NPMessage> CreateLeaseSetDatabaseLookupMsg (const i2p::data::IdentHash& dest,
|
||||
const std::unordered_set<i2p::data::IdentHash>& excludedFloodfills,
|
||||
std::shared_ptr<const i2p::tunnel::InboundTunnel> replyTunnel,
|
||||
const uint8_t * replyKey, const uint8_t * replyTag);
|
||||
const uint8_t * replyKey, uint64_t replyTag);
|
||||
std::shared_ptr<I2NPMessage> CreateDatabaseSearchReply (const i2p::data::IdentHash& ident, std::vector<i2p::data::IdentHash> routers);
|
||||
|
||||
std::shared_ptr<I2NPMessage> CreateDatabaseStoreMsg (std::shared_ptr<const i2p::data::RouterInfo> router = nullptr, uint32_t replyToken = 0, std::shared_ptr<const i2p::tunnel::InboundTunnel> replyTunnel = nullptr);
|
||||
|
||||
Reference in New Issue
Block a user