tls: block decryption when a rekey is pending
authorSabrina Dubroca <sd@queasysnail.net>
Thu, 12 Dec 2024 15:36:04 +0000 (16:36 +0100)
committerDavid S. Miller <davem@davemloft.net>
Mon, 16 Dec 2024 12:47:29 +0000 (12:47 +0000)
commit0471b1093e3a5d702ba2bf5987c35ee0e2336855
treea4b7b39ebd281e81bccc51a0cd3f455fb94133d9
parent92c932b9946c1e082406aa0515916adb3e662e24
tls: block decryption when a rekey is pending

When a TLS handshake record carrying a KeyUpdate message is received,
all subsequent records will be encrypted with a new key. We need to
stop decrypting incoming records with the old key, and wait until
userspace provides a new key.

Make a note of this in the RX context just after decrypting that
record, and stop recvmsg/splice calls with EKEYEXPIRED until the new
key is available.

key_update_pending can't be combined with the existing bitfield,
because we will read it locklessly in ->poll.

Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/net/tls.h
net/tls/tls_sw.c