From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f49.google.com (mail-wr1-f49.google.com [209.85.221.49]) (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 B146F17564 for ; Thu, 22 Feb 2024 03:04:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.49 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708571100; cv=none; b=I+l/P2WLqDKT+skqwvXzfBhmh4wrvW1Kj0LkYHIwuXnZsj0O2SJMnyXl5EnLkBHsxr8ZQiBY/TsG2lAaDQJgEatVgWZ3V4rfvCt6jJzLpmlQgfyDl/3TjsI3zZbMSIyMFc7U4MBMLWq7u3nCTRt+uLgO8H3Jl4BU5W9TxmmG3bU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708571100; c=relaxed/simple; bh=oMwUqFBmwZni3nYHGsNufQX82jUOTPamTsIFOmXTch4=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=Mjjmd0KVtMUR+VCBbhJYgRphH0lnw60a9G/S05mMPSRSKkAlZ4ys9CoUAs0Kxe8+xkRCNIiYOYnpGIszallfP4vW0zw+mxm6RtjQJbf4JedUo5OJpQqLxNMb/5bF6bxIzj8w1nlUedPoklHb2KwRzQbHCHMW7O/+02bvv1cFWY4= 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.221.49 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=citrix.com header.i=@citrix.com header.b="ooJKEU6y" Received: by mail-wr1-f49.google.com with SMTP id ffacd0b85a97d-33d01faf711so4678280f8f.1 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=fi+IYQXKXMYPtMy2JxIHok+ZK7ZxoY4vG3IUeZv/9diwasC/NOGbL5ixbc2LA4d7pC RcTbwVvJtLAEtpA+Ov+ry+x6dJ92I618Hf3aplOJ7SwvVrn3PDZivJO3iWllX+Kk7ZAi JBQXMcJ1gNNrLm+93dSXC4IadkMdX68LvuZDIU7FU5XRAgRgrJPolqw15MFaqW1HvGU4 CRXZ3px4dMOpK7+bP6iVuLjoqbt98o1drHKz2X7O9kRJeGijnr5LzBGrVGHjvfYnWhln xThi5ka/72f6upN7Y0CdaM+O1OkV25cA0dssWr+5vZ8luZHq1XWQCXG4TyrQFfpeSbfM u0rQ== X-Forwarded-Encrypted: i=1; AJvYcCUynYn1qoDyRTVpF6dlh04EQPsvILC5iwlClu9OZO1dD86Nax5tW+QQXfGrW5d59277iMbKEcvsV9z5iJVq4anB+LC7uwSNOd0z X-Gm-Message-State: AOJu0Yz7PrxfCEQdNqRGlKSxliQeRQby1vcfmXVjQSeTdGXyUQrigh6n k4LNmTNg6rKhM7hPJIzxmD7rNaYiwzxd32qRrtcQ7ITR0n6i5xvywOSu7hFstJM= X-Google-Smtp-Source: AGHT+IEz8G6fU4K+3yNmLXt/7u9L6x1bnOwXtDSfi1M9hATKx/IGbEkXRTuSr1VDr3aYclkncYlvnQ== 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-doc@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+erL4LqFUO7GXSdBRbw5 gNt25XTLdSFuZtMxkY3tq8MFss5QnjhehCVPEpE6y9ZjI4XB8ad1G4oBHVGK5LMsvg22PfMJ ISWFSHoF/B5+lHkCKWkFxZ0gZn33ju5n6/FOdEx4B8cMJt+cWwARAQABzSlBbmRyZXcgQ29v cGVyIDxhbmRyZXcuY29vcGVyM0BjaXRyaXguY29tPsLBegQTAQgAJAIbAwULCQgHAwUVCgkI CwUWAgMBAAIeAQIXgAUCWKD95wI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: 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