Closed cosmicexplorer closed 1 year ago
This is correct, and shorter, but I'm not sure it's better. It is the case that Rust orderings have the raw representations we want here (the ones established by memcmp
oh so long ago), but you had to write down a comment to say that, because it's not exposed in the docs (even though it is in the source, and stable). The compiler should absolutely optimize the first into the second anyway, but it doesn't quite today??. I'll file a Rust bug about that.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
This issue has been closed due to inactivity.
subtle
crate thatlibsignal
can remove our hand-rolledconstant_time_cmp()
if they supportConstantTimeOrd
upstream via my change.subtle
project, I learned that you can lean onOrdering
havingrepr(i8)
to avoid uses ofmatch
. In dalek-cryptography/subtle#98, this is used to implsubtle::ConditionallySelectable
forOrdering
by delegating to the impl fori8
.match
here too in libsignal's FFI method to compare public keys, since our encoding ofOrdering
intoi<whatever>
inECPublicKey_Compare
matches the one from the rust stdlib.