From: Sabrina Dubroca <sd@queasysnail.net>
To: Hannes Reinecke <hare@suse.de>
Cc: Chuck Lever III <chuck.lever@oracle.com>,
Narayan Ayalasomayajula <Narayan.Ayalasomayajula@wdc.com>,
"fkrenzel@redhat.com" <fkrenzel@redhat.com>,
kernel-tls-handshake <kernel-tls-handshake@lists.linux.dev>
Subject: Re: Question regarding TLS Key update for NVMe-TCP protocol
Date: Fri, 6 Dec 2024 12:26:23 +0100 [thread overview]
Message-ID: <Z1LfX4S71BRvBKOW@hog> (raw)
In-Reply-To: <4c2b8312-a0a9-48f7-b5b3-acc73bcc538d@suse.de>
2024-12-03, 16:20:12 +0100, Hannes Reinecke wrote:
> On 12/3/24 15:33, Chuck Lever III wrote:
> > > On Dec 3, 2024, at 2:17 AM, Hannes Reinecke <hare@suse.de> wrote:
> > > But the current in-kernel TLS implementation doesn't allow to change
> > > the cipher ( cf net/tls/tls_main.c: do_tls_setsockopt_conf() ), so
> > > the only chance here is to close the connection and start from scratch.
> >
> > Have we asked Boris and friends if it would be possible to
> > implement KeyUpdate via ktls? Just curious.
> >
> The immediate problem with KeyUpdate is here:
>
> net/tls/tls_main.c:tls_setsockopt_conf()
>
> /* Currently we don't support set crypto info more than one time */
> if (TLS_CRYPTO_INFO_READY(crypto_info))
> return -EBUSY;
And my patches (mentioned in the first email of this thread, but
there's another version that I sent for review more recently [1])
address that.
[1] https://lore.kernel.org/netdev/cover.1731597571.git.sd@queasysnail.net/
> so we need to close the socket whenever we want to change the TLS key.
> And that results in a call to the socket callbacks, which informs the
> NVMe-TCP driver, and the connect is reset.
>
> KeyUpdate is a single message in the packet stream, transferring
> the new key values encrypted with the original key.
nit: the KeyUpdate message doesn't contain the new key, it just says
that the new key will be used from that point on (otherwise we
wouldn't have to worry about keeping secrets around?).
> But: The new key is derived from the application secret, which is _not_ the
> currently used Key/IV values used by the in-kernel TLS implementation (cf
> section 7.3 'Traffic Key Calculation' in RFC 8446).
> So we cannot compute the next set of application traffic secrets; the only
> one who might have had this is the tlshd session, but that is destroyed once
> the handshake is done (or, rather, I hope it is ...).
>
> So the original handshake traffic secrets are gone, and we cannot
> derive the next set of traffic secrets from there. Plus I'm not sure
> if we should keep that around in tlshd; that definitely would be prone
> to leak secret material, inviting $RANDOM_HACKER to attack tlshd ...
>
> And that's before even checking whether we need to modify gnutls
> for deriving updated traffic secrets ...
I would expect all TLS libraries keep those secrets around to be able
to implement KeyUpdate regardless of ktls (but I only work on the
kernel, not gnutls/openssl).
--
Sabrina
next prev parent reply other threads:[~2024-12-06 11:26 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <BYAPR04MB53982DF8F2777C6D28A23067EF282@BYAPR04MB5398.namprd04.prod.outlook.com>
[not found] ` <BYAPR04MB6102F3173201AF0983DB6166FF292@BYAPR04MB6102.namprd04.prod.outlook.com>
[not found] ` <BYAPR04MB5398745DD2E7E66981384342EF292@BYAPR04MB5398.namprd04.prod.outlook.com>
[not found] ` <BYAPR04MB61020B390B594196C8726D85FF292@BYAPR04MB6102.namprd04.prod.outlook.com>
[not found] ` <SN6PR04MB5406D4D68F82EBFFC1C580F3EF352@SN6PR04MB5406.namprd04.prod.outlook.com>
2024-12-02 18:50 ` Question regarding TLS Key update for NVMe-TCP protocol Chuck Lever III
2024-12-03 7:17 ` Hannes Reinecke
2024-12-03 14:33 ` Chuck Lever III
2024-12-03 15:20 ` Hannes Reinecke
2024-12-06 11:26 ` Sabrina Dubroca [this message]
2024-12-06 12:09 ` Hannes Reinecke
2024-12-06 13:05 ` Sabrina Dubroca
2024-12-06 14:26 ` Hannes Reinecke
2024-12-06 15:40 ` Sabrina Dubroca
2024-12-06 16:23 ` Hannes Reinecke
2024-12-06 17:04 ` Chuck Lever
2024-12-06 15:22 ` Chuck Lever
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=Z1LfX4S71BRvBKOW@hog \
--to=sd@queasysnail.net \
--cc=Narayan.Ayalasomayajula@wdc.com \
--cc=chuck.lever@oracle.com \
--cc=fkrenzel@redhat.com \
--cc=hare@suse.de \
--cc=kernel-tls-handshake@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.