public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: Sabrina Dubroca <sd@queasysnail•net>
To: netdev@vger•kernel.org
Cc: borisp@nvidia•com, john.fastabend@gmail•com, kuba@kernel•org,
	Sabrina Dubroca <sd@queasysnail•net>
Subject: [PATCH net-next 00/17] tls: expand tls_cipher_size_desc to simplify getsockopt/setsockopt
Date: Fri, 25 Aug 2023 23:35:05 +0200	[thread overview]
Message-ID: <cover.1692977948.git.sd@queasysnail.net> (raw)

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(-)

-- 
2.40.1


             reply	other threads:[~2023-08-25 21:36 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-25 21:35 Sabrina Dubroca [this message]
2023-08-25 21:35 ` [PATCH net-next 01/17] selftests: tls: add test variants for aria-gcm Sabrina Dubroca
2023-08-25 21:35 ` [PATCH net-next 02/17] selftests: tls: add getsockopt test Sabrina Dubroca
2023-08-25 21:35 ` [PATCH net-next 03/17] selftests: tls: test some invalid inputs for setsockopt Sabrina Dubroca
2023-08-25 21:35 ` [PATCH net-next 04/17] tls: move tls_cipher_size_desc to net/tls/tls.h Sabrina Dubroca
2023-08-25 21:35 ` [PATCH net-next 05/17] tls: add TLS_CIPHER_ARIA_GCM_* to tls_cipher_size_desc Sabrina Dubroca
2023-08-25 21:35 ` [PATCH net-next 06/17] tls: reduce size of tls_cipher_size_desc Sabrina Dubroca
2023-08-25 21:35 ` [PATCH net-next 07/17] tls: rename tls_cipher_size_desc to tls_cipher_desc Sabrina Dubroca
2023-08-25 21:35 ` [PATCH net-next 08/17] tls: extend tls_cipher_desc to fully describe the ciphers Sabrina Dubroca
2023-08-25 21:35 ` [PATCH net-next 09/17] tls: validate cipher descriptions at compile time Sabrina Dubroca
2023-08-25 21:35 ` [PATCH net-next 10/17] tls: expand use of tls_cipher_desc in tls_set_device_offload Sabrina Dubroca
2023-08-25 21:35 ` [PATCH net-next 11/17] tls: allocate the fallback aead after checking that the cipher is valid Sabrina Dubroca
2023-08-25 21:35 ` [PATCH net-next 12/17] tls: expand use of tls_cipher_desc in tls_sw_fallback_init Sabrina Dubroca
2023-08-25 21:35 ` [PATCH net-next 13/17] tls: get crypto_info size from tls_cipher_desc in do_tls_setsockopt_conf Sabrina Dubroca
2023-08-25 21:35 ` [PATCH net-next 14/17] tls: use tls_cipher_desc to simplify do_tls_getsockopt_conf Sabrina Dubroca
2023-08-25 21:35 ` [PATCH net-next 15/17] tls: use tls_cipher_desc to get per-cipher sizes in tls_set_sw_offload Sabrina Dubroca
2023-08-25 21:35 ` [PATCH net-next 16/17] tls: use tls_cipher_desc to access per-cipher crypto_info " Sabrina Dubroca
2023-08-25 21:35 ` [PATCH net-next 17/17] tls: get cipher_name from cipher_desc " Sabrina Dubroca
2023-08-28  1:10 ` [PATCH net-next 00/17] tls: expand tls_cipher_size_desc to simplify getsockopt/setsockopt patchwork-bot+netdevbpf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cover.1692977948.git.sd@queasysnail.net \
    --to=sd@queasysnail$(echo .)net \
    --cc=borisp@nvidia$(echo .)com \
    --cc=john.fastabend@gmail$(echo .)com \
    --cc=kuba@kernel$(echo .)org \
    --cc=netdev@vger$(echo .)kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox