Received: by 2002:a05:7412:798b:b0:fc:a2b0:25d7 with SMTP id fb11csp100557rdb; Wed, 21 Feb 2024 19:15:54 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUNzFlogRvcmqP1S5as2IgfeM53IpfOctb1rNBYcchciRGxKSza3oy+ZxWtdbzpBsK16Rb9iB7GJ+jr/2rd/OZz2p9mkq2sRo/o808Eng== X-Google-Smtp-Source: AGHT+IHMiPgTgIirtetloOY/AZIULIq794FKLSUJjZdBYRKQPjuxVpGustR4Iu643OjL0nrpQxBW X-Received: by 2002:a05:6a21:4488:b0:1a0:5c40:172e with SMTP id vo8-20020a056a21448800b001a05c40172emr14112232pzb.55.1708571754769; Wed, 21 Feb 2024 19:15:54 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708571754; cv=pass; d=google.com; s=arc-20160816; b=gOVJyk5FeMU5oASFZ2vNglDnVJNekdVHSfbvAbOboSDbI6ysiMDxzQ/OH7o3JDd6JV ZXgfQcHVYLxzRehHnL+NmtRrptW4K80rfp7AlbEnvnQ2tqoOZtuHou5HO4bIuU91XRYU /A3dvAQ3jBclalGtfQN7HuEyDN+JNKOadbv2D8oCCUYACdCX3fWuFs/m43NWej74cYRn ivmH4CUJrZ0p8CmetXCKOnhi1TfGMvnPV9v5kiAQIgSj5yOPuHENgAXndtuxc66oqmbu LmI4bsawK/Ee0JYh1BFRDxMzoj+15Lyef4pIAQ6JGGMTbc24ezodZ69XjXszTd0XBqkh WG/Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:autocrypt:from:references:cc :to:content-language:subject:user-agent:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:date:message-id :dkim-signature; bh=oMwUqFBmwZni3nYHGsNufQX82jUOTPamTsIFOmXTch4=; fh=y90lSvCIhqRADFd5ui+2KBAxBR/L5WZv9Objh1x5GcU=; b=sMTg9+P2mx1/tyHSUh+2YYVtr4yphJcSzzbfjvUZ8qjWNxk3nDRIacok6yxD0g4dSU 5n6Foxpj6hN4Fxz+HNJDGmH8ObneOkIxqk1mbFHdolfbUsUdM4uqS/6HppWziaAhJf4J MFuhrTkEnqHU4stFxToMmE42jU05c/LpKUH/S8wbaHyiKIeHjh9tSAKlkJIPQQ091l0b LaOilUOtIDVOdQ/XuC+HfXBneyLNjRGv1DAV+3Dpyl8TXDCvEiB2pNvzh2UG5DhoQYA6 DghV2C3kIz9vARp/7GEPJi7l/C9JHGTNRDBc547HowOr/CkXin19b9OFDjjIjeIvrGQQ BPeA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@citrix.com header.s=google header.b=ooJKEU6y; arc=pass (i=1 spf=pass spfdomain=cloud.com dkim=pass dkdomain=citrix.com dmarc=pass fromdomain=citrix.com); spf=pass (google.com: domain of linux-crypto+bounces-2240-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-crypto+bounces-2240-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=citrix.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id x19-20020a17090a8a9300b002903e315e4bsi9440312pjn.81.2024.02.21.19.15.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Feb 2024 19:15:54 -0800 (PST) Received-SPF: pass (google.com: domain of linux-crypto+bounces-2240-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@citrix.com header.s=google header.b=ooJKEU6y; arc=pass (i=1 spf=pass spfdomain=cloud.com dkim=pass dkdomain=citrix.com dmarc=pass fromdomain=citrix.com); spf=pass (google.com: domain of linux-crypto+bounces-2240-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-crypto+bounces-2240-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=citrix.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 B50ED2867AF for ; Thu, 22 Feb 2024 03:06:28 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7A6301775E; Thu, 22 Feb 2024 03:05:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=citrix.com header.i=@citrix.com header.b="ooJKEU6y" X-Original-To: linux-crypto@vger.kernel.org Received: from mail-wm1-f44.google.com (mail-wm1-f44.google.com [209.85.128.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A8E6217560 for ; Thu, 22 Feb 2024 03:04:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.44 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708571101; cv=none; b=Vu/wFD2UTOJTYQNlvatUkIHYNZz+yYgJ3BZE8U+E4bECImSE9BsHlAjv64xks1mBD6Z7/AOlvdTr+egZt/8mNIufEwN9iBPsxFDr/iwhJXutn2FCUdTEVHA9RghVIr1wmnivRHyCtaDiB9Xg5JUnkUC6JvlDtgrBcPQ586P8r8M= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708571101; c=relaxed/simple; bh=oMwUqFBmwZni3nYHGsNufQX82jUOTPamTsIFOmXTch4=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=OFtTwfnpcS8XIvFcNdz2RaGskdazXXGj3RBBQ0ZT4z1aBZ5cdMzgSUSPSDP1S5R08RXbsX7bsAhz4ihhfseY3nYORHeL/QzDtblxNbBCDfWIymyGElQ4q5HIVeKTBZZxnISnL59VV71OeVgTz1DRFczUhhMHNcFIIuaTkdlo/UM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=citrix.com; spf=pass smtp.mailfrom=cloud.com; dkim=pass (1024-bit key) header.d=citrix.com header.i=@citrix.com header.b=ooJKEU6y; arc=none smtp.client-ip=209.85.128.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=citrix.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=cloud.com Received: by mail-wm1-f44.google.com with SMTP id 5b1f17b1804b1-41275971886so10300275e9.3 for ; Wed, 21 Feb 2024 19:04:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=citrix.com; s=google; t=1708571097; x=1709175897; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:autocrypt:from:references:cc :to:content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=oMwUqFBmwZni3nYHGsNufQX82jUOTPamTsIFOmXTch4=; b=ooJKEU6y1eVEG1FqGLqxfJrbCVeUzx7K43icvQX6+HihQTSFwdYRZrj1Elzf9zOsr8 lbwsyDjvCf/fkH8fCuVBdCDzXBkyVqtl7M/S9Me/1pPf4Mg6lkpeqc6K3NdC2waNa5C0 Cngo3DUbyPx2rtaIKMOmkeaV5GHcxt/dSlSPo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708571097; x=1709175897; h=content-transfer-encoding:in-reply-to:autocrypt:from:references:cc :to:content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=oMwUqFBmwZni3nYHGsNufQX82jUOTPamTsIFOmXTch4=; b=SvybWgAUJAeaUopyP90lsn3P+57dVXH6WAF1YJBhVlNGyP6gQ9yypWyeEqGk1qLR49 MPcYAoNCcYUFKKv+VgCoVaLrqYYwnSy183/KYIhYMF8VX92AHEl1xkjjvy6EbblxPHOo Jqfypl/0X8uV54s6IviNqlXK0IXrO5HIyIxaWIi8+3iIRLVuGjz5kOA1V+pkXqi9Q/RV KxcGZrOm3iSNQkLfkCjWjC7vz3Rmla/k4wXqnIj7NlwsVGGhV/4f7SkU787NnJH7Em4o G5Xw1T8Q6eeRezh82//wlZj7QyaQ0+ygSZLxavjRWtk/9xFa4GN7Y0Vq+J7J8zjd6Uxr FgvQ== X-Forwarded-Encrypted: i=1; AJvYcCXKQYimN014xPcUYQMGhv6UTCXUZIjL+K9N0rsqdS1xWczITSkpZTXW1BKusm0AqwZLDUkZC7fmq/ecjnXqzaAutkRz/wyGlmtrMaZ9 X-Gm-Message-State: AOJu0YybmGRWG25t3/FSAE+SYi26ymMw6n1n0kkhPXh43PYrFljXoI+6 OIICpbIN231ipeW7k2nwdfDnaptXsmzWhbMSVzRXLww3eA+c5bxnx0cepqigyxA= X-Received: by 2002:a05:6000:1f0f:b0:33d:5e19:e1f1 with SMTP id bv15-20020a0560001f0f00b0033d5e19e1f1mr7547885wrb.12.1708571097017; Wed, 21 Feb 2024 19:04:57 -0800 (PST) Received: from [192.168.1.10] (host-92-3-248-192.as13285.net. [92.3.248.192]) by smtp.gmail.com with ESMTPSA id h7-20020a056000000700b0033ce214a97csm18626037wrx.17.2024.02.21.19.04.55 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 21 Feb 2024 19:04:56 -0800 (PST) Message-ID: <98ad92bb-ef17-4c15-88ba-252db2a2e738@citrix.com> Date: Thu, 22 Feb 2024 03:04:55 +0000 Precedence: bulk X-Mailing-List: linux-crypto@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v8 06/15] x86: Add early SHA support for Secure Launch early measurements Content-Language: en-GB To: Ard Biesheuvel , Ross Philipson Cc: 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, dpsmith@apertussolutions.com, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, hpa@zytor.com, dave.hansen@linux.intel.com, 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, kanth.ghatraju@oracle.com, trenchboot-devel@googlegroups.com, Eric Biggers References: <20240214221847.2066632-1-ross.philipson@oracle.com> <20240214221847.2066632-7-ross.philipson@oracle.com> From: Andrew Cooper Autocrypt: addr=andrew.cooper3@citrix.com; keydata= xsFNBFLhNn8BEADVhE+Hb8i0GV6mihnnr/uiQQdPF8kUoFzCOPXkf7jQ5sLYeJa0cQi6Penp VtiFYznTairnVsN5J+ujSTIb+OlMSJUWV4opS7WVNnxHbFTPYZVQ3erv7NKc2iVizCRZ2Kxn srM1oPXWRic8BIAdYOKOloF2300SL/bIpeD+x7h3w9B/qez7nOin5NzkxgFoaUeIal12pXSR Q354FKFoy6Vh96gc4VRqte3jw8mPuJQpfws+Pb+swvSf/i1q1+1I4jsRQQh2m6OTADHIqg2E ofTYAEh7R5HfPx0EXoEDMdRjOeKn8+vvkAwhviWXTHlG3R1QkbE5M/oywnZ83udJmi+lxjJ5 YhQ5IzomvJ16H0Bq+TLyVLO/VRksp1VR9HxCzItLNCS8PdpYYz5TC204ViycobYU65WMpzWe LFAGn8jSS25XIpqv0Y9k87dLbctKKA14Ifw2kq5OIVu2FuX+3i446JOa2vpCI9GcjCzi3oHV e00bzYiHMIl0FICrNJU0Kjho8pdo0m2uxkn6SYEpogAy9pnatUlO+erL4LqFUO7GXSdB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dcQPzUiuHLK9i nvjREdh84qycnx0/6dDroYhp0DFv4udxuAvt1h4wGwTPRQZerSm4xaYegEFusyhbZrI0U9tJ B8WrhBLXDiYlyJT6zOV2yZFuW47VrLsjYnHwn27hmxTC/7tvG3euCklmkn9Sl9IAKFu29RSo d5bD8kMSCYsTqtTfT6W4A3qHGvIDta3ptLYpIAOD2sY3GYq2nf3Bbzx81wZK14JdDDHUX2Rs 6+ahAA== In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On 15/02/2024 8:17 am, Ard Biesheuvel wrote: > On Wed, 14 Feb 2024 at 23:31, Ross Philipson wrote: >> From: "Daniel P. Smith" >> >> The SHA algorithms are 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 libraries directly in >> the code since the compressed kernel is not uncompressed at this point. >> >> The SHA code here has its origins in the code from the main kernel: >> >> commit c4d5b9ffa31f ("crypto: sha1 - implement base layer for SHA-1") >> >> A modified version of this code was introduced to the lib/crypto/sha1.c >> to bring it in line with the sha256 code and allow it to be pulled into the >> setup kernel in the same manner as sha256 is. >> >> Signed-off-by: Daniel P. Smith >> Signed-off-by: Ross Philipson > We have had some discussions about this, and you really need to > capture the justification in the commit log for introducing new code > that implements an obsolete and broken hashing algorithm. > > SHA-1 is broken and should no longer be used for anything. Introducing > new support for a highly complex boot security feature, and then > relying on SHA-1 in the implementation makes this whole effort seem > almost futile, *unless* you provide some rock solid reasons here why > this is still safe. > > If the upshot would be that some people are stuck with SHA-1 so they > won't be able to use this feature, then I'm not convinced we should > obsess over that. To be absolutely crystal clear here. The choice of hash algorithm(s) are determined by the OEM and the platform, not by Linux. Failing to (at least) cap a PCR in a bank which the OEM/platform left active is a security vulnerability.  It permits the unsealing of secrets if an attacker can replay a good set of measurements into an unused bank. The only way to get rid of the requirement for SHA-1 here is to lobby the IHVs/OEMs, or perhaps the TCG, to produce/spec a platform where the SHA-1 banks can be disabled.  There are no known such platforms in the market today, to the best of our knowledge. ~Andrew