Skip to content

x-wing: Make X25519 non-contributory behaviour configurable - #369

Open
str4d wants to merge 1 commit into
RustCrypto:masterfrom
str4d:364-x-wing-non-contributory
Open

x-wing: Make X25519 non-contributory behaviour configurable#369
str4d wants to merge 1 commit into
RustCrypto:masterfrom
str4d:364-x-wing-non-contributory

Conversation

@str4d

@str4d str4d commented Aug 3, 2026

Copy link
Copy Markdown

Until the IETF RFC is published selecting a specific behaviour, we support both.

Closes #364.

Comment thread x-wing/src/lib.rs
/// [RFC 7748]: https://www.rfc-editor.org/info/rfc7748/#section-5
/// [specifies]: https://www.rfc-editor.org/info/rfc7748/#section-6.1
/// [CFRG have decided]: https://mailarchive.ietf.org/arch/msg/cfrg/v9fEHQj3QTUpdu72AzjyyrY4j2g/
pub fn reject_x25519_non_contributory_behaviour(self) -> Self {

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made this an extra method and didn't change the default behaviour, in order to make this a non-breaking change. But then I remembered that changing from kem::Decapsulate to kem::TryDecapsulate is breaking anyway, so preserving behaviour is not technically necessary as long as we provide a way to reach either state.

@str4d
str4d force-pushed the 364-x-wing-non-contributory branch from 6f791f0 to cfefc89 Compare August 3, 2026 03:05
Until the IETF RFC is published selecting a specific behaviour, we
support both.

Closes RustCrypto#364.
@tarcieri

tarcieri commented Aug 4, 2026

Copy link
Copy Markdown
Member

My personal inclination would just be to always reject, particularly if we switch to implementing TryDecapsulate. That matches the current behavior of dhkem.

I would also suggest against adding new methods to the public API, at least if their utility would be eliminated by a future change to the RFC.

@rozbb

rozbb commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

My 2c: it is odd to me to make TryDecapsulate have a specific behavior not stated in the spec being implemented. One way to avoid this while preserving the API is to just have another type, like DecapsulationKeyRejectNonContrib, which impls TryDecapsulate

@tarcieri

tarcieri commented Aug 4, 2026

Copy link
Copy Markdown
Member

@rozbb that's an interesting direction and could be done in a purely additive manner, then when the RFC is clarified we can remove one and keep the other

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

x-wing: Non-contributory behaviour needs to be controllable

3 participants