From 2557fd35c62d77c1e92478c1b3dbbf262a7addb7 Mon Sep 17 00:00:00 2001 From: Kim De Mey Date: Fri, 16 Jul 2021 14:55:52 +0200 Subject: [PATCH] Use aesKeySize const for aes key instead if ivSize (same values) (#375) --- eth/p2p/discoveryv5/encoding.nim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eth/p2p/discoveryv5/encoding.nim b/eth/p2p/discoveryv5/encoding.nim index 41122f4..0f4e2e6 100644 --- a/eth/p2p/discoveryv5/encoding.nim +++ b/eth/p2p/discoveryv5/encoding.nim @@ -326,7 +326,7 @@ proc decodeHeader*(id: NodeId, iv, maskedHeader: openarray[byte]): # No need to check staticHeader size as that is included in minimum packet # size check in decodePacket var ectx: CTR[aes128] - ectx.init(id.toByteArrayBE().toOpenArray(0, ivSize - 1), iv) + ectx.init(id.toByteArrayBE().toOpenArray(0, aesKeySize - 1), iv) # Decrypt static-header part of the header var staticHeader = newSeq[byte](staticHeaderSize) ectx.decrypt(maskedHeader.toOpenArray(0, staticHeaderSize - 1), staticHeader)