mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-04 18:09:57 +00:00
tls: Fix tls_device receive
Currently, the receive function fails to handle records already
decrypted by the device due to the commit mentioned below.
This commit advances the TLS record sequence number and prepares the context
to handle the next record.
Fixes: fedf201e12
("net: tls: Refactor control message handling on recv")
Signed-off-by: Boris Pismenny <borisp@mellanox.com>
Reviewed-by: Eran Ben Elisha <eranbe@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
7754bd63ed
commit
d069b780e3
1 changed files with 15 additions and 12 deletions
|
@ -1467,23 +1467,26 @@ static int decrypt_skb_update(struct sock *sk, struct sk_buff *skb,
|
|||
struct strp_msg *rxm = strp_msg(skb);
|
||||
int err = 0;
|
||||
|
||||
#ifdef CONFIG_TLS_DEVICE
|
||||
err = tls_device_decrypted(sk, skb);
|
||||
if (err < 0)
|
||||
return err;
|
||||
#endif
|
||||
if (!ctx->decrypted) {
|
||||
err = decrypt_internal(sk, skb, dest, NULL, chunk, zc, async);
|
||||
if (err < 0) {
|
||||
if (err == -EINPROGRESS)
|
||||
tls_advance_record_sn(sk, &tls_ctx->rx,
|
||||
version);
|
||||
|
||||
#ifdef CONFIG_TLS_DEVICE
|
||||
err = tls_device_decrypted(sk, skb);
|
||||
if (err < 0)
|
||||
return err;
|
||||
#endif
|
||||
/* Still not decrypted after tls_device */
|
||||
if (!ctx->decrypted) {
|
||||
err = decrypt_internal(sk, skb, dest, NULL, chunk, zc,
|
||||
async);
|
||||
if (err < 0) {
|
||||
if (err == -EINPROGRESS)
|
||||
tls_advance_record_sn(sk, &tls_ctx->rx,
|
||||
version);
|
||||
|
||||
return err;
|
||||
}
|
||||
}
|
||||
|
||||
rxm->full_len -= padding_length(ctx, tls_ctx, skb);
|
||||
|
||||
rxm->offset += prot->prepend_size;
|
||||
rxm->full_len -= prot->overhead_size;
|
||||
tls_advance_record_sn(sk, &tls_ctx->rx, version);
|
||||
|
|
Loading…
Reference in a new issue