Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp3785206ybi; Mon, 29 Jul 2019 12:34:34 -0700 (PDT) X-Google-Smtp-Source: APXvYqxm7TC44UVpO7iNzMv5z3PfyV+sKeQhRCqxEKDTzeFVPXc3Ls3lsF1/vjSsePvr13AVo6MI X-Received: by 2002:aa7:8201:: with SMTP id k1mr37204195pfi.97.1564428874335; Mon, 29 Jul 2019 12:34:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564428874; cv=none; d=google.com; s=arc-20160816; b=je9NnUdbhDWA1Rg/smqTyj25zv339ZDWz8RWuY+uEP3H/o0hnHbiuc0d/xI/gtQLbB 64J8wMYqv5Cm+DGPnZPiiWM3awboh+M8hH+vgzNxyi4nlCR3RYRWy8wOx4NriEXl+WtL +hTNIY0iimVU0VQvSpMaFSpXMhZd0X4JEtsx53WBG2VsBWgT8UVYvLkuOPzsTwKYl2gC hmQBhykCnQJqoYtlB6o7Elx0VB5MlpW0YR5C0HCAzEc6MNMYQytTkpm8M7pms8mM4+bk KHnLtv0b0YILruXNCXtypwgcYHyPv6c9qazTrJWT9LDX1gT9tuYra5EPvUgKEcbt2a7u xXtg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=M4I+gZcOC3gGEdOMCH/A3K1SBgxoeAd36CFzekATxJc=; b=Fts+MMns1N8/SFC3vdNVo1EX/+q8gEc3xLo5/hEUnORrq8I/3ECgGZgBKq8dTeqcWs 6NsXYBIwlBFB3kEjkiPcvAr7vhB+rVfV+1KzakY6GmuORAPY5h2UVXztHAsIwTmjZ6a4 Fv4rYn1n3QirMuld/j1B26y/PJP3TxWqvlPQcn7Ez6AT+/TaGzv4y38QIRoMdOkjr5WX y0Clfgut2aj/CaCDTNo4ZUPD9iGuLrjiUSRt6rTOBjgQ3CzUXTmwXKkTaX9So9z+YK0e yYB/0PR8rwtqDRCrfR59RsQoK0BDpo7oJj6kZYuuj9S9vWQcPq89N9FaEoEpWGuAwSkg C1MQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=T6wPkGdz; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p16si27971103pgh.410.2019.07.29.12.34.19; Mon, 29 Jul 2019 12:34:34 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=T6wPkGdz; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730128AbfG2T3z (ORCPT + 99 others); Mon, 29 Jul 2019 15:29:55 -0400 Received: from mail.kernel.org ([198.145.29.99]:42578 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728828AbfG2T3y (ORCPT ); Mon, 29 Jul 2019 15:29:54 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 4516E21655; Mon, 29 Jul 2019 19:29:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1564428593; bh=kmZ8SCMy3V/pCmyfialFvVI13iYmV8PUXdgOiXJ6ZMI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=T6wPkGdzDEEsmeQKG1kg/0Mc2/NRTcrvND5qDucfjr0B2WWrzGgtM5i8vfql4KiQj +HCoq4cgIITAOVb+H+8c65Fbeopet1TNrmPomudwAmq1bNjTDXOVNen0LngsxwRF78 NBFV7pEelJKac23MyDUUZFiub6bxzyEII+nBP8Qc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Cfir Cohen , Gary R Hook , Herbert Xu Subject: [PATCH 4.14 125/293] crypto: ccp/gcm - use const time tag comparison. Date: Mon, 29 Jul 2019 21:20:16 +0200 Message-Id: <20190729190834.164865318@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190729190820.321094988@linuxfoundation.org> References: <20190729190820.321094988@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Cfir Cohen commit 538a5a072e6ef04377b180ee9b3ce5bae0a85da4 upstream. Avoid leaking GCM tag through timing side channel. Fixes: 36cf515b9bbe ("crypto: ccp - Enable support for AES GCM on v5 CCPs") Cc: # v4.12+ Signed-off-by: Cfir Cohen Acked-by: Gary R Hook Signed-off-by: Herbert Xu Signed-off-by: Greg Kroah-Hartman --- drivers/crypto/ccp/ccp-ops.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/drivers/crypto/ccp/ccp-ops.c +++ b/drivers/crypto/ccp/ccp-ops.c @@ -832,7 +832,8 @@ static int ccp_run_aes_gcm_cmd(struct cc goto e_tag; ccp_set_dm_area(&tag, 0, p_tag, 0, AES_BLOCK_SIZE); - 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); }