Received: by 2002:a05:6500:2018:b0:1fb:9675:f89d with SMTP id t24csp163045lqh; Thu, 30 May 2024 18:34:39 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVFtuPijUDFEUBkPMN5xONflOGPhCn7L4XjRy7oK74GGfu4A5eFtzXprGEhWQdqPFTpZqxWjGw3COkmbH9tMkyytl+PYobl/2Ebs0i4mA== X-Google-Smtp-Source: AGHT+IG9O8nMxy86bwRuT/zVD1rHhsEYXd092UMjO4yRAP1SlurD4YhZubS3a/+/SWt/yGr+0Aqb X-Received: by 2002:a05:6a20:3ca3:b0:1b1:c632:592e with SMTP id adf61e73a8af0-1b26f295ed4mr816937637.58.1717119279022; Thu, 30 May 2024 18:34:39 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717119279; cv=pass; d=google.com; s=arc-20160816; b=S/9cMgLqMBZSntFMFz48VPYlKRCwIOjwLqnyowA9aKFAs1U91zz97zbwmNZ4Ub8TmX HGUvGmxjCyoTK3x4MDIMRITHdUdfOtc6+PY6P/YN3o4MVFVeWm1YmvhlejD6nbSHBBQF GPo0WbGeFgdm4MN8W/QxSOEqUwo1/gFz0BeJzfJMYEyM0dEzC8ZncCISKw1bWkdJqhCZ 5v2hIVju8JVOa1tYqL0hJzLLFc5PQ/JYir5QdfSV+jzSvZiOnHrRPfZ/iomgLUpt5YPy CHYS6F7KbC+pyQze+zvGbikKoeQRdtpNnjxIADmqobGRmANNXFwFIPG/MlP36nXiCWVS SPmQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=BV7tLiS6TBCu4gY09MERe8V7NMSo+x6GNPEXwjNAE80=; fh=ksrYNUbdo9+K4DYOCXVji8cRdTI1C1SaRA8HdvQyCiA=; b=yQ9xDfNrHV2RdnjyD5ODZCMsDBLZ83FF52xw7gSJaPlZiDN0M+ta+a7CAcnN/o4FNA lWxZ9k5n0RMMlmRaXHmYm8Dat5lNBXfuhUTcLQQomDClqfI9yEU1D8uHotCURinR7ZMf c/htqKl7PWHsuwzSZP/op3YJRlH+QSKA2dr6pz8T8Hximsps8uondj5Ura/tY3PwfQ3D /V9VAFCkynrB2mXEsdcl5MnCGw6e2QimgFTGTfdo8g9RIeLA0XaFoPjt4ekrjFI5t2E5 OTiEvvSaG/59uollR2m6vrmpmnQva2G205cRtG4/JxWUcYotFjIjoxdxOXL6bW/lcChX N74g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=neutral (bad format) header.i=@oracle.com; arc=pass (i=1 spf=pass spfdomain=oracle.com dmarc=pass fromdomain=oracle.com); spf=pass (google.com: domain of linux-crypto+bounces-4554-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-crypto+bounces-4554-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=oracle.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id 41be03b00d2f7-6c3540faf1csi590901a12.101.2024.05.30.18.34.38 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 May 2024 18:34:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto+bounces-4554-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=neutral (bad format) header.i=@oracle.com; arc=pass (i=1 spf=pass spfdomain=oracle.com dmarc=pass fromdomain=oracle.com); spf=pass (google.com: domain of linux-crypto+bounces-4554-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-crypto+bounces-4554-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=oracle.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 875CD288C7E for ; Fri, 31 May 2024 01:34:38 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 150704D8CC; Fri, 31 May 2024 01:32:42 +0000 (UTC) X-Original-To: linux-crypto@vger.kernel.org Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 654B4182B9; Fri, 31 May 2024 01:32:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.177.32 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717119161; cv=none; b=VAKKcYx6rWwywKDmBE9azQgRHTQqknqJaU6fndg/9vU70JT8Lp6uf/qPeFftG4KJs8olQrxtlplp073rZVbt+syD9WPvsw5Cpt+SqaV5fGQ6Y1Hwoxpy8mrH/XL3Uf0HK9SReJMaw/aGw0Rc0cEKhK6gS9uTXHyNw1hD8uQvyjI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717119161; c=relaxed/simple; bh=fOAueA8jk/TnaagC5THFSQ7HEeykxqmnNzddhNawZ10=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=irT2onLXxulwh+bGXskBkQ7l5BCygTKokywVugv2isacB9LS+pqLL/9ldWjLLTb3mDff5BvKz+KeX3fQKNgnXjMvUqENeptAvVgxRxXzZlMr/RbaGOIvLb4d2+9sP1j5WEc1mXFLEXp1T+ZEoP8k0ABULU7U1EYy1JQuPaWYaiw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=oracle.com; spf=pass smtp.mailfrom=oracle.com; arc=none smtp.client-ip=205.220.177.32 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=oracle.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oracle.com Received: from pps.filterd (m0246630.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 44V15j7P018494; Fri, 31 May 2024 01:30:57 GMT DKIM-Signature: =?UTF-8?Q?v=3D1;_a=3Drsa-sha256;_c=3Drelaxed/relaxed;_d=3Doracle.com;_h?= =?UTF-8?Q?=3Dcc:content-transfer-encoding:date:from:in-reply-to:message-i?= =?UTF-8?Q?d:mime-version:references:subject:to;_s=3Dcorp-2023-11-20;_bh?= =?UTF-8?Q?=3DBV7tLiS6TBCu4gY09MERe8V7NMSo+x6GNPEXwjNAE80=3D;_b=3Dh1r3nF89?= =?UTF-8?Q?15Rv4zAwtnG/wbR1MlOmnvm56B511Bxl/M/ue1SYPSbbKUVoq/grj1MM+g7X_Xx?= =?UTF-8?Q?z1P/8Bb1vHIp+M1i3U4zUxUDpgFhu5xYkzYdFMc6fF+Tkjc9QomTOQ7esDE0yOL?= =?UTF-8?Q?h8c_Rev56N1rKFsK1Wbzj6e3jGZLVKIi5pVZC+4U/BP1fYMLCR0gQZDwwq0Aav9?= =?UTF-8?Q?N0LUBI1+T_dhAmFl4RTOIzZtyPW7Mkuj9mbO3jVOK4Bp808BCiGIvykTUR5Vl3n?= =?UTF-8?Q?oCCMgKX978yS5AK_S7zyM/WlHNb3pQrQW2lt/yb1pD/2yNO1px/c3/MH4q3sUKo?= =?UTF-8?Q?ZbfsxTLkiYsdqru36+FYZ_eQ=3D=3D_?= Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3yb8j8a3du-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 31 May 2024 01:30:57 +0000 Received: from pps.filterd (phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 44V10lSD016306; Fri, 31 May 2024 01:30:56 GMT Received: from pps.reinject (localhost [127.0.0.1]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3yc50t97rf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Fri, 31 May 2024 01:30:56 +0000 Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 44V1SKNS027418; Fri, 31 May 2024 01:30:55 GMT Received: from bur-virt-x6-2-100.us.oracle.com (bur-virt-x6-2-100.us.oracle.com [10.153.92.40]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3yc50t96yw-8 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Fri, 31 May 2024 01:30:54 +0000 From: Ross Philipson To: linux-kernel@vger.kernel.org, x86@kernel.org, linux-integrity@vger.kernel.org, linux-doc@vger.kernel.org, linux-crypto@vger.kernel.org, kexec@lists.infradead.org, linux-efi@vger.kernel.org, iommu@lists.linux-foundation.org Cc: ross.philipson@oracle.com, dpsmith@apertussolutions.com, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, hpa@zytor.com, dave.hansen@linux.intel.com, ardb@kernel.org, mjg59@srcf.ucam.org, James.Bottomley@hansenpartnership.com, peterhuewe@gmx.de, jarkko@kernel.org, jgg@ziepe.ca, luto@amacapital.net, nivedita@alum.mit.edu, herbert@gondor.apana.org.au, davem@davemloft.net, corbet@lwn.net, ebiederm@xmission.com, dwmw2@infradead.org, baolu.lu@linux.intel.com, kanth.ghatraju@oracle.com, andrew.cooper3@citrix.com, trenchboot-devel@googlegroups.com Subject: [PATCH v9 07/19] x86: Add early SHA-256 support for Secure Launch early measurements Date: Thu, 30 May 2024 18:03:19 -0700 Message-Id: <20240531010331.134441-8-ross.philipson@oracle.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20240531010331.134441-1-ross.philipson@oracle.com> References: <20240531010331.134441-1-ross.philipson@oracle.com> Precedence: bulk X-Mailing-List: linux-crypto@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.650,FMLib:17.12.28.16 definitions=2024-05-30_21,2024-05-30_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 spamscore=0 suspectscore=0 adultscore=0 phishscore=0 malwarescore=0 mlxlogscore=999 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2405010000 definitions=main-2405310010 X-Proofpoint-ORIG-GUID: rkRNN0twpbRo_W7f5R2GhnoeX12G9z35 X-Proofpoint-GUID: rkRNN0twpbRo_W7f5R2GhnoeX12G9z35 From: "Daniel P. Smith" The SHA-256 algorithm is necessary to measure configuration information into the TPM as early as possible before using the values. This implementation uses the established approach of #including the SHA-256 libraries directly in the code since the compressed kernel is not uncompressed at this point. Signed-off-by: Daniel P. Smith Signed-off-by: Ross Philipson --- arch/x86/boot/compressed/Makefile | 2 +- arch/x86/boot/compressed/early_sha256.c | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 arch/x86/boot/compressed/early_sha256.c diff --git a/arch/x86/boot/compressed/Makefile b/arch/x86/boot/compressed/Makefile index 3307ebef4e1b..9189a0e28686 100644 --- a/arch/x86/boot/compressed/Makefile +++ b/arch/x86/boot/compressed/Makefile @@ -118,7 +118,7 @@ vmlinux-objs-$(CONFIG_EFI) += $(obj)/efi.o vmlinux-objs-$(CONFIG_EFI_MIXED) += $(obj)/efi_mixed.o vmlinux-objs-$(CONFIG_EFI_STUB) += $(objtree)/drivers/firmware/efi/libstub/lib.a -vmlinux-objs-$(CONFIG_SECURE_LAUNCH) += $(obj)/early_sha1.o +vmlinux-objs-$(CONFIG_SECURE_LAUNCH) += $(obj)/early_sha1.o $(obj)/early_sha256.o $(obj)/vmlinux: $(vmlinux-objs-y) FORCE $(call if_changed,ld) diff --git a/arch/x86/boot/compressed/early_sha256.c b/arch/x86/boot/compressed/early_sha256.c new file mode 100644 index 000000000000..293742a90ddc --- /dev/null +++ b/arch/x86/boot/compressed/early_sha256.c @@ -0,0 +1,6 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (c) 2024 Apertus Solutions, LLC + */ + +#include "../../../../lib/crypto/sha256.c" -- 2.39.3