Skip to content

Commit

Permalink
set replyIV for each hop decryption
Browse files Browse the repository at this point in the history
  • Loading branch information
orignal committed Jun 24, 2014
1 parent 53be08e commit 92dc9b3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Tunnel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,11 @@ namespace tunnel
while (hop)
{
decryption.SetKey (hop->replyKey);
decryption.SetIV (hop->replyIV);
// decrypt records after current hop
TunnelHopConfig * hop1 = hop->next;
while (hop1)
{
decryption.SetIV (hop->replyIV);
decryption.Decrypt((uint8_t *)&records[hop1->recordIndex],
sizeof (I2NPBuildRequestRecordElGamalEncrypted),
(uint8_t *)&records[hop1->recordIndex]);
Expand All @@ -93,7 +93,6 @@ namespace tunnel
while (hop)
{
decryption.SetKey (hop->replyKey);
decryption.SetIV (hop->replyIV);
// decrypt records before and including current hop
TunnelHopConfig * hop1 = hop;
while (hop1)
Expand All @@ -102,6 +101,7 @@ namespace tunnel
if (idx >= 0 && idx < msg[0])
{
uint8_t * record = msg + 1 + idx*sizeof (I2NPBuildResponseRecord);
decryption.SetIV (hop->replyIV);
decryption.Decrypt(record, sizeof (I2NPBuildResponseRecord), record);
}
else
Expand Down

0 comments on commit 92dc9b3

Please sign in to comment.