diff options
author | Davide Caratti <dcaratti@redhat.com> | 2019-08-30 12:25:49 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2019-08-31 23:44:28 -0700 |
commit | 26811cc9f55acf835f7fdadc5ff2bbd6f06bc3ac (patch) | |
tree | 852f49de4153d6687c91600d98d559a22c5812a3 /include/net/tls.h | |
parent | 61723b393292f1e4ea27f8d123384d50b176c29d (diff) | |
download | linux-26811cc9f55acf835f7fdadc5ff2bbd6f06bc3ac.tar.bz2 |
net: tls: export protocol version, cipher, tx_conf/rx_conf to socket diag
When an application configures kernel TLS on top of a TCP socket, it's
now possible for inet_diag_handler() to collect information regarding the
protocol version, the cipher type and TX / RX configuration, in case
INET_DIAG_INFO is requested.
Signed-off-by: Davide Caratti <dcaratti@redhat.com>
Reviewed-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net/tls.h')
-rw-r--r-- | include/net/tls.h | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/include/net/tls.h b/include/net/tls.h index 4997742475cd..ec3c3ed2c6c3 100644 --- a/include/net/tls.h +++ b/include/net/tls.h @@ -431,6 +431,23 @@ static inline bool is_tx_ready(struct tls_sw_context_tx *ctx) return READ_ONCE(rec->tx_ready); } +static inline u16 tls_user_config(struct tls_context *ctx, bool tx) +{ + u16 config = tx ? ctx->tx_conf : ctx->rx_conf; + + switch (config) { + case TLS_BASE: + return TLS_CONF_BASE; + case TLS_SW: + return TLS_CONF_SW; + case TLS_HW: + return TLS_CONF_HW; + case TLS_HW_RECORD: + return TLS_CONF_HW_RECORD; + } + return 0; +} + struct sk_buff * tls_validate_xmit_skb(struct sock *sk, struct net_device *dev, struct sk_buff *skb); |