summaryrefslogtreecommitdiffstats
path: root/include/net/tls.h
diff options
context:
space:
mode:
authorJakub Kicinski <jakub.kicinski@netronome.com>2019-09-03 00:31:05 -0400
committerDavid S. Miller <davem@davemloft.net>2019-09-05 03:49:49 -0400
commitbe2fbc155fc8c0ff6e499753354d965cd9cf1bb0 (patch)
treefb3802026285ef0ebf27398f75a4e9db40e3b694 /include/net/tls.h
parent3544c98acd09b3b40e86f015f7df75a7d2d72a5c (diff)
net/tls: clean up the number of #ifdefs for CONFIG_TLS_DEVICE
TLS code has a number of #ifdefs which make the code a little harder to follow. Recent fixes removed the ifdef around the TLS_HW define, so we can switch to the often used pattern of defining tls_device functions as empty static inlines in the header when CONFIG_TLS_DEVICE=n. Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com> Reviewed-by: John Hurley <john.hurley@netronome.com> Reviewed-by: Dirk van der Merwe <dirk.vandermerwe@netronome.com> Acked-by: John Fastabend <john.fastabend@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net/tls.h')
-rw-r--r--include/net/tls.h38
1 files changed, 32 insertions, 6 deletions
diff --git a/include/net/tls.h b/include/net/tls.h
index 6dab6683e42f..c664e6dba0d1 100644
--- a/include/net/tls.h
+++ b/include/net/tls.h
@@ -366,13 +366,9 @@ ssize_t tls_sw_splice_read(struct socket *sock, loff_t *ppos,
366 struct pipe_inode_info *pipe, 366 struct pipe_inode_info *pipe,
367 size_t len, unsigned int flags); 367 size_t len, unsigned int flags);
368 368
369int tls_set_device_offload(struct sock *sk, struct tls_context *ctx);
370int tls_device_sendmsg(struct sock *sk, struct msghdr *msg, size_t size); 369int tls_device_sendmsg(struct sock *sk, struct msghdr *msg, size_t size);
371int tls_device_sendpage(struct sock *sk, struct page *page, 370int tls_device_sendpage(struct sock *sk, struct page *page,
372 int offset, size_t size, int flags); 371 int offset, size_t size, int flags);
373void tls_device_free_resources_tx(struct sock *sk);
374void tls_device_init(void);
375void tls_device_cleanup(void);
376int tls_tx_records(struct sock *sk, int flags); 372int tls_tx_records(struct sock *sk, int flags);
377 373
378struct tls_record_info *tls_get_record(struct tls_offload_context_tx *context, 374struct tls_record_info *tls_get_record(struct tls_offload_context_tx *context,
@@ -649,7 +645,6 @@ int tls_proccess_cmsg(struct sock *sk, struct msghdr *msg,
649 unsigned char *record_type); 645 unsigned char *record_type);
650void tls_register_device(struct tls_device *device); 646void tls_register_device(struct tls_device *device);
651void tls_unregister_device(struct tls_device *device); 647void tls_unregister_device(struct tls_device *device);
652int tls_device_decrypted(struct sock *sk, struct sk_buff *skb);
653int decrypt_skb(struct sock *sk, struct sk_buff *skb, 648int decrypt_skb(struct sock *sk, struct sk_buff *skb,
654 struct scatterlist *sgout); 649 struct scatterlist *sgout);
655struct sk_buff *tls_encrypt_skb(struct sk_buff *skb); 650struct sk_buff *tls_encrypt_skb(struct sk_buff *skb);
@@ -662,9 +657,40 @@ int tls_sw_fallback_init(struct sock *sk,
662 struct tls_offload_context_tx *offload_ctx, 657 struct tls_offload_context_tx *offload_ctx,
663 struct tls_crypto_info *crypto_info); 658 struct tls_crypto_info *crypto_info);
664 659
660#ifdef CONFIG_TLS_DEVICE
661void tls_device_init(void);
662void tls_device_cleanup(void);
663int tls_set_device_offload(struct sock *sk, struct tls_context *ctx);
664void tls_device_free_resources_tx(struct sock *sk);
665int tls_set_device_offload_rx(struct sock *sk, struct tls_context *ctx); 665int tls_set_device_offload_rx(struct sock *sk, struct tls_context *ctx);
666
667void tls_device_offload_cleanup_rx(struct sock *sk); 666void tls_device_offload_cleanup_rx(struct sock *sk);
668void tls_device_rx_resync_new_rec(struct sock *sk, u32 rcd_len, u32 seq); 667void tls_device_rx_resync_new_rec(struct sock *sk, u32 rcd_len, u32 seq);
668int tls_device_decrypted(struct sock *sk, struct sk_buff *skb);
669#else
670static inline void tls_device_init(void) {}
671static inline void tls_device_cleanup(void) {}
669 672
673static inline int
674tls_set_device_offload(struct sock *sk, struct tls_context *ctx)
675{
676 return -EOPNOTSUPP;
677}
678
679static inline void tls_device_free_resources_tx(struct sock *sk) {}
680
681static inline int
682tls_set_device_offload_rx(struct sock *sk, struct tls_context *ctx)
683{
684 return -EOPNOTSUPP;
685}
686
687static inline void tls_device_offload_cleanup_rx(struct sock *sk) {}
688static inline void
689tls_device_rx_resync_new_rec(struct sock *sk, u32 rcd_len, u32 seq) {}
690
691static inline int tls_device_decrypted(struct sock *sk, struct sk_buff *skb)
692{
693 return 0;
694}
695#endif
670#endif /* _TLS_OFFLOAD_H */ 696#endif /* _TLS_OFFLOAD_H */