Skip to content

Commit

Permalink
Use aesKeySize const for aes key instead if ivSize (same values) (#375)
Browse files Browse the repository at this point in the history
  • Loading branch information
kdeme committed Jul 16, 2021
1 parent eb0908e commit 2557fd3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion eth/p2p/discoveryv5/encoding.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 2557fd3

Please sign in to comment.