[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230811183753.3a18a09a@kernel.org>
Date: Fri, 11 Aug 2023 18:37:53 -0700
From: Jakub Kicinski <kuba@...nel.org>
To: Sabrina Dubroca <sd@...asysnail.net>
Cc: netdev@...r.kernel.org, Vadim Fedorenko <vfedorenko@...ek.ru>, Frantisek
Krenzelok <fkrenzel@...hat.com>, Kuniyuki Iwashima <kuniyu@...zon.com>,
Apoorv Kothari <apoorvko@...zon.com>, Boris Pismenny <borisp@...dia.com>,
John Fastabend <john.fastabend@...il.com>, Shuah Khan <shuah@...nel.org>,
linux-kselftest@...r.kernel.org, Gal Pressman <gal@...dia.com>, Marcel
Holtmann <marcel@...tmann.org>
Subject: Re: [PATCH net-next v3 2/6] tls: block decryption when a rekey is
pending
On Wed, 9 Aug 2023 14:58:51 +0200 Sabrina Dubroca wrote:
> +static int tls_check_pending_rekey(struct sock *sk, struct sk_buff *skb)
> +{
> + const struct tls_msg *tlm = tls_msg(skb);
> + const struct strp_msg *rxm = strp_msg(skb);
> +
> + if (tlm->control == TLS_RECORD_TYPE_HANDSHAKE) {
unlikely()
does the nachine code look worse if we flip the condition and return
early instead of indenting the entire function?
> + char hs_type;
> + int err;
I'd probably err on the side of declaring those on the outside, but if
we don't we should move rxm in here, it's not needed outside. Either,
or.
> + if (rxm->full_len < 1)
> + return -EINVAL;
> +
> + err = skb_copy_bits(skb, rxm->offset, &hs_type, 1);
> + if (err < 0)
> + return err;
> +
> + if (hs_type == TLS_HANDSHAKE_KEYUPDATE) {
> + struct tls_context *ctx = tls_get_ctx(sk);
feels a bit like we should just pass ctx rather than sk?
> + struct tls_sw_context_rx *rx_ctx = ctx->priv_ctx_rx;
> +
> + rx_ctx->key_update_pending = true;
> + }
> + }
> +
> + return 0;
> +}
Powered by blists - more mailing lists