Skip to content

Commit

Permalink
tls: rx: use MAX_IV_SIZE for allocations
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Jakub Kicinski authored and David S. Miller committed Apr 13, 2022
1 parent 3547a1f commit f7d45f4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion net/tls/tls_sw.c
Original file line number Diff line number Diff line change
@@ -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.

0 comments on commit f7d45f4

Please sign in to comment.