Skip to content

refactor(traits): migrate Kem error types to associated types - #1552

Open
Arul-Sujith wants to merge 1 commit into
celabshq:mainfrom
Arul-Sujith:feat-kem-traits-errors
Open

refactor(traits): migrate Kem error types to associated types#1552
Arul-Sujith wants to merge 1 commit into
celabshq:mainfrom
Arul-Sujith:feat-kem-traits-errors

Conversation

@Arul-Sujith

Copy link
Copy Markdown
Contributor

Refactor Kem trait errors to use associated types #1535

Changes

  • Replaced hard-coded errors with associated types in libcrux_traits::kem (arrayref, slice, and owned).
  • Updated libcrux-ml-kem to specify core::convert::Infallible as its error type.
  • Updated the libcrux-kem wrapper to take advantage of ML-KEM's infallibility, unwrapping it gracefully.
  • Updated curve25519 and p256 implementations to bind their associated types back to the standard library errors.

This commit addresses issue celabshq#1535 by changing the hard-coded KeyGenError, EncapsError, and DecapsError in the various Kem traits into associated types. This allows infallible implementations, such as ML-KEM, to specify core::convert::Infallible as their error type, removing the need for callers to handle impossible errors. Implementations for P-256 and Curve25519 have been updated accordingly.
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.

1 participant