Reimplement TCP-AO using crypto library
Status from this message: This series was applied to netdev/net-next.git (main)
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v2 Latest5 patches 19 repliesApplied 5/5
- v1 RFC8 patches 4 repliesSuperseded
Changes in v2 from the cover letter
- 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.
Patches in v2 All 5 applied
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/5 | net/tcp-ao: Drop support for most non-RFC-specified algorithmsnet/ tools/ tools/ | +7 | 3 replies | Applied |
| 2/5 | net/tcp-ao: Use crypto library API instead of crypto_ahashinclude/ net/ net/ +2 more | +309 | 6 replies | Applied |
| 3/5 | net/tcp-ao: Use stack-allocated MAC and traffic_key buffersnet/ net/ | +16 | 0 replies | Applied |
| 4/5 | net/tcp-ao: Return void from functions that can no longer failinclude/ include/ net/ +2 more | +123 | 0 replies | Applied |
| 5/5 | net/tcp: Remove tcp_sigpoolinclude/ net/ net/ +1 more | +0 | 0 replies | Applied |
Reviews trailers per patch
All 5 patches have a Reviewed-by or Acked-by.
| Patch | Ard Biesheuvel |
|---|---|
| 1/5 | R-b |
| 2/5 | R-b |
| 3/5 | R-b |
| 4/5 | R-b |
| 5/5 | R-b |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
Cover letter [PATCH net-next v2 0/5] 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