Subject: Re: [PATCH net-next 08/14] tls: also use init_prot_info in tls_set_device_offload

From: Sabrina Dubroca <[email-masked]>
Date: Tue, 17 Oct 2023 11:16:56 +0200

2023-10-13, 14:23:07 -0700, Jakub Kicinski wrote:
> On Mon,  9 Oct 2023 22:50:48 +0200 Sabrina Dubroca wrote:
> > +	if (mode == TLS_HW) {
> > +		prot->aad_size = 0;
> > +		prot->tail_size = 0;
> > +	}
> 
> Strange, tail_size doesn't matter because HW doesn't support TLS 1.3
> but aad_size?  Is it overwritten by SW init or something?

For RX, yes, tls_set_device_offload_rx -> tls_set_sw_offload ->
  init_prot_info(mode=TLS_SW).
But aad_size is not used in tls_device_reencrypt, maybe because (for
both GCM variants)
    TLS_HEADER_SIZE + cipher_desc->iv == TLS_AAD_SPACE_SIZE

For TX, it looks like tls_device_fallback hardcodes TLS_AAD_SPACE_SIZE
where tls_sw would use prot->aad_size. tls_device doesn't use either.

Actually this patch is broken. If we set TLS_RX to TLS_SW first (for
example because we disabled tls-hw-rx-offload with ethtool), and
TLS_TX to TLS_HW second, that will set aad_size to 0, but RX needs it
to be set.

I'll send a fix to drop this hunk completely. Thanks for reviewing.

-- 
Sabrina