stdlib: Import timingsafe_bcmp() from FreeBSD
authorAntonio Nino Diaz <antonio.ninodiaz@arm.com>
Mon, 16 Jan 2017 13:25:38 +0000 (13:25 +0000)
committerAntonio Nino Diaz <antonio.ninodiaz@arm.com>
Tue, 24 Jan 2017 14:42:12 +0000 (14:42 +0000)
commitaa050a7bdb943ca94ab914f2a9dc508e09a57431
tree5a97cdc90d14dcfca121ba20ae5c97f92324231e
parent34438669d41a648e4dcf6fd93e1a1f1f7eee0482
stdlib: Import timingsafe_bcmp() from FreeBSD

Some side-channel attacks involve an attacker inferring something from
the time taken for a memory compare operation to complete, for example
when comparing hashes during image authentication. To mitigate this,
timingsafe_bcmp() must be used for such operations instead of the
standard memcmp().

This function executes in constant time and so doesn't leak any timing
information to the caller.

Change-Id: I470a723dc3626a0ee6d5e3f7fd48d0a57b8aa5fd
Signed-off-by: dp-arm <dimitris.papastamos@arm.com>
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
include/lib/stdlib/string.h
lib/stdlib/stdlib.mk
lib/stdlib/timingsafe_bcmp.c [new file with mode: 0644]