[CFRG] Re: Nailing down non-contributory behaviour in the hybrid-kems drafts

Peter Schwabe <peter@cryptojedi.org> Thu, 16 July 2026 07:12 UTC

Return-Path: <peter@cryptojedi.org>
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 AC4C0117A3FB8 for <cfrg@mail2.ietf.org>; Thu, 16 Jul 2026 00:12:06 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ietf.org; s=ietf1; t=1784185926; bh=jCK+Dm6W3Xo4L0sDZ1+iNp5LdonsFtU2VFXSsxbPRaQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=Ubu+dCLgjjk/LrJZ2M/DPvDcSRPEFOsblK23k0Ag8RhuNQVbX/rOKaDEwHjTnmowu zD+/56x11a0R/izFxBWEeVE5JAW2VUdXTQj7TbpqdyaQ6gYRpKqhH0lHvkm6/qlFjz aKLRpy7E1BmiyiINpR+i5VDqP06UwowZCUCT6Br4=
X-Virus-Scanned: amavisd-new at ietf.org
X-Spam-Flag: NO
X-Spam-Score: -2.097
X-Spam-Level:
X-Spam-Status: No, score=-2.097 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, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, 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=cryptojedi.org
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 KBzNX522MaBu for <cfrg@mail2.ietf.org>; Thu, 16 Jul 2026 00:12:05 -0700 (PDT)
Received: from mout.kundenserver.de (mout.kundenserver.de [212.227.126.131]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature ECDSA (P-256) server-digest SHA256) (No client certificate requested) by mail2.ietf.org (Postfix) with ESMTPS id B7358117A3FB3 for <cfrg@irtf.org>; Thu, 16 Jul 2026 00:12:05 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cryptojedi.org; s=s1-ionos; t=1784185917; x=1784790717; i=peter@cryptojedi.org; bh=TcO1cvK/ayycIZrrTBkcXvdrcYjBE89P9NPYPKk3jQc=; h=X-UI-Sender-Class:Date:From:To:Cc:Subject:Message-ID:References: MIME-Version:Content-Type:In-Reply-To:Content-Transfer-Encoding: cc:content-transfer-encoding:content-type:date:from:message-id: mime-version:reply-to:subject:to; b=yfE2vvll4WZKUDdwZMsnPpSDQAVnYIj2udawzfmB9trE8/zFLwfmyou5DHfkand4 u7IcsHU/qXx/Q9wHsze2SK3d7r8CKbSzfrCz5iWgs3ULOItTeAOxo0FffAVokIrjR UK+2kGyoonpjf4SkqUgkWvr+DzMNriZwpY0sVn6pYVFZg0gq6MT4BdNFoOTTxZEhb cF+2N3gz6HJ9LkWQW5m+JLDeUDSmgk56xqdVqt6+SCoeD59sXbIdCVUZ3VoNrhRWA Ylqnak9o70p6FOvuP//Q59QB6adKJOSgyNhTkdpHKvgkLAlUSwfGiQ8cnBwsJL951 fQ8u1mV6JLm0eLKvaQ==
X-UI-Sender-Class: 55c96926-9e95-11ee-ae09-1f7a4046a0f6
Received: from client.hidden.invalid by mrelayeu.kundenserver.de (mreue010 [212.227.15.167]) with ESMTPSA (Nemesis) id 1Mtf7H-1x1Wap3UEB-00srkv; Thu, 16 Jul 2026 09:11:57 +0200
Date: Thu, 16 Jul 2026 09:11:53 +0200
From: Peter Schwabe <peter@cryptojedi.org>
To: Jack Grigg <ietf@jackgrigg.com>
Message-ID: <aliEOUowD938uHqL@localhost>
References: <CAPC=aNXyp1qpsbMiTYjqc=RX8tmWmKCasTS8sKh4Q==UOi+=sQ@mail.gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Disposition: inline
In-Reply-To: <CAPC=aNXyp1qpsbMiTYjqc=RX8tmWmKCasTS8sKh4Q==UOi+=sQ@mail.gmail.com>
X-Provags-ID: V03:K1:Pu/L9ZcSssTNrZXjMjire9fJdM0A3fk3bvwxANy43THjtGvb5q1 fTRffVv1iwxMGlApne0OymiXuS8jmeaYbisRPXOlz/JwFTCF53kfWhC7x0mBwvbwCCELA60 8tssOSsds4on0Rf21kctIVqJOjxX31GVfTeoyHbV2RHzxcM4FxcEP2p1Vp1huJEri92PuFV nCEJIdwoIfTAtzvyxEr0Q==
UI-OutboundReport: notjunk:1;M01:P0:VJPOibSJL+w=;XfLXJpwBFLxeuS7BgAX1KXIguL6 af99jwMucl8rAIpy4LmjL6H86fNnIysxa4M9vcqq2nosJfGwSic9vp0sJw8Z7gtn0LHdCxktL qwVhjLitkog9+E+oA6Cz9/w1P8QBX+wPQqr1d61JG77tTmREhz8b0YWyKNEhbfABmSPvs4NAD 6YbU0cOcitUPDBGDs6cEzg4pkx1oaiPTP5HcPCHwST8TE35NkqVKG5ChbblArTWdPgcnyY+mE d0M8XKhiSMfiCBaW4QhUJHTtBmW0pwFdc9z3aX6d/02eJ4sQwjsEnPe4WW3WoZ2JcRzvK0p9e WzCOW+OIx784y+OYPC63Dg+Jk0mWYhqIFn2EdAMKLqwEttw52JeaNHm/gu1IHXu3zkJN2xNwe bLODq1mrdi3liBQ0Jt2FzrZ3vPDABKr3EfQlpaLYx5VSNiJzKOvanzBUPy/jHU6XNUSfIQi2P Cjrv8NADR2+OcD8ojzjPwbIEHfCv5UytUoMoWu/H+XENcHYzkNijbZVqnpAi8o9b26HXtiYTB Y+rYJ8TQCnggFcpDiCIlroLhbs9yVgivfRFYHRsOFq1eQABXJ4In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O0ftAtgbl1OqUPD6hj88XS6bNowMt8tDD6Jssxsg5NtC/oilT1D mdey2GPBJVKtpP8+S+4zHFoEhJZIhZ084vQ4i20XBhx5IxEBq0Irpl1a3nV7t96GVkHUmIyjV oUilNj0QlDIYAvIItiEUphJsf2Fv5CPUWRi863ayu9FRY39lS/QI1t8NvUJlb3jw6rG6qrz3f JFES+BaUP2T4QXmyYnX+i8RoMy1VskHI8OrJPoGSSe7khrc4MPfNok3zM8Wf4w9+gYpzna7N4 feF25oKI15C/bc4I6flWIztfrHMoUKB4/oVv4w2Y8T4rNFpNXmWjaQ4R2dIqDcIiDi4cE/uko fJ6M2hxPKk7VdQuw6Q0SBZ+dxe8Qrzu10etVw2jJauSLMQsmbEVqMSH5PKpl4wgPeaAMQ+og= =
Content-Transfer-Encoding: quoted-printable
Message-ID-Hash: WWAZY2I365GP5ACDDGJ46UREPSFBBPK5
X-Message-ID-Hash: WWAZY2I365GP5ACDDGJ46UREPSFBBPK5
X-MailFrom: peter@cryptojedi.org
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: IRTF CFRG <cfrg@irtf.org>
X-Mailman-Version: 3.3.9rc6
Precedence: list
Subject: [CFRG] Re: Nailing down non-contributory behaviour in the hybrid-kems drafts
List-Id: Crypto Forum Research Group <cfrg.irtf.org>
Archived-At: <https://mailarchive.ietf.org/arch/msg/cfrg/1jiE9MI5O2U-V3_6S08RlLJ-GYg>
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>

