Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp10423883ybi; Wed, 24 Jul 2019 22:59:01 -0700 (PDT) X-Google-Smtp-Source: APXvYqyJpMUZ+XorNB/fMV87i2QPCTI4lvfUPK6uPh6X95eWHCGI/RYnb/ehhNmXi+SIFUySMrsD X-Received: by 2002:aa7:8ad0:: with SMTP id b16mr13233588pfd.45.1564034341068; Wed, 24 Jul 2019 22:59:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564034341; cv=none; d=google.com; s=arc-20160816; b=fyAmn9rhfUhzDTPEYajyAUOG9UpyVhRrKuxJE3ba1sq5xJydWliAQXz+DD8+QmkT8L VPRIDeI2E1VP4lYayOGZXuuZjsW9bY5s4Qec94MLkfna82Ue3NJSAOvfGpRS7cRZ9viV vLmLUSavPY6FQrA2aXcspHNnYI+Gs+JTL15uqBLa9LoaUd/kyE0jArXCWXDklhWB5aZ7 q/pzijWrZ/YJjlnNHP6+0LGvwVychO9z9GnnxTaoBjl4BSsxD2pMp/FDy+UUVeUXgSVu b3UFLKU/psOpIKxzJVQxVxrIMIrxrgIYIlrX8C3HvnOhMSdKRveS0BYBjeMR18Zoca8F UYFg== 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=yyuHJ0Mp8t7ZDofNzrz019TRRBbYM2ymUmRcUO6WTZk=; b=c1IIgVtMNdEljQJxME0GJ0ga+tJqszCpFBbtubztgLuuxKeVVAphpmA+WIb5PEWmTZ +y7X55sRg6tdf5ChkbZAKkFoB0sXFqrIhtWzadtZWBXUqUwDN8aoWCFQG5Rap1aC3sqO MsjsUEW6L9YsyhoeeB8uVM7yJF6aaenqyWkE1o6yqWXT5uR4fnHK89goRF08/gpbUpzu 0kmw5RkkA6eFyYLlbnt4UMXgakn8mYaklNF3XMvBSVsfEbgAHFnbXhytSqRYS4BxvgR4 kyoJZpijgiXkXUEkY3hg9fF7MX2nvktiyMn/jnUS8MI/Aa/9deG6M0glCykTwIuZmCeF YTBA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="TyAn5/qV"; 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 b16si19148588pfd.126.2019.07.24.22.58.46; Wed, 24 Jul 2019 22:59:01 -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="TyAn5/qV"; 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 S2390914AbfGYFmk (ORCPT + 99 others); Thu, 25 Jul 2019 01:42:40 -0400 Received: from mail.kernel.org ([198.145.29.99]:57584 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390887AbfGYFmi (ORCPT ); Thu, 25 Jul 2019 01:42:38 -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 8E12521850; Thu, 25 Jul 2019 05:42:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1564033358; bh=GWlPhUNbVExvvTQJxLHAIfvmtR2eDbAuMFv4BJ3d6Xo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TyAn5/qVcCrWOW04JvrrJRufST7mooCrFTaI+PFtlMstdFPTrnUcUPGYkWMWsJGgZ 7cgV7i6qgpvANHl4iqxhrE6bpRBcHx9gV3qmhXnlkmXbvg/MIGqO4bigc5kNTddV0W eSdHcosaRdxSv9YT6PHIv/Vi2mqb9RyNDbrzsOvY= 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.19 181/271] crypto: ccp/gcm - use const time tag comparison. Date: Wed, 24 Jul 2019 21:20:50 +0200 Message-Id: <20190724191710.650102308@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190724191655.268628197@linuxfoundation.org> References: <20190724191655.268628197@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 @@ -853,7 +853,8 @@ static int ccp_run_aes_gcm_cmd(struct cc 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); }