diff options
author | Cfir Cohen <cfir@google.com> | 2019-07-02 10:32:56 -0700 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-07-26 09:14:20 +0200 |
commit | a9fd1795fee69a9d384ead855e045edd5a035bb5 (patch) | |
tree | ba1af27ea62916ccf032799b1c3b860942ff7a5a /drivers/crypto | |
parent | 561c4424f1e3f30615bc5701151709e0b59e1d3e (diff) | |
download | linux-stable-a9fd1795fee69a9d384ead855e045edd5a035bb5.tar.gz linux-stable-a9fd1795fee69a9d384ead855e045edd5a035bb5.tar.bz2 linux-stable-a9fd1795fee69a9d384ead855e045edd5a035bb5.zip |
crypto: ccp/gcm - use const time tag comparison.
commit 538a5a072e6ef04377b180ee9b3ce5bae0a85da4 upstream.
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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/crypto')
-rw-r--r-- | drivers/crypto/ccp/ccp-ops.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/crypto/ccp/ccp-ops.c b/drivers/crypto/ccp/ccp-ops.c index 5df77e4fc97b..e212badd39fa 100644 --- a/drivers/crypto/ccp/ccp-ops.c +++ b/drivers/crypto/ccp/ccp-ops.c @@ -853,7 +853,8 @@ static int ccp_run_aes_gcm_cmd(struct ccp_cmd_queue *cmd_q, if (ret) goto e_tag; - ret = memcmp(tag.address, final_wa.address, AES_BLOCK_SIZE); + ret = crypto_memneq(tag.address, final_wa.address, + AES_BLOCK_SIZE) ? -EBADMSG : 0; ccp_dm_free(&tag); } |