3 ms·
It’s nearly impossible to prevent side channel attacks when your crypto is implemented in a high-level language. AMEN! I've been trying to make this point to
by cperciva 17y ago
It’s nearly impossible to prevent side channel attacks when your crypto is implemented in a high-level language.
AMEN!
I've been trying to make this point to people for years, but it has been hard to get anyone to listen -- it's good to have someone else singing from the same songbook.
- jrockway 17y agoSo how is C immune from this? You don't control the actual codegen anymore, and that can even be at runtime now. (Different codepaths for different invocations of the same function, potentially leaking information via timing.)
- tptacek 17y agoThere's a lot of answers for this, but a simple one is that C gives you (much more) control over the memory hierarchy. A carefully written C program can, for instance, keep things most in or out of cache. High-level languages also abstract bignum math, which in number-theoretic crypto is a source of timing channels.
- NateLawson 17y agoYes, the conventional wisdom is that C is less secure than high-level languages. If you're talking memory management, that's correct. DJB does nothing but stack variables for NaCl to avoid performance and potential for memory leaks. But for side channels, C is almost too high level. For example, it takes assembly code (cpuid) to figure out cache configuration. Even worse, a language like Java or python gives you no control over the memory layout of the key in RAM. So the right combo in my opinion is a carefully tuned C implementation (possibly with a little assembly or compile-time tweaking). Then add your language bindings to call it from a HLL.
- tptacek 17y agoOf course, NaCl isn't written in C; it's written in a combination of C and dynamically-generated assembly (Bernstein wrote his own macro assembler/"high level assembler", qhasm).