[PATCH 0/6] Constant Time Memory Comparisons Are Important

From: Jason A. Donenfeld
Date: Fri Jun 09 2017 - 22:59:42 EST


Whenever you're comparing two MACs, it's important to do this using
crypto_memneq instead of memcmp. With memcmp, you leak timing information,
which could then be used to iteratively forge a MAC. This is far too basic
of a mistake for us to have so pervasively in the year 2017, so let's begin
cleaning this stuff up. The following 6 locations were found with some
simple regex greps, but I'm sure more lurk below the surface. If you
maintain some code or know somebody who maintains some code that deals
with MACs, tell them to double check which comparison function they're
using.

Jason A. Donenfeld (6):
sunrpc: use constant time memory comparison for mac
net/ipv6: use constant time memory comparison for mac
ccree: use constant time memory comparison for macs and tags
security/keys: use constant time memory comparison for macs
bluetooth/smp: use constant time memory comparison for secret values
mac80211/wpa: use constant time memory comparison for MACs

Cc: Anna Schumaker <anna.schumaker@xxxxxxxxxx>
Cc: David Howells <dhowells@xxxxxxxxxx>
Cc: David Safford <safford@xxxxxxxxxx>
Cc: "David S. Miller" <davem@xxxxxxxxxxxxx>
Cc: Gilad Ben-Yossef <gilad@xxxxxxxxxxxxx>
Cc: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
Cc: Gustavo Padovan <gustavo@xxxxxxxxxxx>
Cc: "J. Bruce Fields" <bfields@xxxxxxxxxxxx>
Cc: Jeff Layton <jlayton@xxxxxxxxxxxxxxx>
Cc: Johan Hedberg <johan.hedberg@xxxxxxxxx>
Cc: Johannes Berg <johannes@xxxxxxxxxxxxxxxx>
Cc: Marcel Holtmann <marcel@xxxxxxxxxxxx>
Cc: Mimi Zohar <zohar@xxxxxxxxxxxxxxxxxx>
Cc: Trond Myklebust <trond.myklebust@xxxxxxxxxxxxxxx>
Cc: keyrings@xxxxxxxxxxxxxxx
Cc: linux-bluetooth@xxxxxxxxxxxxxxx
Cc: linux-nfs@xxxxxxxxxxxxxxx
Cc: linux-wireless@xxxxxxxxxxxxxxx
Cc: netdev@xxxxxxxxxxxxxxx

drivers/staging/ccree/ssi_fips_ll.c | 17 ++++++++-------
net/bluetooth/smp.c | 39 ++++++++++++++++++-----------------
net/ipv6/seg6_hmac.c | 3 ++-
net/mac80211/wpa.c | 9 ++++----
net/sunrpc/auth_gss/gss_krb5_crypto.c | 3 ++-
security/keys/trusted.c | 7 ++++---
6 files changed, 42 insertions(+), 36 deletions(-)

--
2.13.1