Message ID | cover.1691584074.git.sd@queasysnail.net |
---|---|
Headers | show |
Series | tls: implement key updates for TLS1.3 | expand |
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; > +}