Skip to content

Comments

demonstrate using subtle-ng-derive with ConstantTimeCmp#478

Closed
cosmicexplorer wants to merge 1 commit intosignalapp:mainfrom
cosmicexplorer:subtle-derived-impls
Closed

demonstrate using subtle-ng-derive with ConstantTimeCmp#478
cosmicexplorer wants to merge 1 commit intosignalapp:mainfrom
cosmicexplorer:subtle-derived-impls

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
@cosmicexplorer cosmicexplorer force-pushed the subtle-derived-impls branch from 8392b78 to 8d419fe Compare July 1, 2022 11:28
@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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants