Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KEM interface tweaks #27

Merged
merged 7 commits into from
Apr 20, 2022
Merged

KEM interface tweaks #27

merged 7 commits into from
Apr 20, 2022

Conversation

rozbb
Copy link
Owner

@rozbb rozbb commented Apr 9, 2022

Made ergonomic changes to the KEM trait so that people can implement their own KEM. All of the newly exposed functions and fields are #[doc(hidden)] because this is really for power users.

Fixes #23 #25 #26

/cc @BoOTheFurious what do you think?

@codecov-commenter
Copy link

codecov-commenter commented Apr 9, 2022

Codecov Report

Merging #27 (83b5e9c) into master (5ff4b00) will decrease coverage by 0.24%.
The diff coverage is 90.90%.

@@            Coverage Diff             @@
##           master      #27      +/-   ##
==========================================
- Coverage   92.72%   92.47%   -0.25%     
==========================================
  Files          15       15              
  Lines         742      744       +2     
==========================================
  Hits          688      688              
- Misses         54       56       +2     
Impacted Files Coverage Δ
src/serde_impls.rs 96.96% <ø> (ø)
src/setup.rs 100.00% <ø> (ø)
src/single_shot.rs 100.00% <ø> (ø)
src/kem.rs 90.00% <50.00%> (-10.00%) ⬇️
src/kem/dhkem.rs 91.54% <93.47%> (+0.12%) ⬆️
src/kat_tests.rs 95.65% <100.00%> (+1.44%) ⬆️
src/kdf.rs 88.88% <100.00%> (ø)
src/op_mode.rs 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5ff4b00...83b5e9c. Read the comment docs.

@BoOTheFurious
Copy link

That's great ! Nevertheless I still do not understanding why sk_eph is of type PrivateKey (#24 ). With this name it should be a SharedSecret or perhaps another dedicated type (or simply aVec<u8>). There is no direct link between the ephemeral secret object and the private key (except in some specific cases like DHKEM)

Thanks for the very quick work !

@rozbb
Copy link
Owner Author

rozbb commented Apr 9, 2022

Oh, good point. Hmm, I'm leaning towards making it a hidden associated type, but I'll have to think about it a little. Will get back to this soon.

@rozbb
Copy link
Owner Author

rozbb commented Apr 18, 2022

I figured, rather than create a new EphemeralKey type, it'd be much cleaner if I just made implementors impl encap() alone. In reality, the only reason encap_with_eph exists is for testing purposes. So I moved it away and into kat_tests::TestableKem.

Let me know if this interface seems reasonable.

@BoOTheFurious
Copy link

It seems great to me !

@rozbb
Copy link
Owner Author

rozbb commented Apr 20, 2022

Cool, please let me know if you're able to get an initial version of your PQ KEM working. If so, and everything works fine, I'll cut a new version

@BoOTheFurious
Copy link

👍 it works for me, Big thanks

@rozbb
Copy link
Owner Author

rozbb commented May 5, 2022

Just cut a new version! Feel free to use 0.9 as your dep.

@rozbb rozbb deleted the kem-interface-tweaks branch May 6, 2023 06:25
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.

kem::SharedSecret field is not pub
3 participants