Skip to content

Commit 613317b

Browse files
Ryan WareJames Morris
Ryan Ware
authored and
James Morris
committed
EVM: Use crypto_memneq() for digest comparisons
This patch fixes vulnerability CVE-2016-2085. The problem exists because the vm_verify_hmac() function includes a use of memcmp(). Unfortunately, this allows timing side channel attacks; specifically a MAC forgery complexity drop from 2^128 to 2^12. This patch changes the memcmp() to the cryptographically safe crypto_memneq(). Reported-by: Xiaofei Rex Guo <xiaofei.rex.guo@intel.com> Signed-off-by: Ryan Ware <ware@linux.intel.com> Cc: stable@vger.kernel.org Signed-off-by: Mimi Zohar <zohar@linux.vnet.ibm.com> Signed-off-by: James Morris <james.l.morris@oracle.com>
1 parent c05235d commit 613317b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Diff for: security/integrity/evm/evm_main.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include <linux/integrity.h>
2424
#include <linux/evm.h>
2525
#include <crypto/hash.h>
26+
#include <crypto/algapi.h>
2627
#include "evm.h"
2728

2829
int evm_initialized;
@@ -148,7 +149,7 @@ static enum integrity_status evm_verify_hmac(struct dentry *dentry,
148149
xattr_value_len, calc.digest);
149150
if (rc)
150151
break;
151-
rc = memcmp(xattr_data->digest, calc.digest,
152+
rc = crypto_memneq(xattr_data->digest, calc.digest,
152153
sizeof(calc.digest));
153154
if (rc)
154155
rc = -EINVAL;

0 commit comments

Comments
 (0)