From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.groups.io with SMTP id smtpd.web11.25228.1653293655713158209 for ; Mon, 23 May 2022 01:14:16 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=HzWQE/5O; spf=pass (domain: redhat.com, ip: 170.10.129.124, mailfrom: kraxel@redhat.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1653293654; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=Oms0MuYliBXEjOXMmibaWyBYoBITtgDcJKrfdzVz+SE=; b=HzWQE/5OqH7g5QPVNuYDOiRcZmoi0O7gKJwkOAAMD9WJgedPOIui7oM0VY1Yv2Y82pRwAq atw7Ahqmdnrz4x2oxUsS1n9HMHkRze5rd4tNYTfD9mq4Zv/nQ9Mp/pdk577/q62/UxkGGA a11FS6gO3H3Oe9IdFF2LiJgj+pev7uk= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-489-0tXtHgVIPxawU3Kw1y3tZQ-1; Mon, 23 May 2022 04:14:08 -0400 X-MC-Unique: 0tXtHgVIPxawU3Kw1y3tZQ-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id DE0E585A5B9; Mon, 23 May 2022 08:14:07 +0000 (UTC) Received: from sirius.home.kraxel.org (unknown [10.39.192.41]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8DA5BC27E8E; Mon, 23 May 2022 08:14:07 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 1396018000B4; Mon, 23 May 2022 10:14:05 +0200 (CEST) Date: Mon, 23 May 2022 10:14:05 +0200 From: "Gerd Hoffmann" To: Min Xu Cc: devel@edk2.groups.io, Ard Biesheuvel , Jordan Justen , Ashish Kalra , Brijesh Singh , Erdem Aktas , James Bottomley , Jiewen Yao , Sami Mujawar , Tom Lendacky Subject: Re: [PATCH 3/4] OvmfPkg: Implement BlobMeasurementLibTdx Message-ID: <20220523081405.7aicbu22quj5yd3a@sirius.home.kraxel.org> References: MIME-Version: 1.0 In-Reply-To: X-Scanned-By: MIMEDefang 2.85 on 10.11.54.8 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=kraxel@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Disposition: inline > +EFI_STATUS > +EFIAPI > +MeasureKernelBlob ( > + IN CONST CHAR16 *BlobName, > + IN UINT32 BlobNameSize, > + IN CONST VOID *BlobBase, > + IN UINT32 BlobSize > + ) > +{ > + EFI_STATUS Status; > + UINT32 MrIndex; > + EFI_CC_EVENT *CcEvent; > + > + if ((BlobBase == 0) || (BlobSize == 0)) { > + ASSERT (FALSE); > + return EFI_INVALID_PARAMETER; > + } > + > + if (mCcProtocol == NULL) { > + Status = gBS->LocateProtocol (&gEfiCcMeasurementProtocolGuid, NULL, (VOID **)&mCcProtocol); > + if (EFI_ERROR (Status)) { > + // > + // EFI_CC_MEASUREMENT_PROTOCOL protocol is not installed. > + // > + DEBUG ((DEBUG_ERROR, "%a: EFI_CC_MEASUREMENT_PROTOCOL protocol is not installed.\n", __FUNCTION__)); > + return EFI_NOT_FOUND; > + } > + } I think it makes sense to support measurement to both tdx and tpm here. > + Status = mCcProtocol->MapPcrToMrIndex (mCcProtocol, 4, &MrIndex); Why PCR 4 for everything? When grub measures to the tpm it uses PCR 8 (strings, i.e. configuration and kernel command line) and PCR 9 (binaries, i.e. kernel + initrd). take care, Gerd