aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCfir Cohen <cfir@google.com>2019-07-02 13:32:56 -0400
committerHerbert Xu <herbert@gondor.apana.org.au>2019-07-18 01:39:54 -0400
commit538a5a072e6ef04377b180ee9b3ce5bae0a85da4 (patch)
tree7aed90b4c1ecb0291a9d17523d4bc87fec505b44
parent20e833dc36355ed642d00067641a679c618303fa (diff)
crypto: ccp/gcm - use const time tag comparison.
Avoid leaking GCM tag through timing side channel. Fixes: 36cf515b9bbe ("crypto: ccp - Enable support for AES GCM on v5 CCPs") Cc: <stable@vger.kernel.org> # v4.12+ Signed-off-by: Cfir Cohen <cfir@google.com> Acked-by: Gary R Hook <ghook@amd.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
-rw-r--r--drivers/crypto/ccp/ccp-ops.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/crypto/ccp/ccp-ops.c b/drivers/crypto/ccp/ccp-ops.c
index 9ecc1bb4b237..3ebe031773d5 100644
--- a/drivers/crypto/ccp/ccp-ops.c
+++ b/drivers/crypto/ccp/ccp-ops.c
@@ -850,7 +850,8 @@ static int ccp_run_aes_gcm_cmd(struct ccp_cmd_queue *cmd_q,
850 if (ret) 850 if (ret)
851 goto e_tag; 851 goto e_tag;
852 852
853 ret = memcmp(tag.address, final_wa.address, AES_BLOCK_SIZE); 853 ret = crypto_memneq(tag.address, final_wa.address,
854 AES_BLOCK_SIZE) ? -EBADMSG : 0;
854 ccp_dm_free(&tag); 855 ccp_dm_free(&tag);
855 } 856 }
856 857