Skip to content

feat: implement RustCrypto traits for signatures and KEMs#310

Open
0rlych1kk4 wants to merge 3 commits into
open-quantum-safe:mainfrom
0rlych1kk4:feat/rustcrypto-kem-signature-traits
Open

feat: implement RustCrypto traits for signatures and KEMs#310
0rlych1kk4 wants to merge 3 commits into
open-quantum-safe:mainfrom
0rlych1kk4:feat/rustcrypto-kem-signature-traits

Conversation

@0rlych1kk4

Copy link
Copy Markdown

Summary

This PR continues the work started by @SebastianFaller in #295 and updates it for the current main branch.

It adds RustCrypto trait support for:

  • KEM encapsulation and decapsulation
  • Signature signing and verification

The original implementation commit was preserved, so the authorship remains attributed to @SebastianFaller.

Changes

  • add Encapsulator and Decapsulator implementations for the RustCrypto KEM traits;
  • add Signer and Verifier implementations for the RustCrypto signature traits;
  • keep the usage examples as doctests;
  • apply formatting fixes;
  • resolve Clippy warnings in the added adapters.

Validation

Tested with both stable and beta Rust:

  • cargo fmt --all -- --check
  • cargo check --workspace --all-features
  • cargo test -p oqs --all-features
  • cargo test -p oqs --doc --all-features
  • cargo clippy -p oqs --all-targets --all-features --no-deps -- -D warnings
  • cargo +beta check --workspace --all-features
  • cargo +beta test -p oqs --all-features
  • cargo +beta test -p oqs --doc --all-features

Results:

  • 615 unit tests passed
  • 7 doctests passed

The full workspace Clippy run is still blocked by the existing
clippy::unnecessary_map_or warning in oqs-sys/build.rs, which is unrelated
to this change.

Continues #295.
Closes #137.

@0rlych1kk4

0rlych1kk4 commented Jul 13, 2026

Copy link
Copy Markdown
Author

@dstebila , this continues #295 with @SebastianFaller permission. I preserved the original authorship, rebased the work onto the current main branch, and verified it on stable and beta Rust. Whenever convenient, I would appreciate your review.

SebastianFaller and others added 3 commits July 13, 2026 22:54
Signed-off-by: 0rlych1kk4 <orlychikka@gmail.com>
Signed-off-by: 0rlych1kk4 <orlychikka@gmail.com>
@0rlych1kk4
0rlych1kk4 force-pushed the feat/rustcrypto-kem-signature-traits branch from 6632cc8 to a1d6cb4 Compare July 13, 2026 14:56
@0rlych1kk4

Copy link
Copy Markdown
Author

@dstebila ,I reproduced the macOS-latest, nightly, true failure on the current upstream/main branch using a clean worktree.
After running:
git submodule update --init --recursive
git submodule update --remote
cargo build
the build fails with the same 15 missing HQC and SPHINCS identifier errors.
The true matrix variant updates liboqs from the pinned revision 21b3f8b0 to 5a1a854b, and the generated bindings from that newer revision are no longer compatible with the identifiers currently used by liboqs-rust.
This appears unrelated to the RustCrypto trait changes in this PR. The builds using the pinned submodule revision pass.

@dstebila

Copy link
Copy Markdown
Member

@dstebila ,I reproduced the macOS-latest, nightly, true failure on the current upstream/main branch using a clean worktree. After running: git submodule update --init --recursive git submodule update --remote cargo build the build fails with the same 15 missing HQC and SPHINCS identifier errors. The true matrix variant updates liboqs from the pinned revision 21b3f8b0 to 5a1a854b, and the generated bindings from that newer revision are no longer compatible with the identifiers currently used by liboqs-rust. This appears unrelated to the RustCrypto trait changes in this PR. The builds using the pinned submodule revision pass.

Hi @0rlych1kk4 thanks for working on an update. There have been algorithm identifier changes since the Rust wrapper was last updated (removal of SPHINCS+, changes involving HQC, plus some others). So those will need to be updated as well, which I think would probably be best done as a separate PR.

@0rlych1kk4

Copy link
Copy Markdown
Author

@dstebila thanks for confirming. I’ll keep the algorithm identifier updates separate from #310. I can work on that in a follow-up PR.

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.

Support RustCrypto KEM and Signature traits

3 participants