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

demonstrate using subtle-ng-derive with ConstantTimeCmp #478

Closed

Conversation

cosmicexplorer
Copy link
Contributor

@cosmicexplorer cosmicexplorer commented Jun 30, 2022

Problem

In #469 we decided to take a look at whether we could upstream some extensions to the subtle crate to support Ordering comparisons. After creating zkcrypto/subtle-ng#5, I created this PR to demonstrate how adopting subtle::ConstantTimeCmp from that change could improve the code.

Solution

Result

It is now possible to #[derive(ConstEq, ConstOrd, ConstantTimeEq, ConstantTimeCmp)] to get constant-time Eq and Ord implementations for several structs, which allows us to remove utils.rs.

@cosmicexplorer cosmicexplorer force-pushed the subtle-derived-impls branch 5 times, most recently from 617d227 to 8392b78 Compare July 1, 2022 11:26
@jrose-signal
Copy link
Contributor

I'm going to close this because it's an extra dependency for something quite subtle (🥁), but it's certainly clever!

@cosmicexplorer
Copy link
Contributor Author

Note: subtle-ng is unmaintained, and the original subtle crate should be used. I have raised this use case with upstream subtle project at dalek-cryptography/subtle#100 and hope to integrate the derive macros into the upstream subtle crate itself.

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

Successfully merging this pull request may close these issues.

2 participants