From 92dc9b35428e56fc1228b9c3286210efa10880f3 Mon Sep 17 00:00:00 2001 From: orignal Date: Tue, 24 Jun 2014 19:33:30 -0400 Subject: [PATCH] set replyIV for each hop decryption --- Tunnel.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Tunnel.cpp b/Tunnel.cpp index 3525724c..4e0ec7c0 100644 --- a/Tunnel.cpp +++ b/Tunnel.cpp @@ -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]); @@ -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) @@ -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