[CFRG] Re: [EXTERNAL] [lamps] Re: Re: Cross-testing update on LAMPS Composite and cfrg-concrete-hybrid-kems

Mike Ounsworth <ounsworth+ietf@gmail.com> Tue, 21 October 2025 22:41 UTC

Return-Path: <ounsworth@gmail.com>
X-Original-To: cfrg@mail2.ietf.org
Delivered-To: cfrg@mail2.ietf.org
Received: from localhost (localhost [127.0.0.1]) by mail2.ietf.org (Postfix) with ESMTP id C8EDF79E9175 for <cfrg@mail2.ietf.org>; Tue, 21 Oct 2025 15:41:39 -0700 (PDT)
X-Virus-Scanned: amavisd-new at ietf.org
X-Spam-Flag: NO
X-Spam-Score: -2.098
X-Spam-Level:
X-Spam-Status: No, score=-2.098 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no
Authentication-Results: mail2.ietf.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com
Received: from mail2.ietf.org ([166.84.6.31]) by localhost (mail2.ietf.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id CIOPXYQYUD3e for <cfrg@mail2.ietf.org>; Tue, 21 Oct 2025 15:41:38 -0700 (PDT)
Received: from mail-il1-x12f.google.com (mail-il1-x12f.google.com [IPv6:2607:f8b0:4864:20::12f]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (P-256) server-digest SHA256) (No client certificate requested) by mail2.ietf.org (Postfix) with ESMTPS id DB90579E9066 for <cfrg@irtf.org>; Tue, 21 Oct 2025 15:41:34 -0700 (PDT)
Received: by mail-il1-x12f.google.com with SMTP id e9e14a558f8ab-430d7638d27so29533395ab.3 for <cfrg@irtf.org>; Tue, 21 Oct 2025 15:41:34 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1761086494; x=1761691294; darn=irtf.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=mNGl9n3X/ydkoU1jx1z2pNloBMKZ1oQygKIbqINqySA=; b=SvTTCw7j5pa0SMijPaaE/W5QbiX+eUhmBT17SFcrKqGcwUKt5DwKJcaeZ0HMDHXblE Uya8bpU97x/lSalfe4zkSPRFhOA+7uYJleWPxRslIEHgwu3Lw06RU2VcBVmh2E12t/uI 2pYWjoFnO0YoTiOIyiT7XpRfXpkUP9+qJluDBjp/GqARzhviDbjTn6TWXoXBOmh/gHUO QARhYliBHxepk+th/RV4kAMZFGRMszNyVsbtrm6PLRJGssFwNl+gAu9kcRVKjau3QIou r+oSxRe2srhBHfLIQkzOryse4NcHE5eZPbVbQDeILMpUkeir+jH3EgAaldf5miRqSo9M by8w==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761086494; x=1761691294; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=mNGl9n3X/ydkoU1jx1z2pNloBMKZ1oQygKIbqINqySA=; b=vYJ0Iq0j9DFas3SKU5JwGAxBTEgAgPL3WH8pXPQ4h7iwmmF1dcqxX9NsREaWuMhpAR FmhzioCdxTGpCBq0iwUWsHqDoRgSG9BUX8SLKYbeURZT0yE1RYtBA2v8H4Kos84iTRVL zHdrIN2nHYtbNtrP/iyvyx7GatsBCfly4Wo3ETIUJcfksTtlirqj5EpYmdx00GRMf/CQ U2aJ87/XCzfYa9lDE8tW2WOMJphQdXRP3ZrzjEXmEyuAsn7MS/oMD8ajCorUBSet+Wed nwH0JT2SSlAAddHG6u78xE8iwu/zBFUKe2mZ4ylMmR4eKB+XblGxAqK62fjzfFbem6Qe +0RQ==
X-Forwarded-Encrypted: i=1; AJvYcCVRBcEeR1yowCGT92i2ls4S0hWUnjrKZr/G4taWUPBS5PqaSK79uTRo9A7n8/nhycrQiBeu@irtf.org
X-Gm-Message-State: AOJu0Yw66cQx0bzP3IKUUfzonuWcAsXZvJnSCxFgdfn9oB5pK/nNWyih 3fc7U05KRKC2r92x2jJYJA5IVc/15RpZ6LSZjTNVaqnylQuxNtX7Rb4uPN+zViwXrGMfxwO7OU0 M3Hc3+tri2KTFj5wyNFWgXIgCar98xBs=
X-Gm-Gg: ASbGncuD6i9xvUrReZ2btIOmisOO45iX10io7GiIBuXcDhrUV33fkCaK2g/gR65TfjN R6WvNZmBAHgFCVTZTWbvak4avy/RKa5pBjlK8PpU8Wuautx5Jr6BWlgoZ2aPzIZR7bk3Vd9DTJR 6FdfLCUNFh2KDZFAziD+kFC49X+HNqB5x8xVl8KPuoDgSgnL3Jj0v2mUwbXdXLEmeZnjqv121co daGWU0K1Awl3Xm/22smZec2IUPy1HXJ7JpPZyhxBKSNgk7Rg+INJ+tSoqeyYJk=
X-Google-Smtp-Source: AGHT+IHk6S5zZJ1ZYh4WqEqyv07H8XtDrXowaTmNPd0OJoi0HLGOzYV2CWofOk6zj1ZyF/sO+ocqMt4+K3RoN5BEUPc=
X-Received: by 2002:a05:6e02:349b:b0:430:ccc7:68f1 with SMTP id e9e14a558f8ab-430ccc76989mr248295055ab.28.1761086494090; Tue, 21 Oct 2025 15:41:34 -0700 (PDT)
MIME-Version: 1.0
References: <CAKZgXHoi88=hETRtacXgph0pscmU4VreGxOHTsEgbecLJT1opQ@mail.gmail.com> <21e583cf-a58c-4ff2-8ef6-e4c894525dd9@app.fastmail.com> <CAKZgXHpJKUVurxvWYKdrioMH1yKRFot8svAsuc2VXYwGxZ2jNw@mail.gmail.com> <CAJfyev290iHbckqaQJaX4pnySVwnp4_oSfbL1M8JQgji1MQsEg@mail.gmail.com> <CAKZgXHovWwAErpaUcW_KxW0Xx5-0TQT_=SWp9cCf6OZokxeeNQ@mail.gmail.com> <CAKZgXHo-BQzVARL-jxDDA+veXs1ytj-LmDLDWcviH5M8SpDEWg@mail.gmail.com> <CACsn0ckbY3hmLyEymFEEUMPmnP-zJuEZ23kUurZBtczT59O93w@mail.gmail.com> <CH0PR11MB573968364CC87463E44FFA409FF2A@CH0PR11MB5739.namprd11.prod.outlook.com> <CACsn0cnXYSLv64EWMZtm+LYEFP=PkNPcPoR-e2ZaypzKZt2_WQ@mail.gmail.com>
In-Reply-To: <CACsn0cnXYSLv64EWMZtm+LYEFP=PkNPcPoR-e2ZaypzKZt2_WQ@mail.gmail.com>
From: Mike Ounsworth <ounsworth+ietf@gmail.com>
Date: Tue, 21 Oct 2025 17:41:22 -0500
X-Gm-Features: AS18NWBWcgmZdIxy01DAygUIIn-2lhZxU6sq96-OjxgB3_LKlaQWLwnTyAc1Vuk
Message-ID: <CAKZgXHqAjh7HA-ahP7gaHouFWt2NnJQ1mtF6DXpwwbpPdn0=WQ@mail.gmail.com>
To: Watson Ladd <watsonbladd@gmail.com>
Content-Type: multipart/alternative; boundary="000000000000e62a720641b2e6a6"
Message-ID-Hash: AUBA7CJW7RF6ASHP6SAT2USOQFPIR5G3
X-Message-ID-Hash: AUBA7CJW7RF6ASHP6SAT2USOQFPIR5G3
X-MailFrom: ounsworth@gmail.com
X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-cfrg.irtf.org-0; header-match-cfrg.irtf.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header
CC: Mike Ounsworth <Mike.Ounsworth@entrust.com>, CFRG <cfrg@irtf.org>, "hpke@ietf.org" <hpke@ietf.org>, LAMPS WG <spasm@ietf.org>
X-Mailman-Version: 3.3.9rc6
Precedence: list
Subject: [CFRG] Re: [EXTERNAL] [lamps] Re: Re: Cross-testing update on LAMPS Composite and cfrg-concrete-hybrid-kems
List-Id: Crypto Forum Research Group <cfrg.irtf.org>
Archived-At: <https://mailarchive.ietf.org/arch/msg/cfrg/kGModlNGUtuoJnHTjWHdWSUPHy4>
List-Archive: <https://mailarchive.ietf.org/arch/browse/cfrg>
List-Help: <mailto:cfrg-request@irtf.org?subject=help>
List-Owner: <mailto:cfrg-owner@irtf.org>
List-Post: <mailto:cfrg@irtf.org>
List-Subscribe: <mailto:cfrg-join@irtf.org>
List-Unsubscribe: <mailto:cfrg-leave@irtf.org>

Watson,

Responding to this email.

> OpenSSL supports HPKE.

Right. And this is kinda my point. OpenSSL supports all sorts of
X.509-specific encodings too. Why is it ok to take an HPKE-specific private
key format and make that RECOMMENDED in a CFRG document -- implying that
all other protocols implementers would need to implement the bits of the
HPKE protocol necessary to support this private key format -- yet if I
proposed a CFRG doc that normatively used some ASN.1-based private key
format, people would SCREAM AT ME. All that LabeledExtract() stuff is
absolutely "HPKE protocol implementation" that does not exist in any other
protocol.

My point is this: ECDH is a thing that has existed for decades, is well
standardized, and well-supported in libraries. I consider it harmful to
start mandating new, FIPS-non-compliant, key derivation functions for it at
this point in its history.

On Tue, 21 Oct 2025 at 15:07, Watson Ladd <watsonbladd@gmail.com> wrote:

> On Tue, Oct 21, 2025 at 12:36 PM Mike Ounsworth
> <Mike.Ounsworth@entrust.com> wrote:
> >
> > > I don't understand: HKDF (or the underlying hash function worst case)
> absolutely does exist in current cryptographic libraries. If the argument
> is that a private key generated one way won't work when moved to a
> different system, that's a slightly different matter.
> >
> > Hi Watson,
> >
> > I could just replace some words there and make a pro-ASN.1 argument by
> saying that byte string parsers exist in all languages, so why is everyone
> so afraid to strip off an OCTET STRING.
> >
> > #1: interop and compatibility.
> > The goal of the LAMPS - CFRG cross-testing was to see if the two things
> we have defined are in fact the same thing. We have failed to do that
> because we have not thus far been able to read each other's private keys.
> The core issue is (in my opinion) because the CFRG doc uses what I will
> call an HPKE-specific private key format that I don't have easy access to
> an implementation for. From my perspective, that's an HPKE-specific thing
> that doesn't belong in a CFRG doc any more than ASN.1 would.
> >
> > #2 security:
> > The overarching mantra of cryptography is "Don't roll your own
> primitives, use a library", and here we have a CRFC document which is
> giving general cryptographic guidance, not scoped to the HPKE protocol,
> that requires implementing your own private key derivation function that we
> know is not well supported by crypto libraries. I don't think that is in
> fact good sound guidance. I think "If you have an existing hardened
> side-channel-resistant library that does EC, then just use that" is in fact
> better guidance. I get that CFRG publishes many things that are novel
> cryptographic primitives where that guidance doesn't apply, but ECDH is not
> novel cryptography, why are we making it novel, and is all that headache
> really worth the marginal security gains from using seeds?
>
> OpenSSL supports HPKE.
>
> OpenSSL supports setting the private key to a bignum ( by setting
> "priv" (OSSL_PKEY_PARAM_PRIV_KEY) <unsigned integer>) in key
> generation. OpenSSL I think implements constant time number
> comparisons (although the interface is baroque and there have been
> issues before). Certainly s2n is.
>
> Why exactly is this "rolling your own primitive" and implementing the
> hybrid at all not? Is there a reason that library authors wouldn't be
> implementing these? I'm not sure this argument is coherent, although
> there's one you could be making that we want to use existing libraries
> or hardware modules that only generate keys internally and can't
> import private keys.
>
> >
> > ---
> >
> > Mike Ounsworth
> >
> >
> >
> > ________________________________
> > From: Watson Ladd <watsonbladd@gmail.com>
> > Sent: Tuesday, October 21, 2025 2:23 PM
> > To: Mike Ounsworth <ounsworth+ietf@gmail.com>
> > Cc: Tushar Patel <tjpatel.tl@gmail.com>; Filippo Valsorda <
> filippo@ml.filippo.io>; CFRG <cfrg@irtf.org>; hpke@ietf.org <hpke@ietf.org>;
> LAMPS WG <spasm@ietf.org>
> > Subject: [EXTERNAL] [lamps] Re: [CFRG] Re: Cross-testing update on LAMPS
> Composite and cfrg-concrete-hybrid-kems
> >
> > On Tue, Oct 21, 2025 at 12: 14 PM Mike Ounsworth <ounsworth+ietf@
> gmail. com> wrote: > > Follow-up: I see that DHKEM. DeriveKeyPair(ikm) is
> defined in RFC9180: > https: //urldefense. com/v3/__https: //datatracker.
> ietf.
> org/doc/html/rfc9180*derive-key-pair__;Iw!!FJ-Y8qCqXTj2!YZhxRq-M6f_HcCCo4UQwQL5yYgX-wB80VLdUBwT4kjVcB1kFr4Q-3qvwqDoxc0sd9b0S4uQDAW4gzWiIEJVI_sRPPS7QFdI$
> >
> > On Tue, Oct 21, 2025 at 12:14 PM Mike Ounsworth
> > <ounsworth+ietf@gmail.com> wrote:
> > >
> > > Follow-up: I see that DHKEM.DeriveKeyPair(ikm) is defined in RFC9180:
> > >
> https://urldefense.com/v3/__https://datatracker.ietf.org/doc/html/rfc9180*derive-key-pair__;Iw!!FJ-Y8qCqXTj2!YZhxRq-M6f_HcCCo4UQwQL5yYgX-wB80VLdUBwT4kjVcB1kFr4Q-3qvwqDoxc0sd9b0S4uQDAW4gzWiIEJVI_sRPPS7QFdI$
> > >
> > > That makes liberal use of HPKE's LabelledExtract(), which fully
> explains why this is not compatible with the python API.
> > >
> > > That means that a seed-based key derivation is defined for P-256,
> P-384, and P-521, but only within the confines of the DHKEM primitive
> within the HPKE protocol. It is still the case that a seed-based key
> derivation is not defined for ECDH in general.
> > >
> > > So, on that grounds, I object to draft-irtf-cfrg-concrete-hybrid-kems
> RECOMMENDING a seed-based priv on exactly the same grounds that anyone else
> would object to it RECOMMENDING an ASN.1 based encoding: this is a CFRG
> document that normatively depends on a building block that only exists in
> one single IETF protocol, and most importantly to me, does not exist in
> FIPS or current cryptographic libraries.
> >
> > I don't understand: HKDF (or the underlying hash function worst case)
> > absolutely does exist in current cryptographic libraries. If the
> > argument is that a private key generated one way won't work when moved
> > to a different system, that's a slightly different matter.
> >
> > >
> > > On Tue, 21 Oct 2025 at 13:34, Mike Ounsworth <ounsworth+ietf@gmail.com>
> wrote:
> > >>
> > >> Hi CFRG and HPKE,
> > >>
> > >> I just want to give an update on this. Richard and I did some more
> cross-testing this week, and we are at an impasse on the SEC-P curves, and
> it has to do with the seeds. The CFRG /HPKE draft stores the hybrid private
> keys as a seed, so you have to re-derive the P256 half from a seed. My
> problem is that ECDH is a thing that has been standardized for like 20
> years in [SEC1] and [SP.800-56A], and those two documents do not specify or
> allow a seed-based EC keygen, and as a consequence, many crypto libraries
> don't support a seed-based EC keygen API. For example, I'm doing my
> reference implementation for Composites on top of the core python
> cryptography library, and I cannot implement the CRFG / HPKE draft that
> way. Python crypto has this:
> > >>
> https://urldefense.com/v3/__https://cryptography.io/en/latest/hazmat/primitives/asymmetric/ec/*cryptography.hazmat.primitives.asymmetric.ec.derive_private_key__;Iw!!FJ-Y8qCqXTj2!YZhxRq-M6f_HcCCo4UQwQL5yYgX-wB80VLdUBwT4kjVcB1kFr4Q-3qvwqDoxc0sd9b0S4uQDAW4gzWiIEJVI_sRPBePJyjM$
> > >> but that appears to not derive the same keys as Richard's
> implementation.
> > >>
> > >> The issue is that EC.derive_priv_from_seed() is not a standardized
> function. You can probably infer from a careful read of [SEC1] or
> [SP.800-56A] what it needs to be, but it is not actually standardized or
> FIPS-allowed. It requires mucking around with EC point multiplication. The
> fact that it's not a standardized thing means that I will likely not be the
> last person to have interop problems with this. Maybe my issues are as
> simple as not using that python ec.derive_private_key() properly, maybe his
> scalar is 'big' rather than 'little' or something. If that's the case, I'd
> be happy -- but this is the kind of mess you get into when you use
> non-standardized APIs for existing 20 year-old primitives.
> > >>
> > >> So at this point, I think we have to declare non-compatibility
> between LAMPS and HPKE Hybrid KEMs. Since our X-Wings are compatible, we
> know that our QSF frameworks are identical, so in principle our P256's
> should work too, but we're been incapable of testing it because this
> off-spec seed stuff is getting in the way.
> > >>
> > >> On Thu, 16 Oct 2025 at 17:40, Tushar Patel <tjpatel.tl@gmail.com>
> wrote:
> > >>>
> > >>> Sorry, jumping in a running train and
> > >>> many years ago while working through JSON bindings for the tests, I
> ran into a sign bit conversion error on big numbers and had to rewrite part
> of the library, the fixed code is with a previous employer, 64-bit and
> 128-bit in JSON libs are a mess or sign bit issues in general.
> > >>>
> > >>> Also, please make sure that you are parsing the compressed notations
> for ECC correctly, some libraries pack those incorrectly and also wrote my
> own ASN.1 parsers for some elements, you might be surprised where I hit
> these areas, can’t disclose, though both were from reputed organizations.
> > >>>
> > >>> Last, please make sure you have matching generators and incorporate
> the affine and infinity checks, these may translate to all sorts of weird
> issues that are impossible to debug through OSS macros in most cases.
> > >>>
> > >>> There is substandard ECC, ECDSA and ECDHE at many places in OSS libs
> and you may have to debug these.
> > >>>
> > >>> Personally, I think NIST should mandate pristine implementations as
> companies spend a lot more time fixing other implementations than their own.
> > >>>
> > >>> Hope it’s Useful,
> > >>> Tushar
> > >>>
> > >>> On Thu, Oct 16, 2025 at 8:45 AM Mike Ounsworth <
> ounsworth+ietf@gmail.com> wrote:
> > >>>>
> > >>>> Thanks Filippo,
> > >>>>
> > >>>> Richard and I did some debugging last night. He gave me new test
> vectors that include that bug fix to the P256 / P384 constants.
> > >>>>
> > >>>> My current theory is that the code I quickly whipped up to do a
> P256 private key expansion from seed does not match Richard's. Since this
> is wholly out of scope for LAMPS Composite (we store the full P256 private
> key), I'm hoping that Richard can give me a dump of intermediate values
> that includes the expanded P256 / P384 private key so that we don't need to
> debug through the P256-from-seed stuff. Anyway, this is all good validation
> of both our test vectors.
> > >>>>
> > >>>> Anyway, making progress!
> > >>>>
> > >>>> On Thu, 16 Oct 2025 at 10:29, Filippo Valsorda <
> filippo@ml.filippo.io> wrote:
> > >>>>>
> > >>>>> 2025-10-16 03:55 GMT+02:00 Mike Ounsworth <
> ounsworth+ietf@gmail.com>:
> > >>>>>
> > >>>>> Results: we are cross-compatible on X-Wing, but not on P256 (and
> that's after hacking my script to use the CFRG label not the LAMPS label,
> so there's clearly some other bug at play, but I have no idea what, so of
> course I assume it's on the cfrg reference impl side 😋).
> > >>>>>
> > >>>>>
> > >>>>> Could be
> https://urldefense.com/v3/__https://github.com/cfrg/draft-irtf-cfrg-concrete-hybrid-kems/pull/21__;!!FJ-Y8qCqXTj2!YZhxRq-M6f_HcCCo4UQwQL5yYgX-wB80VLdUBwT4kjVcB1kFr4Q-3qvwqDoxc0sd9b0S4uQDAW4gzWiIEJVI_sRP6B8fHsg$
> .
> > >>>>
> > >>>> _______________________________________________
> > >>>> CFRG mailing list -- cfrg@irtf.org
> > >>>> To unsubscribe send an email to cfrg-leave@irtf.org
> > >
> > > _______________________________________________
> > > Spasm mailing list -- spasm@ietf.org
> > > To unsubscribe send an email to spasm-leave@ietf.org
> >
> >
> >
> > --
> > Astra mortemque praestare gradatim
> >
> > _______________________________________________
> > Spasm mailing list -- spasm@ietf.org
> > To unsubscribe send an email to spasm-leave@ietf.org
> >
> > Any email and files/attachments transmitted with it are intended solely
> for the use of the individual or entity to whom they are addressed. If this
> message has been sent to you in error, you must not copy, distribute or
> disclose of the information it contains. Please notify Entrust immediately
> and delete the message from your system.
> >
>
>
> --
> Astra mortemque praestare gradatim
>