[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: CVS commit: src
In article <20120830170609.14DD160534%jupiter.mumble.net@localhost>,
Taylor R Campbell <campbell+netbsd-source-changes-d%mumble.net@localhost>
> Date: Thu, 30 Aug 2012 11:44:41 -0400
> From: christos%zoulas.com@localhost (Christos Zoulas)
> memcmp() does not promise alphabetical sorting. It just promises to do the
> byte comparison as unsigned so that the results are consistent. It is not
> complicated to do this at all, for example:
> consttime_memcmp(const void *s1, const void *s2, size_t n)
> int rv = 0, sv = 0;
> const unsigned char *p1 = s1, *p2 = s2;
> if (rv == 0)
> rv = *p1++ - *p2++;
>Data-dependent branches are totally unacceptable for a routine whose
>sole purpose is to avoid timing side channels.
>Are there any applications that both want memcmp semantics and need to
>avoid timing side channels?
How can you tell the difference if both branches execute code that does
exactly the same work?
Main Index |
Thread Index |