[tor-dev] memcmp() & co. timing info disclosures?
rransom.8774 at gmail.com
Sat May 7 06:50:23 UTC 2011
On Fri, 6 May 2011 23:16:14 -0700
Chris Palmer <chris at eff.org> wrote:
> On May 6, 2011, at 10:25 PM, Robert Ransom wrote:
> > I would expect GCC (and most other C compilers) to use a
> > non-constant-time implementation of (v1 == v2).
> Are there machines that implement uint8_t comparison in a data-dependent way? What's an example?
That comparison expression can be implemented in non-constant time on
; ECX = v1; EDX = v2; result in EAX
XOR EAX, EAX
CMP ECX, EDX
I think I've seen GCC emit something similar to that within the last
few years, and I assume that some compilers still emit code containing
a conditional branch for that expression. In general, we don't want to
assume that conditional expressions are safe to use, even if a compiler
*could* implement them in a safe way (e.g. by compiling Nick's function
into something resembling mine).
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 490 bytes
Desc: not available
More information about the tor-dev