Skip to content

Commit 538a5a0

Browse files
Cfir Cohenherbertx
authored andcommitted
crypto: ccp/gcm - use const time tag comparison.
Avoid leaking GCM tag through timing side channel. Fixes: 36cf515 ("crypto: ccp - Enable support for AES GCM on v5 CCPs") Cc: <[email protected]> # v4.12+ Signed-off-by: Cfir Cohen <[email protected]> Acked-by: Gary R Hook <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
1 parent 20e833d commit 538a5a0

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/crypto/ccp/ccp-ops.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -850,7 +850,8 @@ static int ccp_run_aes_gcm_cmd(struct ccp_cmd_queue *cmd_q,
850850
if (ret)
851851
goto e_tag;
852852

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;
854855
ccp_dm_free(&tag);
855856
}
856857

0 commit comments

Comments
 (0)