mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-04-28 11:47:48 +02:00
eliminated cast to BuildResponse Record
This commit is contained in:
parent
b58d58ef29
commit
8a293f45fa
3 changed files with 21 additions and 25 deletions
|
@ -327,7 +327,7 @@ namespace i2p
|
|||
|
||||
i2p::crypto::ElGamalDecrypt (i2p::context.GetEncryptionPrivateKey (), records[i].encrypted, (uint8_t *)&clearText);
|
||||
// replace record to reply
|
||||
I2NPBuildResponseRecord * reply = (I2NPBuildResponseRecord *)(records + i);
|
||||
uint8_t * reply = (uint8_t *)(records + i);
|
||||
if (i2p::context.AcceptsTunnels ())
|
||||
{
|
||||
i2p::tunnel::TransitTunnel * transitTunnel =
|
||||
|
@ -337,13 +337,14 @@ namespace i2p
|
|||
clearText.layerKey, clearText.ivKey,
|
||||
clearText.flag & 0x80, clearText.flag & 0x40);
|
||||
i2p::tunnel::tunnels.AddTransitTunnel (transitTunnel);
|
||||
reply->ret = 0;
|
||||
reply[BUILD_RESPONSE_RECORD_RET_OFFSET] = 0;
|
||||
}
|
||||
else
|
||||
reply->ret = 30; // always reject with bandwidth reason (30)
|
||||
reply[BUILD_RESPONSE_RECORD_RET_OFFSET] = 30; // always reject with bandwidth reason (30)
|
||||
|
||||
//TODO: fill filler
|
||||
CryptoPP::SHA256().CalculateDigest(reply->hash, reply->padding, sizeof (reply->padding) + 1); // + 1 byte of ret
|
||||
CryptoPP::SHA256().CalculateDigest(reply + BUILD_RESPONSE_RECORD_HASH_OFFSET,
|
||||
reply + BUILD_RESPONSE_RECORD_PADDING_OFFSET, BUILD_RESPONSE_RECORD_PADDING_SIZE + 1); // + 1 byte of ret
|
||||
// encrypt reply
|
||||
i2p::crypto::CBCEncryption encryption;
|
||||
for (int j = 0; j < num; j++)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue