Received: by 2002:a05:6a10:2785:0:0:0:0 with SMTP id ia5csp2273485pxb; Mon, 11 Jan 2021 05:46:06 -0800 (PST) X-Google-Smtp-Source: ABdhPJz3T6vMUsco42GZrMG+FA05lOO98iQ2o2t2R+eCC12i0/rIfaXsFqrk8M0B9ukRcAFBxSQI X-Received: by 2002:a17:906:5002:: with SMTP id s2mr10438902ejj.16.1610372766188; Mon, 11 Jan 2021 05:46:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610372766; cv=none; d=google.com; s=arc-20160816; b=eBQJP94kj7Jt7tLejpfRjq0qNYaWZv0Yhta2EB3gf6ddwm9yFxsZqQ1RZDCbpugbCS o6Q35tGTYG3HhbRFBMD63x/+ZTIT+zPCtK1Z0W7MDTlc07yeNSfsZClp4PGvpHQvNDwV Bexls47I1IHwk2ISMKV3WEFV/Ec7ZFPwAcD8H98RkbG3MOOd8eyb9Gu5LLU3MXethF86 pelcf67/GREdFd1K3fOvIMYvZOA35GxLKfSjzhBPMaRpnXq630sebTmpERwnDXVJvoYH 1Y7hTtd1uPXNmwt+KwO71gpcwyfu8d5qRZNENlhk6Oh7cu2kEzTeu/1dPt6H8L0+Tn+d 99wA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=QQ9XmugJwwbtE3hg3oD48o6ukWUmDXa3JlWKzvEkKC8=; b=sOVl0HJGbSXJ88u8yLcFoDCK6wm18cNd6MnPcvRVmpNjcp8gLGFTHsYx/K7KgpiXvg vodUre2cWQD4mtCz9/YaA2l8NjUNA6bfHkpXt0CSOm9UkBWpf4aWXJHktgD8C3fvchkE EcedhCEEo9iDAIQD4qSsrvZfBuX0MkkFdmTQRYX0yZe+RXIrFB26OOxq/YhVnEZx6Q0C 8yBTnMeOUpn5y8V4w1y/yqJXSEn/5ERtUiq+gSTRcEf7VlfFS0mx3YZlk+6UTs+O14gx xtbDT5u1if/xkYp8jg8IKnJlOm2PeB9+QNwd4hp7rRgFX37yZAW6DfHZsK+dKAuNpuEn alng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=CDIKoNJj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q11si6468291ejx.0.2021.01.11.05.45.40; Mon, 11 Jan 2021 05:46:06 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=CDIKoNJj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387726AbhAKNn2 (ORCPT + 99 others); Mon, 11 Jan 2021 08:43:28 -0500 Received: from mail.kernel.org ([198.145.29.99]:59094 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730053AbhAKNL7 (ORCPT ); Mon, 11 Jan 2021 08:11:59 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 8C4B622AAD; Mon, 11 Jan 2021 13:11:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1610370679; bh=8ncbfiO/TcDMxuxV2Rn6vowJzinp8lt+zPKb33YAr7U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CDIKoNJjX7vAQ/46SeN7o8g3LohjdSzFxLvZ3gfdtB6yheit+lOlplbw6x4AgFwI/ rUu5PkFHfOcZmBRAJz+3Z3l+ewL0CWKh6QxnWgANqZsllM3g/Hsm3rF7aIfz6ckl2g g0HTyiMuUlg4gssRKGtaXQGOdYoxfvz26vGhL1Fc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ilil Blum Shem-Tov Subject: [PATCH 5.4 50/92] crypto: asym_tpm: correct zero out potential secrets Date: Mon, 11 Jan 2021 14:01:54 +0100 Message-Id: <20210111130041.550571666@linuxfoundation.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210111130039.165470698@linuxfoundation.org> References: <20210111130039.165470698@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Greg Kroah-Hartman commit f93274ef0fe972c120c96b3207f8fce376231a60 upstream. The function derive_pub_key() should be calling memzero_explicit() instead of memset() in case the complier decides to optimize away the call to memset() because it "knows" no one is going to touch the memory anymore. Cc: stable Reported-by: Ilil Blum Shem-Tov Tested-by: Ilil Blum Shem-Tov Link: https://lore.kernel.org/r/X8ns4AfwjKudpyfe@kroah.com Signed-off-by: Greg Kroah-Hartman --- crypto/asymmetric_keys/asym_tpm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/crypto/asymmetric_keys/asym_tpm.c +++ b/crypto/asymmetric_keys/asym_tpm.c @@ -370,7 +370,7 @@ static uint32_t derive_pub_key(const voi memcpy(cur, e, sizeof(e)); cur += sizeof(e); /* Zero parameters to satisfy set_pub_key ABI. */ - memset(cur, 0, SETKEY_PARAMS_SIZE); + memzero_explicit(cur, SETKEY_PARAMS_SIZE); return cur - buf; }