more specific type check in `encryptGCM`

Narrowed the type of `encryptGCM`'s `key` parameter from
`openarray[byte]` to `AesKey`, same as already used for `decryptGCM`.
This commit is contained in:
Etan Kissling 2021-12-11 12:40:12 +01:00
parent 9a1bb5e125
commit 172dad7968
No known key found for this signature in database
GPG Key ID: B21DA824C5A3D03D
1 changed files with 1 additions and 1 deletions

View File

@ -138,7 +138,7 @@ proc deriveKeys*(n1, n2: NodeID, priv: PrivateKey, pub: PublicKey,
toOpenArray(res, 0, sizeof(secrets) - 1)) toOpenArray(res, 0, sizeof(secrets) - 1))
secrets secrets
proc encryptGCM*(key, nonce, pt, authData: openarray[byte]): seq[byte] = proc encryptGCM*(key: AesKey, nonce, pt, authData: openarray[byte]): seq[byte] =
var ectx: GCM[aes128] var ectx: GCM[aes128]
ectx.init(key, nonce, authData) ectx.init(key, nonce, authData)
result = newSeq[byte](pt.len + gcmTagSize) result = newSeq[byte](pt.len + gcmTagSize)