]> asedeno.scripts.mit.edu Git - PuTTY.git/commit
Use a timing-safe memory compare to verify MACs.
authorSimon Tatham <anakin@pobox.com>
Sun, 26 Apr 2015 22:31:11 +0000 (23:31 +0100)
committerSimon Tatham <anakin@pobox.com>
Sat, 20 Jun 2015 08:31:55 +0000 (09:31 +0100)
commit26d3ccdfc5500a8afdbd54938677ef4ef985caaa
treea03ff11c9aa75cc3090fc401ca96727b5a043f2d
parent9bcb6639cc324b0dd27eab844c098363579644fb
Use a timing-safe memory compare to verify MACs.

Now that we have modes in which the MAC verification happens before
any other crypto operation and hence will be the only thing seen by an
attacker, it seems like about time we got round to doing it in a
cautious way that tries to prevent the attacker from using our memcmp
as a timing oracle.

So, here's an smemeq() function which has the semantics of !memcmp but
attempts to run in time dependent only on the length parameter. All
the MAC implementations now use this in place of !memcmp to verify the
MAC on input data.

(cherry picked from commit 9d5a16402168f82ba1bd695c3e95bb4812ccd0a9)

Cherry-picker's notes: the above commit comment isn't really true on
this branch, since the ETM packet protocol changes haven't been
cherry-picked. But it seemed silly to deliberately leave out even a
small safety measure.
misc.c
misc.h
sshmd5.c
sshsh256.c
sshsha.c