Use aesKeySize const for aes key instead if ivSize (same values) (#375)

This commit is contained in:
Kim De Mey 2021-07-16 14:55:52 +02:00 committed by GitHub
parent eb0908e33f
commit 2557fd35c6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -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)