Skip to content

Commit

Permalink
net/tls: don't look for decrypted frames on non-offloaded sockets
Browse files Browse the repository at this point in the history
If the RX config of a TLS socket is SW, there is no point iterating
over the fragments and checking if frame is decrypted.  It will
always be fully encrypted.  Note that in fully encrypted case
the function doesn't actually touch any offload-related state,
so it's safe to call for TLS_SW, today.  Soon we will introduce
code which can only be called for offloaded contexts.

Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: Dirk van der Merwe <dirk.vandermerwe@netronome.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Jakub Kicinski authored and David S. Miller committed Jun 4, 2019
1 parent 87b11e0 commit b9d8fec
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions net/tls/tls_sw.c
Original file line number Diff line number Diff line change
Expand Up @@ -1492,9 +1492,11 @@ static int decrypt_skb_update(struct sock *sk, struct sk_buff *skb,

if (!ctx->decrypted) {
#ifdef CONFIG_TLS_DEVICE
err = tls_device_decrypted(sk, skb);
if (err < 0)
return err;
if (tls_ctx->rx_conf == TLS_HW) {
err = tls_device_decrypted(sk, skb);
if (err < 0)
return err;
}
#endif
/* Still not decrypted after tls_device */
if (!ctx->decrypted) {
Expand Down

0 comments on commit b9d8fec

Please sign in to comment.