aboutsummaryrefslogtreecommitdiffstats
path: root/net/tls/tls_main.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/tls/tls_main.c')
-rw-r--r--net/tls/tls_main.c32
1 files changed, 20 insertions, 12 deletions
diff --git a/net/tls/tls_main.c b/net/tls/tls_main.c
index 301f22430469..b09867c8b817 100644
--- a/net/tls/tls_main.c
+++ b/net/tls/tls_main.c
@@ -51,15 +51,6 @@ enum {
51 TLSV6, 51 TLSV6,
52 TLS_NUM_PROTS, 52 TLS_NUM_PROTS,
53}; 53};
54enum {
55 TLS_BASE,
56 TLS_SW,
57#ifdef CONFIG_TLS_DEVICE
58 TLS_HW,
59#endif
60 TLS_HW_RECORD,
61 TLS_NUM_CONFIG,
62};
63 54
64static struct proto *saved_tcpv6_prot; 55static struct proto *saved_tcpv6_prot;
65static DEFINE_MUTEX(tcpv6_prot_mutex); 56static DEFINE_MUTEX(tcpv6_prot_mutex);
@@ -290,7 +281,10 @@ static void tls_sk_proto_close(struct sock *sk, long timeout)
290 } 281 }
291 282
292#ifdef CONFIG_TLS_DEVICE 283#ifdef CONFIG_TLS_DEVICE
293 if (ctx->tx_conf != TLS_HW) { 284 if (ctx->rx_conf == TLS_HW)
285 tls_device_offload_cleanup_rx(sk);
286
287 if (ctx->tx_conf != TLS_HW && ctx->rx_conf != TLS_HW) {
294#else 288#else
295 { 289 {
296#endif 290#endif
@@ -470,8 +464,16 @@ static int do_tls_setsockopt_conf(struct sock *sk, char __user *optval,
470 conf = TLS_SW; 464 conf = TLS_SW;
471 } 465 }
472 } else { 466 } else {
473 rc = tls_set_sw_offload(sk, ctx, 0); 467#ifdef CONFIG_TLS_DEVICE
474 conf = TLS_SW; 468 rc = tls_set_device_offload_rx(sk, ctx);
469 conf = TLS_HW;
470 if (rc) {
471#else
472 {
473#endif
474 rc = tls_set_sw_offload(sk, ctx, 0);
475 conf = TLS_SW;
476 }
475 } 477 }
476 478
477 if (rc) 479 if (rc)
@@ -629,6 +631,12 @@ static void build_protos(struct proto prot[TLS_NUM_CONFIG][TLS_NUM_CONFIG],
629 prot[TLS_HW][TLS_SW] = prot[TLS_BASE][TLS_SW]; 631 prot[TLS_HW][TLS_SW] = prot[TLS_BASE][TLS_SW];
630 prot[TLS_HW][TLS_SW].sendmsg = tls_device_sendmsg; 632 prot[TLS_HW][TLS_SW].sendmsg = tls_device_sendmsg;
631 prot[TLS_HW][TLS_SW].sendpage = tls_device_sendpage; 633 prot[TLS_HW][TLS_SW].sendpage = tls_device_sendpage;
634
635 prot[TLS_BASE][TLS_HW] = prot[TLS_BASE][TLS_SW];
636
637 prot[TLS_SW][TLS_HW] = prot[TLS_SW][TLS_SW];
638
639 prot[TLS_HW][TLS_HW] = prot[TLS_HW][TLS_SW];
632#endif 640#endif
633 641
634 prot[TLS_HW_RECORD][TLS_HW_RECORD] = *base; 642 prot[TLS_HW_RECORD][TLS_HW_RECORD] = *base;