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

add docs to utils and expose constant_time_cmp() to consumers #469

Closed

Conversation

cosmicexplorer
Copy link
Contributor

Broken out of #287.

This key comparison method is useful to have for downstream consumers to avoid leaking timing information when comparing bytes. If downstream consumers of the libsignal crate wish to implement their own structs wrapping secret bytes, they now have a clearly documented example of how to implement that.

- requires the `unstable_internals` feature to be enabled for doctests to work
@cosmicexplorer cosmicexplorer force-pushed the document-utils-module branch from 4998520 to 990766f Compare June 27, 2022 07:51
@jrose-signal
Copy link
Contributor

I got curious as to why subtle doesn't have this, since it seems like they could implement it similarly, and found dalek-cryptography/subtle#61. libsignal-protocol's implementation isn't actually lexicographic, it's length-lexicographic, and (as noted) not constant-time in that case. I'd say that tips it over the edge to being left as an implementation detail; the place for this is really subtle (or subtle-ng), and just because they don't have it doesn't mean we should provide our own quirky implementation.

@cosmicexplorer
Copy link
Contributor Author

Ok, that is exactly what I was hoping to learn from filing this (my thought was: if we're doing something very wonky, let's document it, and if we're not, let's use the more canonical thing)! I'll close this PR and see what subtle/subtle-ng thinks about this use case.

@cosmicexplorer
Copy link
Contributor Author

I am hoping to implement this in zkcrypto/subtle-ng#5!

@cosmicexplorer
Copy link
Contributor Author

Note: subtle-ng is unmaintained, subtle is the correct project.

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