]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commitdiff
net/tls: export TLS per skb encryption
authorDirk van der Merwe <dirk.vandermerwe@netronome.com>
Wed, 5 Jun 2019 21:11:40 +0000 (14:11 -0700)
committerDavid S. Miller <davem@davemloft.net>
Thu, 6 Jun 2019 21:13:40 +0000 (14:13 -0700)
While offloading TLS connections, drivers need to handle the case where
out of order packets need to be transmitted.

Other drivers obtain the entire TLS record for the specific skb to
provide as context to hardware for encryption. However, other designs
may also want to keep the hardware state intact and perform the
out of order encryption entirely on the host.

To achieve this, export the already existing software encryption
fallback path so drivers could access this.

Signed-off-by: Dirk van der Merwe <dirk.vandermerwe@netronome.com>
Reviewed-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/net/tls.h
net/tls/tls_device_fallback.c

index 3da0d941e729f562f2098d5e2907bf4589a2ab51..d1a4f365d6bec3296794f9a3f66f15657c4834c7 100644 (file)
@@ -590,6 +590,7 @@ void tls_unregister_device(struct tls_device *device);
 int tls_device_decrypted(struct sock *sk, struct sk_buff *skb);
 int decrypt_skb(struct sock *sk, struct sk_buff *skb,
                struct scatterlist *sgout);
+struct sk_buff *tls_encrypt_skb(struct sk_buff *skb);
 
 struct sk_buff *tls_validate_xmit_skb(struct sock *sk,
                                      struct net_device *dev,
index 5a087e1981c36a89a9b623481abe4e9508698ccc..1d2d804ac633f66fb323ca17940191a2fd45b06c 100644 (file)
@@ -426,6 +426,12 @@ struct sk_buff *tls_validate_xmit_skb(struct sock *sk,
 }
 EXPORT_SYMBOL_GPL(tls_validate_xmit_skb);
 
+struct sk_buff *tls_encrypt_skb(struct sk_buff *skb)
+{
+       return tls_sw_fallback(skb->sk, skb);
+}
+EXPORT_SYMBOL_GPL(tls_encrypt_skb);
+
 int tls_sw_fallback_init(struct sock *sk,
                         struct tls_offload_context_tx *offload_ctx,
                         struct tls_crypto_info *crypto_info)