TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Elliptic curve arithmetic and cryptography library in Rust

65 pointsby bren2013over 10 years ago

3 comments

nullcover 10 years ago
Uh, users almost never want ElGamal encryption. It has a few interesting applications, but its very easy to make insecure systems using it. Where it&#x27;s used it should be packaged up into a complete protocol that handles the footgunnery.<p>This claims to have constant time operations, but the addition law is very clearly not constant time: <a href="https://github.com/Bren2010/ecc/blob/master/src/curves.rs#L93" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;Bren2010&#x2F;ecc&#x2F;blob&#x2F;master&#x2F;src&#x2F;curves.rs#L9...</a> Likewise, the field operations are not constant time. Simply doing both the 1 and 0 path and throwing the other side out is not generally adequate to achieve constant time behaviour when the underlying operations are variable time (and also see, for example, the flush&#x2F;reload attacks in the literature).<p>Also the field operations appear to be variable time. (So, it looks like the inversions to convert back to affine would leak shared secret data for ECDH, or information about the nonce in ECDSA.) It looks like the reduction in kinv alone would likely leak log2(k^-1) pretty directly in timing, so if you could capture some large number of signatures with a single key you could probably recover it, potentially even remotely. (Not trying to be harsh here, OpenSSL is just as bad for their generic code... but if someone is advertised as constant time, it ought to meet the strongest definition of it since the caller is not going to be a cryptographer and he&#x27;s going to treat it as a black box and inevitably use it in the most exploitable way possible. :) )<p>General question about rust: Is there any way to reliably write constant time code in it? Or are you always at the mercy of the compiler undermining you? E.g. happily unrolling loops, optimizing out dummy operations, and turning branchless comparisons into branchy ones. (I wouldn&#x27;t have expected that would be, since there isn&#x27;t really in C; unless you&#x27;re able to audit the compiler output ... and rust is even higher level).
评论 #8747342 未加载
评论 #8747477 未加载
评论 #8747302 未加载
ericktover 10 years ago
If anyone is interested in rust and cryptography, we have a meetup this Thursday in San Francsico focused on it:<p><a href="http://www.meetup.com/Rust-Bay-Area/events/210632582/" rel="nofollow">http:&#x2F;&#x2F;www.meetup.com&#x2F;Rust-Bay-Area&#x2F;events&#x2F;210632582&#x2F;</a><p>We are currently full, but we are live streaming it on:<p><a href="https://air.mozilla.org/bay-area-rust-meetup-december-2014/" rel="nofollow">https:&#x2F;&#x2F;air.mozilla.org&#x2F;bay-area-rust-meetup-december-2014&#x2F;</a><p>We also have about 10-15 people unrsvp the day-of, so there is a chance spots for free up between now and then.
indeyetsover 10 years ago
Do you plan to have implementation of DJB&#x27;s curves&#x2F;primitives?
评论 #8749145 未加载