tls: rx: use MAX_IV_SIZE for allocations
authorJakub Kicinski <kuba@kernel.org>
Mon, 11 Apr 2022 19:19:16 +0000 (12:19 -0700)
committerDavid S. Miller <davem@davemloft.net>
Wed, 13 Apr 2022 10:45:39 +0000 (11:45 +0100)
IVs are 8 or 16 bytes, no point reading out the exact value
for quantities this small.

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/tls/tls_sw.c

index 2f44f57..465d902 100644 (file)
@@ -1452,7 +1452,7 @@ static int decrypt_internal(struct sock *sk, struct sk_buff *skb,
        aead_size = sizeof(*aead_req) + crypto_aead_reqsize(ctx->aead_recv);
        mem_size = aead_size + (nsg * sizeof(struct scatterlist));
        mem_size = mem_size + prot->aad_size;
-       mem_size = mem_size + crypto_aead_ivsize(ctx->aead_recv);
+       mem_size = mem_size + MAX_IV_SIZE;
 
        /* Allocate a single block of memory which contains
         * aead_req || sgin[] || sgout[] || aad || iv.