Hacker News new | ask | show | jobs
by perflexive 3703 days ago
I'm surprised to see no mention in the article or on HN about how this might affect writing crypto code in Rust. Maybe it's a little tangential, but I'm dying for constant time operations.

Avoiding branches, etc. in Rust doesn't mean LLVM won't add some as an optimization, which is frustrating to say the least. It would be awesome to be able to define a block - similar to "unsafe" - that tells the compiler to disable optimizations that could introduce non-constant time operations. When I started reading the article, I though maybe this new development would open the door to something like that, but it doesn't appear to be the case.

There's some work to do constant time ops in rust, but it's very experimental and untrustworthy. :/

1 comments

Since this is before the LLVM passes, it doesn't really change anything, and can't.
I have no experience with LLVM internals, but couldn't you split up the code and disable some of LLVM's optimizations on blocks defined by the programmer?

Or do you have to pass the entire program at once to LLVM? Maybe the ability to disable optimizations only on certain functions is possible, idk, but I think it certainly would be nice.

I'm not knowledgeable about that, to be honest.