Dear Jack,

If your main concern is about X-Wing being contributory (or not), isn't
that resolved by ML-KEM being contributory?

All the best,

Peter


Jack Grigg <ietf@jackgrigg.com> wrote:
>  Hi all,
> 
> While implementing a protocol using X-Wing (specifically post-quantum
> support in age encryption [0] using HPKE), I encountered an incompatibility
> between two different X-Wing implementations that led me down the
> hybrid-kems rabbit hole, and I uncovered several inconsistencies in the
> drafts that should be resolved.
> 
> The core problem stems from Section 6.1 of RFC 7748 [1], which placed a MAY
> on checking for non-contributory behaviour:
> 
> > Both now share K = X25519(a, X25519(b, 9)) = X25519(b, X25519(a, 9)) as a
> shared secret.  Both MAY check, without leaking extra
> > information about the value of K, whether K is the all-zero value and
> abort if so (see below).
> > [...]
> > The check for the all-zero value results from the fact that the X25519
> function produces that value if it operates on an input corresponding to a
> point with small order, where the order divides the cofactor of the curve
> (see [Section 7](https://www.rfc-editor.org/info/rfc7748/#section-7))
> 
> Neither the original X-Wing draft [2], nor the ePrint it is based on [3]
> mentioned this, and thus inherently embedded the MAY in its specification.
> This has led to different X-Wing implementations implementing different
> behaviour, likely based on whatever their existing X25519 implementation
> made most convenient to do.
> 
> However, this is seemingly incompatible with the current draft
> specification for X-Wing (aka MLKEM768-X25519) in
> draft-irtf-cfrg-concrete-hybrid-kems-04 [4]. Specifically, Section 4.2 of
> draft-irtf-cfrg-hybrid-kems-12 [5] states:
> 
> > A scalar value of zero MUST NOT be used as a private key: it does not
> correspond to a meaningful Diffie-Hellman exchange and, for some curves
> such as P-256, is explicitly forbidden by the relevant standards and would
> yield a point-at-infinity encoding that departs from the fixed-size model
> used here. RandomScalar MUST NOT return a zero scalar; for the groups of
> interest this occurs only with negligible probability.
> 
> A strict reading of the above could be interpreted as allowing
> non-contributory behaviour, because AFAICT there's nothing in the current
> text that actually does the identity check on the nominal group shared
> secret. However, I think these MUST NOTs imply it was the authors'
> intentions to require rejection of non-contributory behaviour. Indeed, if
> you read the specifications of expandDecapsKeyG and prepareEncapsG [6] with
> those MUST NOTs enforced, then it is impossible to produce a ciphertext
> that would have non-contributory behaviour, and thus an implementation
> could quite justifiably reject those that do.
> 
> Further supporting evidence for rejecting non-contributory behaviour in
> IETF KEMs is found in RFC 9180 [7], which makes this a MUST for the X25519
> DHKEM (which its update draft [8] preserves).
> 
> Now, for an honestly-generated key and ciphertext, the chance of
> encountering this divergence is cryptographically negligible:
> - The Curve25519 scalar within a decapsulation key is a subslice of the
> output of PRG(seed) (via GenerateKeyPair [9] and expandDecapsKeyG).
> - The ephemeral Curve25519 scalar used within encapsulation is the output
> of RandomScalar(random(32)) (via prepareEncapsG), which is constrained by
> the MUST NOT on the output of RandomScalar.
> 
> However, for an adversarial ciphertext, there is nothing preventing the
> adversary from using zero as the ephemeral Curve25519 scalar, or a point of
> small order as the ephemeral public key. Indeed, I encountered this issue
> due to this specific edge case being exercised in age test vectors. So the
> probability of encountering this divergence is non-negligible, and the
> specs should handle it.
> 
> My suggested fix is to alter the definition of ElementToSharedSecret [10]
> to something like:
> 
> >  ElementToSharedSecret(P) -> ss: Extract a shared secret from an element
> of the group (e.g., by taking the X coordinate of an elliptic curve point),
> aborting if a valid shared secret cannot be extracted.
> 
> and then for the Curve25519 Nominal Group defined in Section 3.1.2
> of draft-irtf-cfrg-concrete-hybrid-kems-04 [11], change its
> ElementToSharedSecret specification to:
> 
> > ElementToSharedSecret(p) -> ss: Aborts if P is the all-zero value,
> otherwise outputs P.
> 
> However, that does then raise the question of whether X-Wing is being
> assumed as purely an implicitly-rejecting KEM (due to how its ML-KEM
> component behaves). I don't believe it was ever valid to assume this, due
> to the MAY in the X25519 component meaning that X25519 implementations can
> explicitly abort, and thus so might X-Wing. However, if this is a
> widely-held and relied-upon assumption, then it would imply that a
> compatible X-Wing spec would instead need to require that
> expandDecapsKeyG MUST NOT check whether the shared secret is the all-zero
> value, in order to prevent the abort. I myself would prefer that X-Wing
> follow the RFC 9180 precedent and reject non-contributory behaviour.
> 
> ---
> 
> Regardless of how the above is addressed, at least one other fix is
> necessary. The Curve25519 Nominal Group specifies its RandomScalar as:
> 
> > RandomScalar(seed) -> k: Implemented by the identity function, i.e., by
> returning the seed.
> 
> This trivially violates the MUST NOT from draft-irtf-cfrg-hybrid-kems-12;
> the all-zero seed produces the forbidden zero scalar. This should be
> similarly updated to:
> 
> > RandomScalar(seed) -> k: Aborts if seed is the all-zero value, otherwise
> returns the seed.
> 
> Cheers,
> Jack
> 
> [0] https://c2sp.org/age#mlkem768x25519-recipient-stanza
> [1] https://www.rfc-editor.org/info/rfc7748/#section-6.1
> [2] https://datatracker.ietf.org/doc/html/draft-connolly-cfrg-xwing-kem-10
> [3] https://eprint.iacr.org/2024/039
> [4]
> https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-concrete-hybrid-kems-04#name-mlkem768-x25519
> [5]
> https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-hybrid-kems-12#section-4.2-4
> [6]
> https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-hybrid-kems-12#name-using-a-nominal-group
> [7] https://www.rfc-editor.org/info/rfc9180/#section-7.1.4
> [8]
> https://datatracker.ietf.org/doc/html/draft-ietf-hpke-hpke-04#name-validation-of-inputs-and-ou
> [9]
> https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-hybrid-kems-12#name-key-generation
> [10]
> https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-hybrid-kems-12#section-4.2-3.3.1
> [11]
> https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-concrete-hybrid-kems-04#name-curve25519-nominal-group

> _______________________________________________
> CFRG mailing list -- cfrg@irtf.org
> To unsubscribe send an email to cfrg-leave@irtf.org