Linux-NVME Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Chris Leech <cleech@redhat.com>
To: Hannes Reinecke <hare@suse.de>
Cc: linux-nvme@lists.infradead.org, Daniel Wagner <dwagner@suse.de>,
	Prashanth Nayak <prashanth.nayak@netapp.com>,
	John Meneghini <jmeneghi@redhat.com>
Subject: Re: [PATCH 1/1] libnvme: TLS PSK derivation fixes
Date: Mon, 11 Aug 2025 21:33:06 -0700	[thread overview]
Message-ID: <aJrEAia9jVk17y-j@my-developer-toolbox-latest> (raw)
In-Reply-To: <df8bfa36-c1a9-4398-8246-5bc31991b8c9@suse.de>

On Mon, Jul 28, 2025 at 09:12:15AM +0200, Hannes Reinecke wrote:
> ...
> But: this is an incompatible change. Once we integrate this patch
> the keyring will end up with a _different_ derived PSK than it would
> without that patch. So the _same_ PSK (in interchange format) will
> result in different PSKs in the keyring, causing the handshake to
> fail if the other side is not aware of that.
> 
> > > _However_: PSKs generated with after applying this patch will be
> > > different than those prior to this patch.
> > > Consequently there will be interop issues with existing implementations
> > > (which will use the original encoding).
> > > 
> > > I guess we would need to wait for the target implementations to be fixed
> > > or introduce a flag switching to the old / compat implementation to avoid
> > > interop issues.
> > 
> > Yes, it is a breaking change for compatibility with other out-of-spec
> > implementations.  I'm hesitant to carry a flag for that, but it wouldn't
> > be too much trouble to implement.
> > 
> > Just don't touch your keyfile?  The tls-key import/export commands are
> > operating on the final derived TLS PSKs right?
> > 
> That might be the way out, and in fact what we should be doing.
> However, the fact still remains: after this patch has been applied
> one _cannot_ generate new PSKs until the other side has been updated,
> too.
> For linux it's easy, we can just require 'version xyz' from libnvme
> and the issue is solved. But for other implementations?
> There are IHVs out there who already shipped their products with TLS
> enablement, and they need to be fixed, too.
> And their timeline is vastly longer than ours.
> 
> So to avoid us having to synchronize against all of the others I think
> it might be easier to add a 'compat' flag of sorts to generate PSKs
> with the 'original' derivation algorithm, and then increase the
> libnvme version number once it's in.
> Then we can point the IHVs to that number so that they reference
> that version once their firmware is updated.

I've spent a bit of time on this, and while I don't have patches ready
to share just yet I do think it's worth commenting on the scope of the
change to keep the existing functionality behind a cli switch.

 libnvme:
 - keeping both sets of key derivation functions (this is not bad)
 - need to expose that functionality, so new exported APIs
   (I was thinking something like a flag field over a legacy-only function)
      - #define NVME_TLS_PSK_LEGACY (1u << 0)
      - char *nvme_generate_tls_key_identity_2(..., unsigned int flags)
      - long nvme_insert_tls_key_versioned_2(..., unsigned int flags)

 - support paths that load keys through nvme_fabrics_cfg [1]
   (for nvme-cli fabrics commands that take --tls_key)
      - add some sort of flag there, like nvme_fabrics_cfg.tls_legacy
      - add to merge_config, nvmf_update_config, build_options,
        supported_options, etc.

 - the JSON schema/code would need to support this for persistent
   configurations

 nvme-cli:
 - add a command line flag to keyring command functions
 - convert to use of new libnvme APIs to pass flag
       - gen_tls_key, check_tls_key
        (I don't think nvme_tls_key does key conversions)

 - add command line flag to generic parsing into nvme_fabrics_cfg
       - handles connect, connect-all, discover, discover-all

 - man pages, shell completions, etc.

It may be possible to keep this to just in libnvme and switch on an
environment variable, but that sounds like just as big of a support
nightmare as remembering to pass an option to every command.

If we don't have a resolution by then, maybe this is something we can
resolve at ALPSS.

[1] Side note; with nvme_fabrics_cfg _not_ being allocated through
libnvme, I don't see how the various additions there can be ABI safe. It
looks to me like this struct alone broke ABI in libnvme 1.4, 1.8, 1.9,
and 1.11.

- Chris



  parent reply	other threads:[~2025-08-12  4:33 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-21  2:17 [PATCH 0/1] NVMe/TLS connection issues to SPDK Chris Leech
2025-07-21  2:17 ` [PATCH 1/1] libnvme: TLS PSK derivation fixes Chris Leech
2025-07-21  6:36   ` Hannes Reinecke
2025-07-21 15:31     ` Chris Leech
2025-07-25  9:36       ` Hannes Reinecke
2025-07-25 18:08         ` Chris Leech
2025-07-28  7:12           ` Hannes Reinecke
2025-08-08 16:18             ` John Meneghini
2025-08-12  4:33             ` Chris Leech [this message]
2025-08-18  9:42               ` Hannes Reinecke
2025-08-20  8:10               ` Daniel Wagner
2025-08-20  8:22                 ` Hannes Reinecke
2025-08-26 14:09                   ` John Meneghini
2025-07-21  7:11 ` [PATCH 0/1] NVMe/TLS connection issues to SPDK Hannes Reinecke
2025-07-21 15:44   ` Chris Leech
2025-07-22  6:27     ` Hannes Reinecke
2025-07-24 14:35       ` Daniel Wagner
2025-07-24 15:07         ` Chris Leech
2025-07-24 15:37           ` Daniel Wagner
2025-08-12 22:05 ` Chris Leech
2025-08-12 22:11 ` [RFC PATCH 1/2] crypto: hkdf: add hkdf_expand_label() Chris Leech
2025-08-18  9:44   ` Hannes Reinecke

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=aJrEAia9jVk17y-j@my-developer-toolbox-latest \
    --to=cleech@redhat.com \
    --cc=dwagner@suse.de \
    --cc=hare@suse.de \
    --cc=jmeneghi@redhat.com \
    --cc=linux-nvme@lists.infradead.org \
    --cc=prashanth.nayak@netapp.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox