Reimplement TCP-AO using crypto library
Subsystems (5)
v2 cover Reimplement TCP-AO using crypto library
This series can also be retrieved from:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/ebiggers/linux.git tcp-ao-v2
This series is targeting net-next for 7.2. To make this series self-contained in the networking code, I dropped the patches that remove support for transformation cloning from the crypto API, which is a further negative 275-line cleanup and optimization this series enables. That will be done as a follow-up, either through the crypto tree for 7.3, or still through net-next for 7.2 at maintainer preference.
This series refactors the TCP-AO (TCP Authentication Option) code to do MAC and KDF computations using lib/crypto/ instead of crypto_ahash. This greatly simplifies the code and makes it much more efficient. The entire tcp_sigpool mechanism becomes unnecessary and is removed, as the problems it was designed to solve don't exist with the library APIs.
The crypto API's support for crypto transformation cloning also becomes unnecessary and will be removed in follow-up patches. Note that as part of that, we'll be able to roll back the addition of the reference count to crypto_tfm, which had regressed performance for all crypto API users.
To make this simplification and optimization possible, this series also updates the TCP-AO code to support a specific set of algorithms, rather than arbitrary algorithms that don't make sense and are very likely not being used, e.g. CRC-32 and HMAC-MD5.
Specifically, this series retains the support for AES-128-CMAC, HMAC-SHA1, and HMAC-SHA256. AES-128-CMAC and HMAC-SHA1 are the only algorithms that are actually standardized for use in TCP-AO, while HMAC-SHA256 makes sense to continue supporting as a Linux extension. Of course, other algorithms can still be (re-)added later if ever needed. It's worth noting that TCP-AO MACs are limited to 20 bytes by the TCP options space, which limits the benefit of further algorithm upgrades.
This series passes the tcp_ao selftests
(sudo make -C tools/testing/selftests/net/tcp_ao/ run_tests).
To get a sense for how much more efficient this makes the TCP-AO code, here's a microbenchmark for tcp_ao_hash_skb() with skb->len == 128:
Algorithm Avg cycles (before) Avg cycles (after)
--------- ------------------- ------------------
HMAC-SHA1 3319 1256
HMAC-SHA256 3311 1344
AES-128-CMAC 2720 1107Changed in v2:
- Rebased onto v7.1-rc1.
- Added Ard's Reviewed-by.
- Dropped patches that clean up things in the crypto/ directory, as mentioned above. They'll be sent separately.
- Added some mentions of the MAC length being limited by the TCP options space.
- Removed unnecessary explicit assignment of values to enums.
Eric Biggers (5):
net/tcp-ao: Drop support for most non-RFC-specified algorithms net/tcp-ao: Use crypto library API instead of crypto_ahash net/tcp-ao: Use stack-allocated MAC and traffic_key buffers net/tcp-ao: Return void from functions that can no longer fail net/tcp: Remove tcp_sigpool
include/net/tcp.h | 42 +- include/net/tcp_ao.h | 74 +- net/ipv4/Kconfig | 8 +- net/ipv4/Makefile | 1 - net/ipv4/tcp_ao.c | 677 +++++++++--------- net/ipv4/tcp_output.c | 10 +- net/ipv4/tcp_sigpool.c | 366 ---------- net/ipv6/tcp_ao.c | 139 ++-- tools/testing/selftests/net/tcp_ao/config | 4 - .../selftests/net/tcp_ao/key-management.c | 41 +- 10 files changed, 440 insertions(+), 922 deletions(-) delete mode 100644 net/ipv4/tcp_sigpool.c
base-commit: 254f49634ee16a731174d2ae34bc50bd5f45e731
Signature · 1 line
2.54.0
PATCH v2 1/5 net/tcp-ao: Drop support for most non-RFC-specified algorithms
RFC 5926 (https://datatracker.ietf.org/doc/html/rfc5926) specifies the use of AES-128-CMAC and HMAC-SHA1 with TCP-AO. This includes a specification for how traffic keys shall be derived for each algorithm.
Support for any other algorithms with TCP-AO isn't standardized, though an expired Internet Draft (a work-in-progress document, not a standard) from 2019 does propose adding HMAC-SHA256 support:
https://datatracker.ietf.org/doc/html/draft-nayak-tcp-sha2-03
Since both documents specify the KDF for each algorithm individually, it isn't necessarily clear how any other algorithm should be integrated.
Nevertheless, the Linux implementation of TCP-AO allows userspace to specify the MAC algorithm as a string tcp_ao_add::alg_name naming either "cmac(aes128)" or an arbitrary algorithm in the crypto_ahash API. The set of valid strings is undocumented. The implementation assumes that "cmac(aes128)" is the only algorithm that requires an entropy extraction step and that all algorithms accept keys with length equal to the untruncated MAC; thus, arbitrary HMAC algorithms probably do work, but some other MAC algorithms like AES-256-CMAC have never actually worked.
Unfortunately, this undocumented string allows many obsolete, insecure, or redundant algorithms. For example, "hmac(md5)" and the non-cryptographic "crc32" are accepted. It also ties the implementation to crypto_ahash and requires that most memory be dynamically allocated, making the implementation unnecessarily complex and inefficient. Still furthermore, this implementation requires the crypto API to support "transformation cloning", whose only user is this feature.
Fortunately, it's very likely that only a few algorithms are actually used in practice. Let's restrict the set of allowed algorithms to "cmac(aes128)" (or "cmac(aes)" with keylen=16), "hmac(sha1)", and "hmac(sha256)". The first two are the actually standard ones, while HMAC-SHA256 seems like a reasonable algorithm to continue supporting as a Linux extension, considering the Internet Draft for it and the fact that SHA-256 is the usual choice of upgrade from the outdated SHA-1.
If any other algorithm ever turns out to be needed, e.g. HMAC-SHA512, it can of course be (re-)added in library form. However, note that the TCP options space limits TCP-AO MACs to 20 bytes (160 bits) anyway, which limits the potential benefit of any further upgrade to the algorithm.
--- net/ipv4/tcp_ao.c | 4 ++ tools/testing/selftests/net/tcp_ao/config | 1 - .../selftests/net/tcp_ao/key-management.c | 41 ++----------------- 3 files changed, 7 insertions(+), 39 deletions(-)
net/ipv4/tcp_ao.c +4 -0
@@ -1561,10 +1561,14 @@ static struct tcp_ao_key *tcp_ao_key_alloc(struct sock *sk, cmd->alg_name[ARRAY_SIZE (cmd->alg_name) -1 ] ='\0' ;/* RFC5926, 3.1.1.2. KDF_AES_128_CMAC */ if (!strcmp ("cmac(aes128)" , algo)) algo ="cmac(aes)" ; +else if (strcmp ("hmac(sha1)" , algo) && +strcmp ("hmac(sha256)" , algo) && + (strcmp ("cmac(aes)" , algo) || cmd->keylen !=16 )) +return ERR_PTR (-ENOENT );/* Full TCP header (th->doff << 2) should fit into scratch area, * see tcp_ao_hash_header(). */ pool_id =tcp_sigpool_alloc_ahash (algo,60 );
tools/testing/selftests/net/tcp_ao/config +0 -1
@@ -1,8 +1,7 @@ CONFIG_CRYPTO_CMAC=y CONFIG_CRYPTO_HMAC=y -CONFIG_CRYPTO_RMD160=y CONFIG_CRYPTO_SHA1=y CONFIG_IPV6=y CONFIG_IPV6_MULTIPLE_TABLES=y CONFIG_NET_L3_MASTER_DEV=y CONFIG_NET_VRF=y
tools/testing/selftests/net/tcp_ao/key-management.c +3 -38
81 lines not on this page · raw message
Signature · 1 line
2.54.0
PATCH v2 2/5 net/tcp-ao: Use crypto library API instead of crypto_ahash
In reply to Eric BiggersCurrently the kernel's TCP-AO implementation does the MAC and KDF computations using the crypto_ahash API. This API is inefficient and difficult to use, and it has required extensive workarounds in the form of per-CPU preallocated objects (tcp_sigpool) to work at all.
Let's use lib/crypto/ instead. This means switching to straightforward stack-allocated structures, virtually addressed buffers, and direct function calls. It also means removing quite a bit of error handling. This makes TCP-AO quite a bit faster.
This also enables many additional cleanups, which later commits will
handle: removing tcp-sigpool, removing support for crypto_tfm cloning, removing more error handling, and replacing more dynamically-allocated buffers with stack buffers based on the now-statically-known limits.
--- include/net/tcp_ao.h | 32 +- net/ipv4/Kconfig | 5 +- net/ipv4/tcp_ao.c | 523 +++++++++++----------- net/ipv6/tcp_ao.c | 63 ++- tools/testing/selftests/net/tcp_ao/config | 3 - 5 files changed, 309 insertions(+), 317 deletions(-)
include/net/tcp_ao.h +24 -8
@@ -1,11 +1,10 @@/* SPDX-License-Identifier: GPL-2.0-or-later */ #ifndef _TCP_AO_H #define _TCP_AO_H -#define TCP_AO_KEY_ALIGN 1 -#define __tcp_ao_key_align __aligned(TCP_AO_KEY_ALIGN) +#include <crypto/sha2.h> /* for SHA256_DIGEST_SIZE */ union tcp_ao_addr { struct in_addr a4; #if IS_ENABLED(CONFIG_IPV6) struct in6_addr a6;
@@ -30,15 +29,31 @@ struct tcp_ao_counters {atomic64_t key_not_found;atomic64_t ao_required;atomic64_t dropped_icmp; }; +enum tcp_ao_algo_id { +TCP_AO_ALGO_HMAC_SHA1 =1 ,/* specified by RFC 5926 */ +TCP_AO_ALGO_HMAC_SHA256 ,/* Linux extension */ +TCP_AO_ALGO_AES_128_CMAC ,/* specified by RFC 5926 */ +}; + +/* +* This is the maximum untruncated MAC length, in bytes. Note that the MACs +* actually get truncated to 20 or fewer bytes to fit in the TCP options space. +*/ +#define TCP_AO_MAX_MAC_LEN SHA256_DIGEST_SIZE + +#define TCP_AO_MAX_TRAFFIC_KEY_LEN SHA256_DIGEST_SIZE + +struct tcp_ao_mac_ctx ; +struct tcp_ao_key {struct hlist_node node;union tcp_ao_addr addr; - u8 key[TCP_AO_MAXKEYLEN] __tcp_ao_key_align; -unsigned int tcp_sigpool_id; +u8 key[TCP_AO_MAXKEYLEN ]; +enum tcp_ao_algo_id algo;unsigned int digest_size;int l3index;u8 prefixlen;u8 family;u8 keylen;
@@ -166,18 +181,19 @@ struct tcp6_ao_context {__be16 dport;__be32 sisn;__be32 disn; }; -struct tcp_sigpool ;/* Established states are fast-path and there always is current_key/rnext_key */ #define TCP_AO_ESTABLISHED (TCPF_ESTABLISHED | TCPF_FIN_WAIT1 | TCPF_FIN_WAIT2 | \ TCPF_CLOSE_WAIT | TCPF_LAST_ACK | TCPF_CLOSING)int tcp_ao_transmit_skb (struct sock *sk,struct sk_buff *skb,struct tcp_ao_key *key,struct tcphdr *th,__u8 *hash_location); +void tcp_ao_mac_update (struct tcp_ao_mac_ctx *mac_ctx,const void *data, +size_t data_len);int tcp_ao_hash_skb (unsigned short int family,char *ao_hash,struct tcp_ao_key *key,const struct sock *sk,const struct sk_buff *skb,const u8 *tkey,int hash_offset,u32 sne); int tcp_parse_ao(struct sock *sk, int cmd, unsigned short int family,
@@ -186,12 +202,12 @@ struct tcp_ao_key *tcp_ao_established_key(const struct sock *sk,struct tcp_ao_info *ao, int sndid, int rcvid);int tcp_ao_copy_all_matching (const struct sock *sk,struct sock *newsk,struct request_sock *req,struct sk_buff *skb,int family); -int tcp_ao_calc_traffic_key (struct tcp_ao_key *mkt,u8 *key,void *ctx, -unsigned int len,struct tcp_sigpool *hp); +void tcp_ao_calc_traffic_key (const struct tcp_ao_key *mkt,u8 *traffic_key, +const void *input,unsigned int input_len);void tcp_ao_destroy_sock (struct sock *sk,bool twsk);void tcp_ao_time_wait (struct tcp_timewait_sock *tcptw,struct tcp_sock *tp);bool tcp_ao_ignore_icmp (const struct sock *sk,int family,int type,int code);int tcp_ao_get_mkts (struct sock *sk,sockptr_t optval,sockptr_t optlen);int tcp_ao_get_sock_info (struct sock *sk,sockptr_t optval,sockptr_t optlen);
@@ -232,11 +248,11 @@ struct tcp_ao_key *tcp_v4_ao_lookup_rsk(const struct sock *sk, int sndid, int rcvid);int tcp_v4_ao_hash_skb (char *ao_hash,struct tcp_ao_key *key,const struct sock *sk,const struct sk_buff *skb,const u8 *tkey,int hash_offset,u32 sne);/* ipv6 specific functions */ -int tcp_v6_ao_hash_pseudoheader (struct tcp_sigpool *hp, +int tcp_v6_ao_hash_pseudoheader (struct tcp_ao_mac_ctx *mac_ctx,const struct in6_addr *daddr,const struct in6_addr *saddr,int nbytes);int tcp_v6_ao_calc_key_skb (struct tcp_ao_key *mkt,u8 *key,const struct sk_buff *skb,__be32 sisn,__be32 disn); int tcp_v6_ao_calc_key_sk(struct tcp_ao_key *mkt, u8 *key,
net/ipv4/Kconfig +3 -2
@@ -744,13 +744,14 @@ config DEFAULT_TCP_CONG config TCP_SIGPOOL tristate config TCP_AO bool "TCP: Authentication Option (RFC5925)" - select CRYPTO + select CRYPTO_LIB_AES_CBC_MACS + select CRYPTO_LIB_SHA1 + select CRYPTO_LIB_SHA256 select CRYPTO_LIB_UTILS - select TCP_SIGPOOL depends on 64BIT # seq-number extension needs WRITE_ONCE(u64) help TCP-AO specifies the use of stronger Message Authentication Codes (MACs), protects against replays for long-lived TCP connections, and provides more details on the association of security with TCP
net/ipv4/tcp_ao.c +256 -267
776 lines not on this page · raw message
net/ipv6/tcp_ao.c +26 -37
97 lines not on this page · raw message
tools/testing/selftests/net/tcp_ao/config +0 -3
@@ -1,8 +1,5 @@ -CONFIG_CRYPTO_CMAC=y -CONFIG_CRYPTO_HMAC=y -CONFIG_CRYPTO_SHA1=y CONFIG_IPV6=y CONFIG_IPV6_MULTIPLE_TABLES=y CONFIG_NET_L3_MASTER_DEV=y CONFIG_NET_VRF=y CONFIG_TCP_AO=y
Signature · 1 line
2.54.0
PATCH v2 3/5 net/tcp-ao: Use stack-allocated MAC and traffic_key buffers
In reply to Eric BiggersNow that the maximum MAC and traffic key lengths are statically-known small values, allocate MACs and traffic keys on the stack instead of with kmalloc. This eliminates multiple failure-prone GFP_ATOMIC allocations.
Note that some cases such as tcp_ao_prepare_reset() are left unchanged for now since they would require slightly wider changes.
--- net/ipv4/tcp_ao.c | 44 +++++++++++--------------------------------- net/ipv6/tcp_ao.c | 17 +++++------------ 2 files changed, 16 insertions(+), 45 deletions(-)
net/ipv4/tcp_ao.c +11 -33
@@ -737,26 +737,19 @@ int tcp_v4_ao_hash_skb(char *ao_hash, struct tcp_ao_key *key,int tcp_v4_ao_synack_hash (char *ao_hash,struct tcp_ao_key *ao_key,struct request_sock *req,const struct sk_buff *skb,int hash_offset,u32 sne) { -void *hash_buf =NULL ; +u8 tkey_buf[TCP_AO_MAX_TRAFFIC_KEY_LEN ];int err; - hash_buf =kmalloc (tcp_ao_digest_size (ao_key),GFP_ATOMIC ); -if (!hash_buf) -return -ENOMEM ; - - err =tcp_v4_ao_calc_key_rsk (ao_key, hash_buf, req); + err =tcp_v4_ao_calc_key_rsk (ao_key, tkey_buf, req);if (err) - goto out; +return err; - err =tcp_ao_hash_skb (AF_INET , ao_hash, ao_key,req_to_sk (req), skb, - hash_buf, hash_offset, sne); -out: -kfree (hash_buf); -return err; +return tcp_ao_hash_skb (AF_INET , ao_hash, ao_key,req_to_sk (req), skb, + tkey_buf, hash_offset, sne); }struct tcp_ao_key *tcp_v4_ao_lookup_rsk (const struct sock *sk,struct request_sock *req,int sndid,int rcvid)
@@ -867,13 +860,13 @@ int tcp_ao_prepare_reset(const struct sock *sk, struct sk_buff *skb,int tcp_ao_transmit_skb (struct sock *sk,struct sk_buff *skb,struct tcp_ao_key *key,struct tcphdr *th,__u8 *hash_location) {struct tcp_skb_cb *tcb =TCP_SKB_CB (skb); +u8 tkey_buf[TCP_AO_MAX_TRAFFIC_KEY_LEN ];struct tcp_sock *tp =tcp_sk (sk);struct tcp_ao_info *ao; -void *tkey_buf =NULL ;u8 *traffic_key;u32 sne; ao =rcu_dereference_protected (tcp_sk (sk)->ao_info,lockdep_sock_is_held (sk));
@@ -881,13 +874,10 @@ int tcp_ao_transmit_skb(struct sock *sk, struct sk_buff *skb,if (unlikely (tcb->tcp_flags &TCPHDR_SYN )) {__be32 disn;if (!(tcb->tcp_flags &TCPHDR_ACK )) { disn =0 ; - tkey_buf =kmalloc (tcp_ao_digest_size (key),GFP_ATOMIC ); -if (!tkey_buf) -return -ENOMEM ; traffic_key = tkey_buf; }else { disn = ao->risn; } tp->af_specific->ao_calc_key_sk(key, traffic_key,
@@ -895,11 +885,10 @@ int tcp_ao_transmit_skb(struct sock *sk, struct sk_buff *skb, } sne =tcp_ao_compute_sne (READ_ONCE (ao->snd_sne),READ_ONCE (tp->snd_una),ntohl (th->seq)); tp->af_specific->calc_ao_hash (hash_location, key, sk, skb, traffic_key, hash_location - (u8 *)th, sne); -kfree (tkey_buf);return 0 ; } static struct tcp_ao_key *tcp_ao_inbound_lookup(unsigned short int family, const struct sock *sk, const struct sk_buff *skb,
@@ -961,54 +950,48 @@ tcp_ao_verify_hash(const struct sock *sk, const struct sk_buff *skb, const struct tcp_ao_hdr *aoh, struct tcp_ao_key *key, u8 *traffic_key, u8 *phash, u32 sne, int l3index) { const struct tcphdr *th = tcp_hdr(skb);u8 maclen =tcp_ao_hdr_maclen (aoh); -void *hash_buf =NULL ; +u8 hash_buf[TCP_AO_MAX_MAC_LEN ];if (maclen !=tcp_ao_maclen (key)) {NET_INC_STATS (sock_net (sk),LINUX_MIB_TCPAOBAD );atomic64_inc (&info->counters.pkt_bad);atomic64_inc (&key->pkt_bad);trace_tcp_ao_wrong_maclen (sk, skb, aoh->keyid, aoh->rnext_keyid, maclen);return SKB_DROP_REASON_TCP_AOFAILURE ; } - hash_buf =kmalloc (tcp_ao_digest_size (key),GFP_ATOMIC ); -if (!hash_buf) -return SKB_DROP_REASON_NOT_SPECIFIED ; -/* XXX: make it per-AF callback? */ tcp_ao_hash_skb (family, hash_buf, key, sk, skb, traffic_key, (phash - (u8 *)th), sne);if (crypto_memneq (phash, hash_buf, maclen)) {NET_INC_STATS (sock_net (sk),LINUX_MIB_TCPAOBAD );atomic64_inc (&info->counters.pkt_bad);atomic64_inc (&key->pkt_bad);trace_tcp_ao_mismatch (sk, skb, aoh->keyid, aoh->rnext_keyid, maclen); -kfree (hash_buf);return SKB_DROP_REASON_TCP_AOFAILURE ; }NET_INC_STATS (sock_net (sk),LINUX_MIB_TCPAOGOOD );atomic64_inc (&info->counters.pkt_good);atomic64_inc (&key->pkt_good); -kfree (hash_buf);return SKB_NOT_DROPPED_YET ; }enum skb_drop_reason tcp_inbound_ao_hash (struct sock *sk,const struct sk_buff *skb,unsigned short int family,const struct request_sock *req,int l3index,const struct tcp_ao_hdr *aoh) { +u8 tkey_buf[TCP_AO_MAX_TRAFFIC_KEY_LEN ];const struct tcphdr *th =tcp_hdr (skb);u8 maclen =tcp_ao_hdr_maclen (aoh);u8 *phash = (u8 *)(aoh +1 );/* hash goes just after the header */ struct tcp_ao_info *info; -enum skb_drop_reason ret;struct tcp_ao_key *key;__be32 sisn, disn;u8 *traffic_key;int state;u32 sne =0 ;
@@ -1112,18 +1095,13 @@ tcp_inbound_ao_hash(struct sock *sk, const struct sk_buff *skb, }else {WARN_ONCE (1 ,"TCP-AO: Unexpected sk_state %d" , state);return SKB_DROP_REASON_TCP_AOFAILURE ; } verify_hash: - traffic_key =kmalloc (tcp_ao_digest_size (key),GFP_ATOMIC ); -if (!traffic_key) -return SKB_DROP_REASON_NOT_SPECIFIED ; -tcp_ao_calc_key_skb (key, traffic_key, skb, sisn, disn, family); - ret =tcp_ao_verify_hash (sk, skb, family, info, aoh, key, - traffic_key, phash, sne, l3index); -kfree (traffic_key); -return ret; +tcp_ao_calc_key_skb (key, tkey_buf, skb, sisn, disn, family); +return tcp_ao_verify_hash (sk, skb, family, info, aoh, key, + tkey_buf, phash, sne, l3index); key_not_found:NET_INC_STATS (sock_net (sk),LINUX_MIB_TCPAOKEYNOTFOUND );atomic64_inc (&info->counters.key_not_found); trace_tcp_ao_key_not_found(sk, skb, aoh->keyid,
net/ipv6/tcp_ao.c +5 -12
@@ -136,22 +136,15 @@ int tcp_v6_parse_ao(struct sock *sk, int cmd,int tcp_v6_ao_synack_hash (char *ao_hash,struct tcp_ao_key *ao_key,struct request_sock *req,const struct sk_buff *skb,int hash_offset,u32 sne) { -void *hash_buf =NULL ; +u8 tkey_buf[TCP_AO_MAX_TRAFFIC_KEY_LEN ];int err; - hash_buf =kmalloc (tcp_ao_digest_size (ao_key),GFP_ATOMIC ); -if (!hash_buf) -return -ENOMEM ; - - err =tcp_v6_ao_calc_key_rsk (ao_key, hash_buf, req); + err =tcp_v6_ao_calc_key_rsk (ao_key, tkey_buf, req);if (err) - goto out; +return err; - err =tcp_ao_hash_skb (AF_INET6 , ao_hash, ao_key,req_to_sk (req), skb, - hash_buf, hash_offset, sne); -out: -kfree (hash_buf); -return err; +return tcp_ao_hash_skb (AF_INET6 , ao_hash, ao_key,req_to_sk (req), skb, + tkey_buf, hash_offset, sne); }
Signature · 1 line
2.54.0
PATCH v2 4/5 net/tcp-ao: Return void from functions that can no longer fail
In reply to Eric BiggersSince tcp-ao now uses the crypto library API instead of crypto_ahash, and MACs and keys now have a statically-known maximum size, many tcp-ao functions can no longer fail. Propagate this change up into the return types of various functions.
--- include/net/tcp.h | 8 +-- include/net/tcp_ao.h | 44 +++++++-------- net/ipv4/tcp_ao.c | 128 ++++++++++++++++++++++-------------------- net/ipv4/tcp_output.c | 10 +--- net/ipv6/tcp_ao.c | 65 ++++++++++----------- 5 files changed, 123 insertions(+), 132 deletions(-)
include/net/tcp.h +4 -4
@@ -2508,13 +2508,13 @@ struct tcp_sock_af_ops {#ifdef CONFIG_TCP_AO int (*ao_parse)(struct sock *sk,int optname,sockptr_t optval,int optlen);struct tcp_ao_key *(*ao_lookup)(const struct sock *sk,struct sock *addr_sk,int sndid,int rcvid); -int (*ao_calc_key_sk)(struct tcp_ao_key *mkt,u8 *key, -const struct sock *sk, -__be32 sisn,__be32 disn,bool send); +void (*ao_calc_key_sk)(struct tcp_ao_key *mkt,u8 *key, +const struct sock *sk, +__be32 sisn,__be32 disn,bool send);int (*calc_ao_hash)(char *location,struct tcp_ao_key *ao,const struct sock *sk,const struct sk_buff *skb,const u8 *tkey,int hash_offset,u32 sne);#endif };
@@ -2531,11 +2531,11 @@ struct tcp_request_sock_ops {#endif #ifdef CONFIG_TCP_AO struct tcp_ao_key *(*ao_lookup)(const struct sock *sk,struct request_sock *req,int sndid,int rcvid); -int (*ao_calc_key)(struct tcp_ao_key *mkt,u8 *key,struct request_sock *sk); +void (*ao_calc_key)(struct tcp_ao_key *mkt,u8 *key,struct request_sock *sk);int (*ao_synack_hash)(char *ao_hash,struct tcp_ao_key *mkt,struct request_sock *req,const struct sk_buff *skb,int hash_offset,u32 sne);#endif #ifdef CONFIG_SYN_COOKIES
include/net/tcp_ao.h +22 -22
82 lines not on this page · raw message
net/ipv4/tcp_ao.c +66 -62
245 lines not on this page · raw message
net/ipv4/tcp_output.c +2 -8
@@ -1661,18 +1661,12 @@ static int __tcp_transmit_skb(struct sock *sk, struct sk_buff *skb,sk_gso_disable (sk); tp->af_specific->calc_md5_hash (opts.hash_location, key.md5_key, sk, skb);#endif }else if (tcp_key_is_ao (&key)) { -int err; - - err =tcp_ao_transmit_skb (sk, skb, key.ao_key, th, - opts.hash_location); -if (err) { -sk_skb_reason_drop (sk, skb,SKB_DROP_REASON_NOT_SPECIFIED ); -return -ENOMEM ; - } +tcp_ao_transmit_skb (sk, skb, key.ao_key, th, + opts.hash_location); }/* BPF prog is the last one writing header option */ bpf_skops_write_hdr_opt (sk, skb,NULL ,NULL ,0 , &opts);
net/ipv6/tcp_ao.c +29 -36
131 lines not on this page · raw message
Signature · 1 line
2.54.0
PATCH v2 5/5 net/tcp: Remove tcp_sigpool
In reply to Eric Biggerstcp_sigpool is no longer used. It existed only as a workaround for issues in the design of the crypto_ahash API, which have been avoided by switching to the much easier-to-use library APIs instead. Remove it.
--- include/net/tcp.h | 34 ---- net/ipv4/Kconfig | 3 - net/ipv4/Makefile | 1 - net/ipv4/tcp_sigpool.c | 366 ----------------------------------------- 4 files changed, 404 deletions(-) delete mode 100644 net/ipv4/tcp_sigpool.c
include/net/tcp.h +0 -34
@@ -2015,44 +2015,10 @@ struct tcp6_pseudohdr {struct in6_addr daddr;__be32 len;__be32 protocol;/* including padding */ }; -/* -* struct tcp_sigpool - per-CPU pool of ahash_requests -* @scratch: per-CPU temporary area, that can be used between -* tcp_sigpool_start() and tcp_sigpool_end() to perform -* crypto request -* @req: pre-allocated ahash request -*/ -struct tcp_sigpool { -void *scratch; -struct ahash_request *req; -}; - -int tcp_sigpool_alloc_ahash (const char *alg,size_t scratch_size); -void tcp_sigpool_get (unsigned int id); -void tcp_sigpool_release (unsigned int id); -int tcp_sigpool_hash_skb_data (struct tcp_sigpool *hp, -const struct sk_buff *skb, -unsigned int header_len); - -/** -* tcp_sigpool_start - disable bh and start using tcp_sigpool_ahash -* @id: tcp_sigpool that was previously allocated by tcp_sigpool_alloc_ahash() -* @c: returned tcp_sigpool for usage (uninitialized on failure) -* -* Returns: 0 on success, error otherwise. -*/ -int tcp_sigpool_start (unsigned int id,struct tcp_sigpool *c); -/** -* tcp_sigpool_end - enable bh and stop using tcp_sigpool -* @c: tcp_sigpool context that was returned by tcp_sigpool_start() -*/ -void tcp_sigpool_end (struct tcp_sigpool *c); -size_t tcp_sigpool_algo (unsigned int id,char *buf,size_t buf_len); -/* - functions */ void tcp_v4_md5_hash_skb (char *md5_hash,const struct tcp_md5sig_key *key,const struct sock *sk,const struct sk_buff *skb);int tcp_md5_do_add (struct sock *sk,const union tcp_md5_addr *addr,int family,u8 prefixlen,int l3index,u8 flags,const u8 *newkey,u8 newkeylen);
net/ipv4/Kconfig +0 -3
@@ -739,13 +739,10 @@ config DEFAULT_TCP_CONG default "dctcp" if DEFAULT_DCTCP default "cdg" if DEFAULT_CDG default "bbr" if DEFAULT_BBR default "cubic" -config TCP_SIGPOOL - tristate - config TCP_AO bool "TCP: Authentication Option (RFC5925)" select CRYPTO_LIB_AES_CBC_MACS select CRYPTO_LIB_SHA1 select CRYPTO_LIB_SHA256
net/ipv4/Makefile +0 -1
@@ -58,11 +58,10 @@ obj-$(CONFIG_TCP_CONG_NV) += tcp_nv.o obj-$(CONFIG_TCP_CONG_VENO) += tcp_veno.o obj-$(CONFIG_TCP_CONG_SCALABLE) += tcp_scalable.o obj-$(CONFIG_TCP_CONG_LP) += tcp_lp.o obj-$(CONFIG_TCP_CONG_YEAH) += tcp_yeah.o obj-$(CONFIG_TCP_CONG_ILLINOIS) += tcp_illinois.o -obj-$(CONFIG_TCP_SIGPOOL) += tcp_sigpool.o obj-$(CONFIG_NET_SOCK_MSG) += tcp_bpf.o obj-$(CONFIG_BPF_SYSCALL) += udp_bpf.o obj-$(CONFIG_NETLABEL) += cipso_ipv4.o obj-$(CONFIG_XFRM) += xfrm4_policy.o xfrm4_state.o xfrm4_input.o \
net/ipv4/tcp_sigpool.c deleted +0 -366
366 lines not on this page · raw message
Signature · 1 line
2.54.0
Hi Eric,
On Mon, 27 Apr 2026 at 18:27, Eric Biggers <[email protected]> wrote:
[..]
Quoted 16 lines
To make this simplification and optimization possible, this series also updates the TCP-AO code to support a specific set of algorithms, rather than arbitrary algorithms that don't make sense and are very likely not being used, e.g. CRC-32 and HMAC-MD5.
Specifically, this series retains the support for AES-128-CMAC, HMAC-SHA1, and HMAC-SHA256. AES-128-CMAC and HMAC-SHA1 are the only algorithms that are actually standardized for use in TCP-AO, while HMAC-SHA256 makes sense to continue supporting as a Linux extension. Of course, other algorithms can still be (re-)added later if ever needed. It's worth noting that TCP-AO MACs are limited to 20 bytes by the TCP options space, which limits the benefit of further algorithm upgrades.
This series passes the
tcp_aoselftests
(sudo make -Ctools/testing/selftests/net/tcp_ao/run_tests).
Quoted 8 lines
To get a sense for how much more efficient this makes the TCP-AO code, here's a microbenchmark for
tcp_ao_hash_skb()withskb->len== 128:Algorithm Avg cycles (before) Avg cycles (after) --------- ------------------- ------------------ HMAC-SHA1 3319 1256 HMAC-SHA256 3311 1344 AES-128-CMAC 2720 1107
I do like these numbers quite much! Yet, as I mentioned in version 1, removing a fallback for other algorithms' support does not sound good to me. There are two reasons:
- Ronald P. Bonica (the original RFC5925 author), together with Tony Li do have an active RFC draft to support the additional algorithms [1], potentially in addition to TCP Extended Options [2]
- There is at least one open-source BGP implementation (BIRD) that allows using the algorithms that you are removing [3]. Without a deprecation period and communication with at least known open source users, it implies intentionally breaking them, which I can't agree with.
I don't feel like Naking as we don't have any customers using anything other than the 3 algorithms above (and BGP implementation is [unfortunately] closed-source, so that would not feel appropriate even if we had such customers), yet I do feel like it's worth and appropriate to express my thoughts/concerns.
[1] https://www.ietf.org/archive/id/draft-bonica-tcpm-tcp-ao-algs-00.html
[2] https://www.ietf.org/archive/id/draft-bonica-tcpm-extended-options-00.html
[3] https://github.com/CZ-NIC/bird/blob/master/sysdep/linux/sysio.h#L246
Thanks,
Dmitry
Quoted 28 lines · Dmitry Safonov
Quoted 8 lines
To get a sense for how much more efficient this makes the TCP-AO code, here's a microbenchmark for
tcp_ao_hash_skb()withskb->len== 128:Algorithm Avg cycles (before) Avg cycles (after) --------- ------------------- ------------------ HMAC-SHA1 3319 1256 HMAC-SHA256 3311 1344 AES-128-CMAC 2720 1107I do like these numbers quite much! Yet, as I mentioned in version 1, removing a fallback for other algorithms' support does not sound good to me. There are two reasons:
- Ronald P. Bonica (the original RFC5925 author), together with Tony Li do have an active RFC draft to support the additional algorithms [1], potentially in addition to TCP Extended Options [2]
- There is at least one open-source BGP implementation (BIRD) that allows using the algorithms that you are removing [3]. Without a deprecation period and communication with at least known open source users, it implies intentionally breaking them, which I can't agree with.I don't feel like Naking as we don't have any customers using anything other than the 3 algorithms above (and BGP implementation is [unfortunately] closed-source, so that would not feel appropriate even if we had such customers), yet I do feel like it's worth and appropriate to express my thoughts/concerns.
Quoted 3 lines
[1] https://www.ietf.org/archive/id/draft-bonica-tcpm-tcp-ao-algs-00.html
[2] https://www.ietf.org/archive/id/draft-bonica-tcpm-extended-options-00.html
[3] https://github.com/CZ-NIC/bird/blob/master/sysdep/linux/sysio.h#L246
I think the usual "it's not really broken if no one notices" is likely to apply here. Indeed, there have been many cases where algorithms have been removed from the crypto API before, despite this theoretically impacting UAPI. Just some of the removals from crypto_ahash over the years that come to mind are the Tiger hash algorithms, multiple variants of RIPEMD, multiple CRC variants, GHASH, Poly1305, NH, and POLYVAL.
The reality is that the crypto API's algorithm specification language provides way more "flexibility" than anyone knows what to do with or ever should have existed at all, let alone been exposed directly to userspace.
We don't have a lot of choice but to clean up these old mistakes to keep Linux maintainable going forwards, reduce the chance for user error, and optimize for the things that actually matter.
And again, as I said, if there is another algorithm that someone actually needs, we can add it back as a bug fix (or as a new feature, considering that some never worked in the first place).
- Eric
Jakub Kicinski
maintainerQuoted 12 lines · On Mon, 27 Apr 2026 20:09:05 +0100 Dmitry Safonov wrote:
I do like these numbers quite much! Yet, as I mentioned in version 1, removing a fallback for other algorithms' support does not sound good to me. There are two reasons:
- Ronald P. Bonica (the original RFC5925 author), together with Tony Li do have an active RFC draft to support the additional algorithms [1], potentially in addition to TCP Extended Options [2]
- There is at least one open-source BGP implementation (BIRD) that allows using the algorithms that you are removing [3]. Without a deprecation period and communication with at least known open source users, it implies intentionally breaking them, which I can't agree with.
Quoted 5 lines
I don't feel like Naking as we don't have any customers using anything other than the 3 algorithms above (and BGP implementation is [unfortunately] closed-source, so that would not feel appropriate even if we had such customers), yet I do feel like it's worth and appropriate to express my thoughts/concerns.
What do you want to happen? You are the maintainer of this code, you don't get so say "i don't want to nack it but also no" :) Like Eric says if there are no real users code can be deleted.
Adding deprecation warnings upstream is quite slow, IDK if injecting deprecation warnings to stable has been discussed..
Quoted 2 lines · Eric Biggers
Quoted 2 lines
- Ronald P. Bonica (the original RFC5925 author), together with Tony Li do have an active RFC draft to support the additional algorithms
[...]
Quoted 1 line
For what it's worth, that draft makes very little sense. For example, it proposes three variants of HMAC-SHA3, instead of just making the modern choice of KMAC256. And it proposes both HMAC-SHA384 and HMAC-SHA512, despite them being redundant with each other after the specified truncation to 128 bits.
Thus, it's clear that draft needs some work. That would include, for example, input from people who may be more familiar with best practices for choosing cryptographic algorithms in new designs.
So I don't think the Linux kernel's implementation should, or needs to, already implement all the algorithms in that unofficial draft.
All that's needed is the flexibility to add new algorithms later, whether from a fixed version of that draft or from somewhere else.
We'll still have that with the library.
And to emphasize again, the current code also isn't really generic. So the support for new MACs doesn't necessarily come for free currently. It probably works for arbitrary HMACs. But HMAC != MAC. If AES-256-CMAC, BLAKE2, KMAC256, Poly1305-AES, or just about any other MAC is ever needed, the code would have to be changed to support it anyway.
- Eric
Quoted 14 lines · Jakub Kicinski
Quoted 12 lines · On Mon, 27 Apr 2026 20:09:05 +0100 Dmitry Safonov wrote:
I do like these numbers quite much! Yet, as I mentioned in version 1, removing a fallback for other algorithms' support does not sound good to me. There are two reasons:
- Ronald P. Bonica (the original RFC5925 author), together with Tony Li do have an active RFC draft to support the additional algorithms [1], potentially in addition to TCP Extended Options [2]
- There is at least one open-source BGP implementation (BIRD) that allows using the algorithms that you are removing [3]. Without a deprecation period and communication with at least known open source users, it implies intentionally breaking them, which I can't agree with.
Quoted 8 lines
Quoted 5 lines
I don't feel like Naking as we don't have any customers using anything other than the 3 algorithms above (and BGP implementation is [unfortunately] closed-source, so that would not feel appropriate even if we had such customers), yet I do feel like it's worth and appropriate to express my thoughts/concerns.
What do you want to happen? You are the maintainer of this code, you don't get so say "i don't want to nack it but also no" :)
Yeah, that's not what I meant. I see value in Eric's contribution, and I like getting rid of tcp-sigpool. So, anything but "nack" is not "no" :-)
Quoted 3 lines
Like Eric says if there are no real users code can be deleted. Adding deprecation warnings upstream is quite slow, IDK if injecting deprecation warnings to stable has been discussed..
FWIW, I've written to bird's mailing list inviting them to this thread; in case if they need other algorithms to be supported, hopefully that should avoid any breakages on their side. I'm aware that ciena and fortinet use tcp-ao too, but I'm less concerned, as they aren't open source.
Thanks,
Dmitry
Re: [PATCH net-next v2 2/5] net/tcp-ao: Use crypto library API instead of crypto_ahash
In reply to Eric BiggersQuoted 17 lines · On Mon, 27 Apr 2026 10:27:24 -0700 Eric Biggers <[email protected]> wrote:
Currently the kernel's TCP-AO implementation does the MAC and KDF computations using the
crypto_ahashAPI. This API is inefficient and difficult to use, and it has required extensive workarounds in the form of per-CPU preallocated objects (tcp_sigpool) to work at all.Let's use
lib/crypto/instead. This means switching to straightforward stack-allocated structures, virtually addressed buffers, and direct function calls. It also means removing quite a bit of error handling. This makes TCP-AO quite a bit faster.This also enables many additional cleanups, which later commits will
handle: removing tcp-sigpool, removing support forcrypto_tfmcloning, removing more error handling, and replacing more dynamically-allocated buffers with stack buffers based on the now-statically-known limits.Reviewed-by Ard Biesheuvel <[email protected]>Signed-off-by Eric Biggers <[email protected]>
...
net/ipv4/tcp_ao.c static int tcp_v4_ao_calc_key(struct tcp_ao_key *mkt, u8 *key, · line 349
Quoted 7 lines
net/ipv4/tcp_ao.c +0
-1@@ -344,33 +444,26 @@ static int tcp_v4_ao_calc_key(struct tcp_ao_key *mkt, u8 *key,struct kdf_input_block {u8 counter;u8 label[6 ];struct tcp4_ao_context ctx;__be16 outlen; - } __packed * tmp;
That looks a bit horrid.
I also had a feeling that the compiler sometimes rejects non-packed structures inside packed ones.
Perhaps nest the whole thing inside another structure that has an initial u8 pad and is marked __packed __aligned(4).
Then the assignments to the fields of 'ctx' will be known to be aligned even when tcp4_ao_context is also __packed.
David
Quoted 39 lines
net/ipv4/tcp_ao.c +16
-22-struct tcp_sigpool hp; -int err; - - err =tcp_sigpool_start (mkt->tcp_sigpool_id, &hp); -if (err) -return err; - - tmp = hp.scratch; - tmp->counter =1 ; -memcpy (tmp->label,"TCP-AO" ,6 ); - tmp->ctx.saddr = saddr; - tmp->ctx.daddr = daddr; - tmp->ctx.sport = sport; - tmp->ctx.dport = dport; - tmp->ctx.sisn = sisn; - tmp->ctx.disn = disn; - tmp->outlen =htons (tcp_ao_digest_size (mkt) *8 );/* in bits */ - - err =tcp_ao_calc_traffic_key (mkt, key, tmp,sizeof (*tmp), &hp); -tcp_sigpool_end (&hp); - -return err; + }__packed input = { + .counter =1 , + .label ="TCP-AO" , + .ctx = { + .saddr = saddr, + .daddr = daddr, + .sport = sport, + .dport = dport, + .sisn = sisn, + .disn = disn, + }, + .outlen =htons (tcp_ao_digest_size (mkt) *8 ),/* in bits */ + }; + +tcp_ao_calc_traffic_key (mkt, key, &input,sizeof (input)); +return 0 ; }
Re: [PATCH net-next v2 2/5] net/tcp-ao: Use crypto library API instead of crypto_ahash
Quoted 37 lines · David Laight
Quoted 17 lines · On Mon, 27 Apr 2026 10:27:24 -0700 Eric Biggers <[email protected]> wrote:
Currently the kernel's TCP-AO implementation does the MAC and KDF computations using the
crypto_ahashAPI. This API is inefficient and difficult to use, and it has required extensive workarounds in the form of per-CPU preallocated objects (tcp_sigpool) to work at all.Let's use
lib/crypto/instead. This means switching to straightforward stack-allocated structures, virtually addressed buffers, and direct function calls. It also means removing quite a bit of error handling. This makes TCP-AO quite a bit faster.This also enables many additional cleanups, which later commits will
handle: removing tcp-sigpool, removing support forcrypto_tfmcloning, removing more error handling, and replacing more dynamically-allocated buffers with stack buffers based on the now-statically-known limits.Reviewed-by Ard Biesheuvel <[email protected]>Signed-off-by Eric Biggers <[email protected]>...
net/ipv4/tcp_ao.c static int tcp_v4_ao_calc_key(struct tcp_ao_key *mkt, u8 *key, · line 349
Quoted 7 lines
net/ipv4/tcp_ao.c +0
-1@@ -344,33 +444,26 @@ static int tcp_v4_ao_calc_key(struct tcp_ao_key *mkt, u8 *key,struct kdf_input_block {u8 counter;u8 label[6 ];struct tcp4_ao_context ctx;__be16 outlen; - } __packed * tmp;That looks a bit horrid.
I also had a feeling that the compiler sometimes rejects non-packed structures inside packed ones.
Perhaps nest the whole thing inside another structure that has an initial u8 pad and is marked__packed__aligned(4).
Then the assignments to the fields of 'ctx' will be known to be aligned even whentcp4_ao_contextis also__packed.
Quoted 1 line
David
This series doesn't change the definition of struct kdf_input_block. Could we defer changing it (if it makes sense to) to a later patch? Yes, there might be a way to get the be32 and be16 fields naturally aligned and get the compiler to understand that. But that would be a pretty small micro-optimization compared to removing all the tcp_sigpool overhead from the same function (which this series does).
- Eric
Quoted 33 lines · Dmitry Safonov
Quoted 15 lines · Jakub Kicinski
Quoted 13 lines · On Mon, 27 Apr 2026 20:09:05 +0100 Dmitry Safonov wrote:
I do like these numbers quite much! Yet, as I mentioned in version 1, removing a fallback for other algorithms' support does not sound good to me. There are two reasons:
- Ronald P. Bonica (the original RFC5925 author), together with Tony Li do have an active RFC draft to support the additional algorithms
[1], potentially in addition to TCP Extended Options [2]
- There is at least one open-source BGP implementation (BIRD) that allows using the algorithms that you are removing [3]. Without a deprecation period and communication with at least known open source users, it implies intentionally breaking them, which I can't agree with.Quoted 8 lines
Quoted 5 lines
I don't feel like Naking as we don't have any customers using anything other than the 3 algorithms above (and BGP implementation is [unfortunately] closed-source, so that would not feel appropriate even if we had such customers), yet I do feel like it's worth and appropriate to express my thoughts/concerns.
What do you want to happen? You are the maintainer of this code, you don't get so say "i don't want to nack it but also no" :)
Yeah, that's not what I meant. I see value in Eric's contribution, and I like getting rid of tcp-sigpool. So, anything but "nack" is not "no" :-)
Quoted 3 lines
Like Eric says if there are no real users code can be deleted. Adding deprecation warnings upstream is quite slow, IDK if injecting deprecation warnings to stable has been discussed..
Quoted 6 lines
FWIW, I've written to bird's mailing list inviting them to this thread; in case if they need other algorithms to be supported, hopefully that should avoid any breakages on their side. I'm aware that ciena and fortinet use tcp-ao too, but I'm less concerned, as they aren't open source.
Strongly agree with Eric here.
We've been well aware for some time now that the LEGO brick model doesn't really work that well with crypto, and being able to combine arbitrary cryptographic primitives to construct your own algorithms from user space is not a feature, it's a bug.
Sure, you can use HMAC to construct a MAC algorithm from any hash algorithm. But hashes are typically much more costly in terms of performance, due to the fact that they need to protect against collisions. MAC algorithms do not have this requirement, because they involve a secret key which is used symmetrically, i.e., both for signing and for authentication. IOW, forging a message to match a given MAC would require knowledge of the secret key, at which point an attacker can just use it to sign the message.
This is the reason why more modern algorithms involving MACs use GHASH or Poly1305 instead (or KMAC256 as Eric suggested), which perform much better. Even AES-CMAC is not a great choice in this context. But these algorithms need to be constructed carefully, not just swapped in.
Re: [PATCH net-next v2 2/5] net/tcp-ao: Use crypto library API instead of crypto_ahash
In reply to David LaightQuoted 21 lines · David Laight
Quoted 17 lines · On Mon, 27 Apr 2026 10:27:24 -0700 Eric Biggers <[email protected]> wrote:
Currently the kernel's TCP-AO implementation does the MAC and KDF computations using the
crypto_ahashAPI. This API is inefficient and difficult to use, and it has required extensive workarounds in the form of per-CPU preallocated objects (tcp_sigpool) to work at all.Let's use
lib/crypto/instead. This means switching to straightforward stack-allocated structures, virtually addressed buffers, and direct function calls. It also means removing quite a bit of error handling. This makes TCP-AO quite a bit faster.This also enables many additional cleanups, which later commits will
handle: removing tcp-sigpool, removing support forcrypto_tfmcloning, removing more error handling, and replacing more dynamically-allocated buffers with stack buffers based on the now-statically-known limits.Reviewed-by Ard Biesheuvel <[email protected]>Signed-off-by Eric Biggers <[email protected]>...
Quoted 16 lines
net/ipv4/tcp_ao.c static int tcp_v4_ao_calc_key(struct tcp_ao_key *mkt, u8 *key, · line 349
Quoted 7 lines
net/ipv4/tcp_ao.c +0
-1@@ -344,33 +444,26 @@ static int tcp_v4_ao_calc_key(struct tcp_ao_key *mkt, u8 *key,struct kdf_input_block {u8 counter;u8 label[6 ];struct tcp4_ao_context ctx;__be16 outlen; - } __packed * tmp;That looks a bit horrid.
I also had a feeling that the compiler sometimes rejects non-packed structures inside packed ones.
Perhaps nest the whole thing inside another structure that has an initial u8 pad and is marked__packed__aligned(4).
Then the assignments to the fields of 'ctx' will be known to be aligned even whentcp4_ao_contextis also__packed.
Agree with Eric that this has no bearing on this patch, but I'm not sure I see the problem here. 'ctx' will not be packed, and appear misaligned in struct kdf_input_block, but that would only matter if the address of the ctx field were taken and passed to a function taking a pointer to struct tcp4_ao_context (which would expect it to appear naturally aligned).
Having a feeling about what the compiler sometimes rejects is not actionable feedback - could you be more specific about which problem you think needs to be solved here? Are you concerned about unaligned accesses when populating the struct?
Re: [PATCH net-next v2 2/5] net/tcp-ao: Use crypto library API instead of crypto_ahash
Quoted 39 lines · On Tue, 28 Apr 2026 08:34:47 +0200 "Ard Biesheuvel" <[email protected]> wrote:
Quoted 21 lines · David Laight
Quoted 17 lines · On Mon, 27 Apr 2026 10:27:24 -0700 Eric Biggers <[email protected]> wrote:
Currently the kernel's TCP-AO implementation does the MAC and KDF computations using the
crypto_ahashAPI. This API is inefficient and difficult to use, and it has required extensive workarounds in the form of per-CPU preallocated objects (tcp_sigpool) to work at all.Let's use
lib/crypto/instead. This means switching to straightforward stack-allocated structures, virtually addressed buffers, and direct function calls. It also means removing quite a bit of error handling. This makes TCP-AO quite a bit faster.This also enables many additional cleanups, which later commits will
handle: removing tcp-sigpool, removing support forcrypto_tfmcloning, removing more error handling, and replacing more dynamically-allocated buffers with stack buffers based on the now-statically-known limits.Reviewed-by Ard Biesheuvel <[email protected]>Signed-off-by Eric Biggers <[email protected]>...
Quoted 16 lines
net/ipv4/tcp_ao.c static int tcp_v4_ao_calc_key(struct tcp_ao_key *mkt, u8 *key, · line 349
Quoted 7 lines
net/ipv4/tcp_ao.c +0
-1@@ -344,33 +444,26 @@ static int tcp_v4_ao_calc_key(struct tcp_ao_key *mkt, u8 *key,struct kdf_input_block {u8 counter;u8 label[6 ];struct tcp4_ao_context ctx;__be16 outlen; - } __packed * tmp;That looks a bit horrid.
I also had a feeling that the compiler sometimes rejects non-packed structures inside packed ones.
Perhaps nest the whole thing inside another structure that has an initial u8 pad and is marked__packed__aligned(4).
Then the assignments to the fields of 'ctx' will be known to be aligned even whentcp4_ao_contextis also__packed.
Quoted 1 line
Agree with Eric that this has no bearing on this patch,
true - just the in the same code.
Quoted 11 lines
but I'm not sure
I see the problem here. 'ctx' will not be packed, and appear misaligned in structkdf_input_block, but that would only matter if the address of the ctx field were taken and passed to a function taking a pointer to structtcp4_ao_context(which would expect it to appear naturally aligned).Having a feeling about what the compiler sometimes rejects is not actionable feedback - could you be more specific about which problem you think needs to be solved here? Are you concerned about unaligned accesses when populating the struct?
(It was 2am and the side effects of a cold were stopping me sleeping...)
I tend to double-check __packed because it gets misused in places where you really want the compiler to error implicit padding rather than generate expensive misaligned access code.
But I am sure I remember some build warning that needed __packed added to the definition of a structure embedded in a __packed structure. I don't think it was only the arm OABI (which pads structures to 2 bytes). Historically this has never mattered (even the 'address of packed member' error is moderately recent - well sometime in the last 20 years).
In this case (and the ipv6 code) 'struct tcp4_ao_context' can just be marked __packed.
Or, since this is the only place it is used, possibly just inlined into 'struct kdf_input_block' - which may not even need to be named.
David
Quoted 11 lines · Eric Biggers
Quoted 2 lines · Eric Biggers
Quoted 2 lines
- Ronald P. Bonica (the original RFC5925 author), together with Tony Li do have an active RFC draft to support the additional algorithms
[...]
Quoted 1 line
For what it's worth, that draft makes very little sense. For example, it proposes three variants of HMAC-SHA3, instead of just making the modern choice of KMAC256. And it proposes both HMAC-SHA384 and HMAC-SHA512, despite them being redundant with each other after the specified truncation to 128 bits.
Which is bogus in itself without proper security considerations, the only considerations cited is an RFC from 1997 ... clearly the pinnacle of cryptography advice ...
If they need a shorter hash they should make themselves a favor and use SHAKE and then define the desired output length and desired key size. That draft is just a disaster as written.
Specifically they should use KMAC128 as defined in NIST SP 800-185 (which uses cSHAKE128 underneath).
Simo.
Signature · 4 lines
Simo Sorce Distinguished Engineer RHEL Crypto Team Red Hat, Inc
Re: [PATCH net-next v2 2/5] net/tcp-ao: Use crypto library API instead of crypto_ahash
In reply to David LaightQuoted 70 lines · David Laight
Quoted 39 lines · On Tue, 28 Apr 2026 08:34:47 +0200 "Ard Biesheuvel" <[email protected]> wrote:
Quoted 21 lines · David Laight
Quoted 17 lines · On Mon, 27 Apr 2026 10:27:24 -0700 Eric Biggers <[email protected]> wrote:
Currently the kernel's TCP-AO implementation does the MAC and KDF computations using the
crypto_ahashAPI. This API is inefficient and difficult to use, and it has required extensive workarounds in the form of per-CPU preallocated objects (tcp_sigpool) to work at all.Let's use
lib/crypto/instead. This means switching to straightforward stack-allocated structures, virtually addressed buffers, and direct function calls. It also means removing quite a bit of error handling. This makes TCP-AO quite a bit faster.This also enables many additional cleanups, which later commits will
handle: removing tcp-sigpool, removing support forcrypto_tfmcloning, removing more error handling, and replacing more dynamically-allocated buffers with stack buffers based on the now-statically-known limits.Reviewed-by Ard Biesheuvel <[email protected]>Signed-off-by Eric Biggers <[email protected]>...
Quoted 16 lines
net/ipv4/tcp_ao.c static int tcp_v4_ao_calc_key(struct tcp_ao_key *mkt, u8 *key, · line 349
Quoted 7 lines
net/ipv4/tcp_ao.c +0
-1@@ -344,33 +444,26 @@ static int tcp_v4_ao_calc_key(struct tcp_ao_key *mkt, u8 *key,struct kdf_input_block {u8 counter;u8 label[6 ];struct tcp4_ao_context ctx;__be16 outlen; - } __packed * tmp;That looks a bit horrid.
I also had a feeling that the compiler sometimes rejects non-packed structures inside packed ones.
Perhaps nest the whole thing inside another structure that has an initial u8 pad and is marked__packed__aligned(4).
Then the assignments to the fields of 'ctx' will be known to be aligned even whentcp4_ao_contextis also__packed.Quoted 1 line
Agree with Eric that this has no bearing on this patch,
true - just the in the same code.
Quoted 11 lines
but I'm not sure
I see the problem here. 'ctx' will not be packed, and appear misaligned in structkdf_input_block, but that would only matter if the address of the ctx field were taken and passed to a function taking a pointer to structtcp4_ao_context(which would expect it to appear naturally aligned).Having a feeling about what the compiler sometimes rejects is not actionable feedback - could you be more specific about which problem you think needs to be solved here? Are you concerned about unaligned accesses when populating the struct?
(It was 2am and the side effects of a cold were stopping me sleeping...)
I tend to double-check
__packedbecause it gets misused in places where you really want the compiler to error implicit padding rather than generate expensive misaligned access code.But I am sure I remember some build warning that needed
__packedadded to the definition of a structure embedded in a__packedstructure. I don't think it was only the arm OABI (which pads structures to 2 bytes). Historically this has never mattered (even the 'address of packed member' error is moderately recent - well sometime in the last 20 years).
Quoted 5 lines
In this case (and the ipv6 code) 'struct
tcp4_ao_context' can just be marked__packed.
Or, since this is the only place it is used, possibly just inlined into 'structkdf_input_block' - which may not even need to be named.
What would that achieve, exactly? You still haven't explained what is wrong with the code. Or are you really claiming that structs lacking the packed attribute are not permitted as fields in __packed structs?
Quoted 17 lines · Simo Sorce
Quoted 11 lines · Eric Biggers
Quoted 2 lines · Eric Biggers
Quoted 2 lines
- Ronald P. Bonica (the original RFC5925 author), together with Tony Li do have an active RFC draft to support the additional algorithms
[...]
Quoted 1 line
For what it's worth, that draft makes very little sense. For example, it proposes three variants of HMAC-SHA3, instead of just making the modern choice of KMAC256. And it proposes both HMAC-SHA384 and HMAC-SHA512, despite them being redundant with each other after the specified truncation to 128 bits.
Which is bogus in itself without proper security considerations, the only considerations cited is an RFC from 1997 ... clearly the pinnacle of cryptography advice ...
Quoted 8 lines
If they need a shorter hash they should make themselves a favor and use SHAKE and then define the desired output length and desired key size. That draft is just a disaster as written.
Specifically they should use KMAC128 as defined in NIST SP 800-185 (which uses cSHAKE128 underneath).
Simo.
FWIW I left some feedback on the draft on on the tcpm mailing list
(https://mailarchive.ietf.org/arch/browse/tcpm/)
Another thing I should note is that the way TCP-AO uses HMAC-SHA1, it's instantiated with an arbitrary-length key that might not contain full entropy. In contrast, the normal practice in cases like that is to do an entropy extraction step first, e.g. see HKDF which has HKDF-Extract + HKDF-Expand.
There's a chance this gets fixed in a future addition of HMAC-SHA256 or whatever. But in that case, the way the kernel happens to already implement that algorithm (by assuming that it would be used in exactly the same way as HMAC-SHA1) wouldn't match the eventual standard.
This is yet another reason why preemptively implementing "support" for arbitrary algorithms wasn't a great choice...
Eric
Re: [PATCH net-next v2 2/5] net/tcp-ao: Use crypto library API instead of crypto_ahash
In reply to Ard BiesheuvelQuoted 77 lines · On Tue, 28 Apr 2026 18:38:51 +0200 "Ard Biesheuvel" <[email protected]> wrote:
Quoted 70 lines · David Laight
Quoted 39 lines · On Tue, 28 Apr 2026 08:34:47 +0200 "Ard Biesheuvel" <[email protected]> wrote:
Quoted 21 lines · David Laight
Quoted 17 lines · On Mon, 27 Apr 2026 10:27:24 -0700 Eric Biggers <[email protected]> wrote:
Currently the kernel's TCP-AO implementation does the MAC and KDF computations using the
crypto_ahashAPI. This API is inefficient and difficult to use, and it has required extensive workarounds in the form of per-CPU preallocated objects (tcp_sigpool) to work at all.Let's use
lib/crypto/instead. This means switching to straightforward stack-allocated structures, virtually addressed buffers, and direct function calls. It also means removing quite a bit of error handling. This makes TCP-AO quite a bit faster.This also enables many additional cleanups, which later commits will
handle: removing tcp-sigpool, removing support forcrypto_tfmcloning, removing more error handling, and replacing more dynamically-allocated buffers with stack buffers based on the now-statically-known limits.Reviewed-by Ard Biesheuvel <[email protected]>Signed-off-by Eric Biggers <[email protected]>...
Quoted 16 lines
net/ipv4/tcp_ao.c static int tcp_v4_ao_calc_key(struct tcp_ao_key *mkt, u8 *key, · line 349
Quoted 7 lines
net/ipv4/tcp_ao.c +0
-1@@ -344,33 +444,26 @@ static int tcp_v4_ao_calc_key(struct tcp_ao_key *mkt, u8 *key,struct kdf_input_block {u8 counter;u8 label[6 ];struct tcp4_ao_context ctx;__be16 outlen; - } __packed * tmp;That looks a bit horrid.
I also had a feeling that the compiler sometimes rejects non-packed structures inside packed ones.
Perhaps nest the whole thing inside another structure that has an initial u8 pad and is marked__packed__aligned(4).
Then the assignments to the fields of 'ctx' will be known to be aligned even whentcp4_ao_contextis also__packed.Quoted 1 line
Agree with Eric that this has no bearing on this patch,
true - just the in the same code.
Quoted 11 lines
but I'm not sure
I see the problem here. 'ctx' will not be packed, and appear misaligned in structkdf_input_block, but that would only matter if the address of the ctx field were taken and passed to a function taking a pointer to structtcp4_ao_context(which would expect it to appear naturally aligned).Having a feeling about what the compiler sometimes rejects is not actionable feedback - could you be more specific about which problem you think needs to be solved here? Are you concerned about unaligned accesses when populating the struct?
(It was 2am and the side effects of a cold were stopping me sleeping...)
I tend to double-check
__packedbecause it gets misused in places where you really want the compiler to error implicit padding rather than generate expensive misaligned access code.But I am sure I remember some build warning that needed
__packedadded to the definition of a structure embedded in a__packedstructure. I don't think it was only the arm OABI (which pads structures to 2 bytes). Historically this has never mattered (even the 'address of packed member' error is moderately recent - well sometime in the last 20 years).Quoted 5 lines
In this case (and the ipv6 code) 'struct
tcp4_ao_context' can just be marked__packed.
Or, since this is the only place it is used, possibly just inlined into 'structkdf_input_block' - which may not even need to be named.
Quoted 3 lines
What would that achieve, exactly? You still haven't explained what is wrong with the code. Or are you really claiming that structs lacking the packed attribute are not permitted as fields in
__packedstructs?
My brain probably misfiled something :-(
David
Simon Horman
reviewerRe: [PATCH net-next v2 1/5] net/tcp-ao: Drop support for most non-RFC-specified algorithms
In reply to Eric BiggersFrom: 'Simon Horman' <[email protected]>
This is an AI-generated review of your patch. The human sending this email has considered the AI review valid, or at least plausible. Full review at: https://sashiko.dev
---
Subject: net/tcp-ao: Drop support for most non-RFC-specified algorithms
This change restricts the algorithms accepted by setsockopt(TCP_AO_ADD_KEY) to cmac(aes128)/cmac(aes)+keylen=16, hmac(sha1) and hmac(sha256), returning -ENOENT for anything else. The selftest algorithm table and its Kconfig fragment are updated to drop FIPS detection and rmd160.
A few questions inline below.
net/ipv4/tcp_ao.c static struct tcp_ao_key *tcp_ao_key_alloc(struct sock *sk, · line 1569
Quoted 12 lines
net/ipv4/tcp_ao.c +4
-0@@ -1563,6 +1563,10 @@ static struct tcp_ao_key *tcp_ao_key_alloc(struct sock *sk,/* RFC5926, 3.1.1.2. KDF_AES_128_CMAC */ if (!strcmp ("cmac(aes128)" , algo)) algo ="cmac(aes)" ; +else if (strcmp ("hmac(sha1)" , algo) && +strcmp ("hmac(sha256)" , algo) && + (strcmp ("cmac(aes)" , algo) || cmd->keylen !=16 )) +return ERR_PTR (-ENOENT );
Is this a uAPI regression for existing users of TCP_AO_ADD_KEY?
Before this change, tcp_ao_add::alg_name accepted any crypto_ahash algorithm name. The commit message itself notes "arbitrary HMAC algorithms probably do work", and the selftest prior to this patch exercised hmac(sha512), hmac(sha384), hmac(sha224), hmac(sha3-512), hmac(rmd160) and hmac(md5), which demonstrates those configurations were functional in practice.
A setsockopt call that previously succeeded with e.g. alg_name = "hmac(sha512)" now returns -ENOENT after a kernel upgrade, with no deprecation window, no Kconfig opt-in, and no runtime toggle. HMAC-SHA512 in particular seems like a plausible choice that a deployment may already rely on.
Would it make sense to keep hmac(sha512) (and possibly hmac(sha384)) in the accepted list, or to gate the removal behind a Kconfig/sysctl while warning for a few releases?
Also, -ENOENT is the same error returned when the crypto module for an otherwise-accepted algorithm is simply not built in. Should a distinct errno (for example -EOPNOTSUPP) be used here so userspace can tell "algorithm rejected by policy" apart from "algorithm module missing"?
tools/testing/selftests/net/tcp_ao/config line 5
Quoted 11 lines
tools/testing/selftests/net/tcp_ao/config +0
-1@@ -1,6 +1,5 @@ CONFIG_CRYPTO_CMAC=y CONFIG_CRYPTO_HMAC=y -CONFIG_CRYPTO_RMD160=y CONFIG_CRYPTO_SHA1=y CONFIG_IPV6=y CONFIG_IPV6_MULTIPLE_TABLES=y
Should CONFIG_CRYPTO_SHA256=y (and possibly CONFIG_CRYPTO_AES=y) be added here?
Quoted 4 lines
tools/testing/selftests/net/tcp_ao/key-management.c +0
-0
[ ... ]
tools/testing/selftests/net/tcp_ao/key-management.c struct key_collection { · line 408
Quoted 9 lines
tools/testing/selftests/net/tcp_ao/key-management.c +1
-8-const char *test_algos[] = { -"cmac(aes128)" , -"hmac(sha1)" ,"hmac(sha512)" ,"hmac(sha384)" ,"hmac(sha256)" , -"hmac(sha224)" ,"hmac(sha3-512)" , -/* only if !CONFIG_FIPS */ -#define TEST_NON_FIPS_ALGOS 2 -"hmac(rmd160)" ,"hmac(md5)" -}; +const char *test_algos[] = {"cmac(aes128)" ,"hmac(sha1)" ,"hmac(sha256)" };
With the FIPS/algorithm-probing logic removed and roughly one third of generated keys now using hmac(sha256), and with the kernel side now returning -ENOENT for non-whitelisted algorithms, tcp_sigpool_alloc_ahash() will fail for every hmac(sha256) key on a kernel built from this config unless CRYPTO_SHA256 is selected.
CRYPTO_SHA256 is not implied by CRYPTO_HMAC or TCP_AO, so on a kernel built strictly from tools/testing/selftests/net/tcp_ao/config the tests would appear to fail rather than be skipped. Can the config fragment be updated to match the new required algorithm set?
One more question, on the commit message and documentation rather than the
diff: Documentation/networking/tcp_ao.rst still describes TCP-AO as "May support any hashing algorithm" and does not mention the newly enforced whitelist or the -ENOENT failure mode. Should tcp_ao.rst be updated in this patch to list the accepted algorithm strings and the rationale (e.g. the 20-byte TCP option MAC cap), so userspace has a documented contract?
Re: [PATCH net-next v2 1/5] net/tcp-ao: Drop support for most non-RFC-specified algorithms
Quoted 15 lines · Simon Horman
Is this a uAPI regression for existing users of
TCP_AO_ADD_KEY?Before this change,
tcp_ao_add::alg_nameaccepted anycrypto_ahashalgorithm name. The commit message itself notes "arbitrary HMAC algorithms probably do work", and the selftest prior to this patch exercised hmac(sha512), hmac(sha384), hmac(sha224), hmac(sha3-512), hmac(rmd160) and hmac(md5), which demonstrates those configurations were functional in practice.A setsockopt call that previously succeeded with e.g.
alg_name= "hmac(sha512)" now returns-ENOENTafter a kernel upgrade, with no deprecation window, noKconfigopt-in, and no runtime toggle. HMAC-SHA512 in particular seems like a plausible choice that a deployment may already rely on.
Quoted 3 lines
Would it make sense to keep hmac(sha512) (and possibly hmac(sha384)) in the accepted list, or to gate the removal behind a Kconfig/sysctl while warning for a few releases?
This is intentional and has already been explained and discussed extensively.
Quoted 4 lines
Also,
-ENOENTis the same error returned when the crypto module for an otherwise-accepted algorithm is simply not built in. Should a distinct errno (for example-EOPNOTSUPP) be used here so userspace can tell "algorithm rejected by policy" apart from "algorithm module missing"?
This review seems a bit inconsistent, as now it's advocating *for* a UAPI change. I suggest we just stay with ENOENT, as this patch does.
Quoted 6 lines
Quoted 6 lines
tools/testing/selftests/net/tcp_ao/config +0
-0@@ -1,6 +1,5 @@ CONFIG_CRYPTO_CMAC=y
Quoted 8 lines
tools/testing/selftests/net/tcp_ao/config line 5
Quoted 5 lines
tools/testing/selftests/net/tcp_ao/config +0
-1CONFIG_CRYPTO_HMAC=y -CONFIG_CRYPTO_RMD160=y CONFIG_CRYPTO_SHA1=y CONFIG_IPV6=y CONFIG_IPV6_MULTIPLE_TABLES=yShould
CONFIG_CRYPTO_SHA256=y(and possiblyCONFIG_CRYPTO_AES=y) be added here?
This is an existing bug, which patch 2 fixes by making CONFIG_TCP_AO select the algorithms it uses.
Quoted 23 lines
Quoted 4 lines
tools/testing/selftests/net/tcp_ao/key-management.c +0
-0[ ... ]
tools/testing/selftests/net/tcp_ao/key-management.c struct key_collection { · line 408
Quoted 9 lines
tools/testing/selftests/net/tcp_ao/key-management.c +1
-8-const char *test_algos[] = { -"cmac(aes128)" , -"hmac(sha1)" ,"hmac(sha512)" ,"hmac(sha384)" ,"hmac(sha256)" , -"hmac(sha224)" ,"hmac(sha3-512)" , -/* only if !CONFIG_FIPS */ -#define TEST_NON_FIPS_ALGOS 2 -"hmac(rmd160)" ,"hmac(md5)" -}; +const char *test_algos[] = {"cmac(aes128)" ,"hmac(sha1)" ,"hmac(sha256)" };With the FIPS/algorithm-probing logic removed and roughly one third of generated keys now using hmac(sha256), and with the kernel side now returning
-ENOENTfor non-whitelisted algorithms,tcp_sigpool_alloc_ahash()will fail for every hmac(sha256) key on a kernel built from this config unlessCRYPTO_SHA256is selected.
Quoted 4 lines
CRYPTO_SHA256is not implied byCRYPTO_HMACorTCP_AO, so on a kernel built strictly fromtools/testing/selftests/net/tcp_ao/configthe tests would appear to fail rather than be skipped. Can the config fragment be updated to match the new required algorithm set?
Again, this is an existing bug, which patch 2 fixes by making CONFIG_TCP_AO select the algorithms it uses.
Quoted 3 lines
One more question, on the commit message and documentation rather than the
diff:Documentation/networking/tcp_ao.rststill describes TCP-AO as "May support any hashing algorithm"
That "May support any hashing algorithm" statement has always been incorrect, so I wouldn't pay much attention to it. It also appears in a table describing TCP-AO as a protocol, not the kernel's implementation.
Quoted 4 lines
and does not mention the newly enforced
whitelist or the-ENOENTfailure mode. Shouldtcp_ao.rstbe updated in this patch to list the accepted algorithm strings and the rationale (e.g. the 20-byte TCP option MAC cap), so userspace has a documented contract?
As stated in the commit message, the list of MAC algorithms supported by the kernel's implementation of TCP-AO has always been undocumented. It should be documented, but I would suggest documentation improvements belong in a separate patch.
- Eric
Re: [PATCH net-next v2 1/5] net/tcp-ao: Drop support for most non-RFC-specified algorithms
Quoted 13 lines · Eric Biggers
Quoted 3 lines
One more question, on the commit message and documentation rather than the
diff:Documentation/networking/tcp_ao.rststill describes TCP-AO as "May support any hashing algorithm"That "May support any hashing algorithm" statement has always been incorrect, so I wouldn't pay much attention to it. It also appears in a table describing TCP-AO as a protocol, not the kernel's implementation.
Quoted 4 lines
and does not mention the newly enforced
whitelist or the-ENOENTfailure mode. Shouldtcp_ao.rstbe updated in this patch to list the accepted algorithm strings and the rationale (e.g. the 20-byte TCP option MAC cap), so userspace has a documented contract?
Quoted 4 lines
As stated in the commit message, the list of MAC algorithms supported by the kernel's implementation of TCP-AO has always been undocumented. It should be documented, but I would suggest documentation improvements belong in a separate patch.
The missing documentation is added in
https://lore.kernel.org/netdev/[email protected]/
- Eric
Paolo Abeni
maintainerQuoted 20 lines · Dmitry Safonov
Quoted 19 lines · Jakub Kicinski
Quoted 17 lines · On Mon, 27 Apr 2026 20:09:05 +0100 Dmitry Safonov wrote:
I do like these numbers quite much! Yet, as I mentioned in version 1, removing a fallback for other algorithms' support does not sound good to me. There are two reasons:
- Ronald P. Bonica (the original RFC5925 author), together with Tony Li do have an active RFC draft to support the additional algorithms [1], potentially in addition to TCP Extended Options [2]
- There is at least one open-source BGP implementation (BIRD) that allows using the algorithms that you are removing [3]. Without a deprecation period and communication with at least known open source users, it implies intentionally breaking them, which I can't agree with.I don't feel like Naking as we don't have any customers using anything other than the 3 algorithms above (and BGP implementation is [unfortunately] closed-source, so that would not feel appropriate even if we had such customers), yet I do feel like it's worth and appropriate to express my thoughts/concerns.
Quoted 6 lines
Quoted 2 lines
What do you want to happen? You are the maintainer of this code, you don't get so say "i don't want to nack it but also no" :)
Yeah, that's not what I meant. I see value in Eric's contribution, and I like getting rid of tcp-sigpool. So, anything but "nack" is not "no" :-)
I read the above as: "If there isn't any additional feedback soon, please apply".
Quoted 9 lines
Quoted 3 lines
Like Eric says if there are no real users code can be deleted. Adding deprecation warnings upstream is quite slow, IDK if injecting deprecation warnings to stable has been discussed..
FWIW, I've written to bird's mailing list inviting them to this thread; in case if they need other algorithms to be supported, hopefully that should avoid any breakages on their side. I'm aware that ciena and fortinet use tcp-ao too, but I'm less concerned, as they aren't open source.
Let me add my 2c here:
- the only TCP-AO use-case I'm aware of, is to _drop_ TCP-MD5
- We had some discussion about TCP Extended Options in past netconf, and IIRC at very best it's not going to happen any time soon kernel wise because it basically requires disabling GRO.
- the possibility of using crc32 is indeed a security issue, that AFAICS must be addressed, and can only be fixed removing such option. I'm fine dropping support for any other algo considered vulnerable.
More than 48H passed since the last email on this thread, I'm going to apply it.
Thanks,
Paolo
This series was applied to netdev/net-next.git (main) by Paolo Abeni <[email protected]>:
Hello:
This series was applied to netdev/net-next.git (main) by Paolo Abeni <[email protected]>:
Quoted 4 lines · On Mon, 27 Apr 2026 10:27:22 -0700 you wrote:
This series can also be retrieved from:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/ebiggers/linux.git tcp-ao-v2
Quoted 8 lines
This series is targeting net-next for 7.2. To make this series self-contained in the networking code, I dropped the patches that remove support for transformation cloning from the crypto API, which is a further negative 275-line cleanup and optimization this series enables. That will be done as a follow-up, either through the crypto tree for 7.3, or still through net-next for 7.2 at maintainer preference.
[...]
Here is the summary with links:
- [net-next,v2,1/5] net/tcp-ao: Drop support for most non-RFC-specified algorithms
https://git.kernel.org/netdev/net-next/c/5eb0cfedb258 - [net-next,v2,2/5] net/tcp-ao: Use crypto library API instead of crypto_ahash https://git.kernel.org/netdev/net-next/c/068f5a009556 - [net-next,v2,3/5] net/tcp-ao: Use stack-allocated MAC and traffic_key buffers https://git.kernel.org/netdev/net-next/c/48168799896c - [net-next,v2,4/5] net/tcp-ao: Return void from functions that can no longer fail https://git.kernel.org/netdev/net-next/c/8e4f61e43163 - [net-next,v2,5/5] net/tcp: Remove tcp_sigpool https://git.kernel.org/netdev/net-next/c/4baf2415992e
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html
Quoted 2 lines · Paolo Abeni
On 4/28/26 2:00 AM, Dmitry Safonov wrote:
[..]
Quoted 6 lines
Quoted 3 lines
Yeah, that's not what I meant. I see value in Eric's contribution, and I like getting rid of tcp-sigpool. So, anything but "nack" is not "no" :-)
I read the above as: "If there isn't any additional feedback soon, please apply".
Thanks, Paolo, that's exactly what I meant.
I think we addressed both concerns I had with the new RFC and BIRD daemon, and Eric did a good job optimising the crypto layer here, so we are better with his patches than with my sentimental attachment to extendability that so far is not really required by BGP. And if we need to extend the list of algorithms, we will be able to do it on top later.
Thanks again,
Dmitry