Skip to content

tls: expand tls_cipher_size_desc to simplify getsockopt/setsockopt

Sabrina Dubroca linux-kselftest netdev 1 version Applied

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

  1. v1 Latest17 patches 0 repliesApplied 17/17

Patches in v1 All 17 applied

#Subject and filesSizeRepliesApplied
1/17selftests: tls: add test variants for aria-gcmtools/testing/selftests/net/config tools/testing/selftests/net/tls.c+25 -00 repliesApplied
2/17selftests: tls: add getsockopt testtools/testing/selftests/net/tls.c+35 -00 repliesApplied
3/17selftests: tls: test some invalid inputs for setsockopttools/testing/selftests/net/tls.c+25 -00 repliesApplied
4/17tls: move tls_cipher_size_desc to net/tls/tls.hinclude/net/tls.h net/tls/tls.h+10 -100 repliesApplied
5/17tls: add TLS_CIPHER_ARIA_GCM_* to tls_cipher_size_descnet/tls/tls_main.c+2 -00 repliesApplied
6/17tls: reduce size of tls_cipher_size_descnet/tls/tls.h net/tls/tls_device.c net/tls/tls_device_fallback.c +1 more+20 -90 repliesApplied
7/17tls: rename tls_cipher_size_desc to tls_cipher_descnet/tls/tls.h net/tls/tls_device.c net/tls/tls_device_fallback.c +1 more+52 -520 repliesApplied
8/17tls: extend tls_cipher_desc to fully describe the ciphersnet/tls/tls.h net/tls/tls_main.c+64 -90 repliesApplied
9/17tls: validate cipher descriptions at compile timenet/tls/tls_main.c+18 -00 repliesApplied
10/17tls: expand use of tls_cipher_desc in tls_set_device_offloadnet/tls/tls_device.c+4 -180 repliesApplied
11/17tls: allocate the fallback aead after checking that the cipher is validnet/tls/tls_device_fallback.c+10 -100 repliesApplied
12/17tls: expand use of tls_cipher_desc in tls_sw_fallback_initnet/tls/tls_device_fallback.c+6 -140 repliesApplied
13/17tls: get crypto_info size from tls_cipher_desc in do_tls_setsockopt_confnet/tls/tls_main.c+8 -310 repliesApplied
14/17tls: use tls_cipher_desc to simplify do_tls_getsockopt_confnet/tls/tls_main.c+11 -1630 repliesApplied
15/17tls: use tls_cipher_desc to get per-cipher sizes in tls_set_sw_offloadnet/tls/tls_sw.c+16 -630 repliesApplied
16/17tls: use tls_cipher_desc to access per-cipher crypto_info in tls_set_sw_offloadnet/tls/tls_sw.c+13 -760 repliesApplied
17/17tls: get cipher_name from cipher_desc in tls_set_sw_offloadnet/tls/tls_sw.c+4 -250 repliesApplied

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH net-next 00/17] tls: expand tls_cipher_size_desc to simplify getsockopt/setsockopt

Commit 2d2c5ea24243 ("net/tls: Describe ciphers sizes by const structs") introduced tls_cipher_size_desc to describe the size of the fields of the per-cipher crypto_info structs, and commit ea7a9d88ba21 ("net/tls: Use cipher sizes structs") used it, but only in tls_device.c and tls_device_fallback.c, and skipped converting similar code in tls_main.c and tls_sw.c.

This series expands tls_cipher_size_desc (renamed to tls_cipher_desc to better fit this expansion) to fully describe a cipher:
- offset of the fields within the per-cipher crypto_info
- size of the full struct (for copies to/from userspace)
- offload flag
- algorithm name used by SW crypto

With these additions, we can remove ~350L of

     switch (crypto_info->cipher_type) { ... }

from tls_set_device_offload, tls_sw_fallback_init, do_tls_getsockopt_conf, do_tls_setsockopt_conf, tls_set_sw_offload (mainly do_tls_getsockopt_conf and tls_set_sw_offload).

This series also adds the ARIA ciphers to the tls selftests, and some more getsockopt/setsockopt tests to cover more of the code changed by this series.

Sabrina Dubroca (17):
selftests: tls: add test variants for aria-gcm
selftests: tls: add getsockopt test
selftests: tls: test some invalid inputs for setsockopt
tls: move tls_cipher_size_desc to net/tls/tls.h
tls: add TLS_CIPHER_ARIA_GCM_* to tls_cipher_size_desc
tls: reduce size of tls_cipher_size_desc
tls: rename tls_cipher_size_desc to tls_cipher_desc
tls: extend tls_cipher_desc to fully describe the ciphers
tls: validate cipher descriptions at compile time
tls: expand use of tls_cipher_desc in tls_set_device_offload
tls: allocate the fallback aead after checking that the cipher is
valid
tls: expand use of tls_cipher_desc in tls_sw_fallback_init
tls: get crypto_info size from tls_cipher_desc in
do_tls_setsockopt_conf
tls: use tls_cipher_desc to simplify do_tls_getsockopt_conf
tls: use tls_cipher_desc to get per-cipher sizes in tls_set_sw_offload
tls: use tls_cipher_desc to access per-cipher crypto_info in
tls_set_sw_offload
tls: get cipher_name from cipher_desc in tls_set_sw_offload

 include/net/tls.h                  |  10 --
 net/tls/tls.h                      |  53 ++++++
 net/tls/tls_device.c               |  52 ++----
 net/tls/tls_device_fallback.c      |  62 +++----
 net/tls/tls_main.c                 | 272 ++++++++---------------------
 net/tls/tls_sw.c                   | 179 +++----------------
 tools/testing/selftests/net/config |   1 +
 tools/testing/selftests/net/tls.c  |  84 +++++++++
 8 files changed, 278 insertions(+), 435 deletions(-)
Signature · 1 line
2.40.1