Commit Graph

4 Commits

Author SHA1 Message Date
Andreas Steffen b12c53ce77 Use standard unsigned integer types 2016-03-24 18:52:48 +01:00
Martin Willi 9d6e952201 utils: Add a constant time chunk_equals() variant for cryptographic purposes 2015-04-14 12:02:48 +02:00
Martin Willi b833963270 utils: Add a constant time memeq() variant for cryptographic purposes 2015-04-14 11:51:54 +02:00
Martin Willi 39e1ddec2e scripts: Add a tool that tries to guess MAC/ICV values using validation times
This tool shows that it is trivial to re-construct the value memcmp() compares
against by just measuring the time the non-time-constant memcmp() requires to
fail.

It also shows that even when running without any network latencies it gets
very difficult to reconstruct MAC/ICV values, as the time variances due to the
crypto routines are large enough that it gets difficult to measure the time
that memcmp() actually requires after computing the MAC.

However, the faster/time constant an algorithm is, the more likely is a
successful attack. When using AES-NI, it is possible to reconstruct (parts of)
a valid MAC with this tool, for example with AES-GCM.

While this is all theoretical, and way more difficult to exploit with network
jitter, it nonetheless shows that we should replace any use of memcmp/memeq()
with a constant-time alternative in all sensitive places.
2015-04-14 11:51:54 +02:00