|
|
@ -171,7 +171,8 @@ namespace i2p |
|
|
|
|
|
|
|
|
|
|
|
std::shared_ptr<I2NPMessage> CreateLeaseSetDatabaseLookupMsg (const i2p::data::IdentHash& dest, |
|
|
|
std::shared_ptr<I2NPMessage> CreateLeaseSetDatabaseLookupMsg (const i2p::data::IdentHash& dest, |
|
|
|
const std::set<i2p::data::IdentHash>& excludedFloodfills, |
|
|
|
const std::set<i2p::data::IdentHash>& excludedFloodfills, |
|
|
|
std::shared_ptr<const i2p::tunnel::InboundTunnel> replyTunnel, const uint8_t * replyKey, const uint8_t * replyTag) |
|
|
|
std::shared_ptr<const i2p::tunnel::InboundTunnel> replyTunnel, const uint8_t * replyKey, |
|
|
|
|
|
|
|
const uint8_t * replyTag, bool replyECIES) |
|
|
|
{ |
|
|
|
{ |
|
|
|
int cnt = excludedFloodfills.size (); |
|
|
|
int cnt = excludedFloodfills.size (); |
|
|
|
auto m = cnt > 7 ? NewI2NPMessage () : NewI2NPShortMessage (); |
|
|
|
auto m = cnt > 7 ? NewI2NPMessage () : NewI2NPShortMessage (); |
|
|
@ -180,7 +181,8 @@ namespace i2p |
|
|
|
buf += 32; |
|
|
|
buf += 32; |
|
|
|
memcpy (buf, replyTunnel->GetNextIdentHash (), 32); // reply tunnel GW
|
|
|
|
memcpy (buf, replyTunnel->GetNextIdentHash (), 32); // reply tunnel GW
|
|
|
|
buf += 32; |
|
|
|
buf += 32; |
|
|
|
*buf = DATABASE_LOOKUP_DELIVERY_FLAG | DATABASE_LOOKUP_ENCRYPTION_FLAG | DATABASE_LOOKUP_TYPE_LEASESET_LOOKUP; // flags
|
|
|
|
*buf = DATABASE_LOOKUP_DELIVERY_FLAG | DATABASE_LOOKUP_TYPE_LEASESET_LOOKUP; // flags
|
|
|
|
|
|
|
|
*buf |= (replyECIES ? DATABASE_LOOKUP_ECIES_FLAG : DATABASE_LOOKUP_ENCRYPTION_FLAG); |
|
|
|
buf ++; |
|
|
|
buf ++; |
|
|
|
htobe32buf (buf, replyTunnel->GetNextTunnelID ()); // reply tunnel ID
|
|
|
|
htobe32buf (buf, replyTunnel->GetNextTunnelID ()); // reply tunnel ID
|
|
|
|
buf += 4; |
|
|
|
buf += 4; |
|
|
@ -204,8 +206,16 @@ namespace i2p |
|
|
|
// encryption
|
|
|
|
// encryption
|
|
|
|
memcpy (buf, replyKey, 32); |
|
|
|
memcpy (buf, replyKey, 32); |
|
|
|
buf[32] = 1; // 1 tag
|
|
|
|
buf[32] = 1; // 1 tag
|
|
|
|
memcpy (buf + 33, replyTag, 32); |
|
|
|
if (replyECIES) |
|
|
|
buf += 65; |
|
|
|
{ |
|
|
|
|
|
|
|
memcpy (buf + 33, replyTag, 8); // 8 bytes tag
|
|
|
|
|
|
|
|
buf += 41; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
memcpy (buf + 33, replyTag, 32); // 32 bytes tag
|
|
|
|
|
|
|
|
buf += 65; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
m->len += (buf - m->GetPayload ()); |
|
|
|
m->len += (buf - m->GetPayload ()); |
|
|
|
m->FillI2NPMessageHeader (eI2NPDatabaseLookup); |
|
|
|
m->FillI2NPMessageHeader (eI2NPDatabaseLookup); |
|
|
|