> crypto stuff

also, my assumption here would be that the built-ins don't have any comparison 
problems since they fetch the carry bit from a cpu flag - ie any time you're 
doing "crypto stuff", you kind of make assumptions about the compiler you're 
working with given the lack of standardization around constant-time-ness.

Given the state of compilers, it's perhaps slightly beyond the reach of the 
primitives here to test for that, although it would indeed be a huge advantage 
if it was verified in unit tests. LLVM for example tests the assembly output of 
a given program in certain cases, it would actually be pretty cool to have a 
test that ensures that for a given platform, a "construct" compiles to a 
certain instruction so that "crypto stuff" can be built more reliably.

This also reminds me of C++ atomics where the standard provides a compile-time 
constant that describes whether they are true atomics or emulated with locks on 
any given platform - something similar would perhaps be interesting here, ie 
that on "verified" platforms, it would be set to `true` to signal to the 
calling library that it's "safe".

This would again be trivial to implement in `nlvm` \- in `nim`, it's a bit more 
tricky because of the interaction with the underlying C compiler zoo. 

Reply via email to