From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id ABEF5AC13B5 for ; Mon, 13 Nov 2023 12:57:31 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=bU3gnbIOXelhxyAMKYDLTANrDbfnA/gEu975xCcos1A=; c=relaxed/simple; d=groups.io; h=Message-ID:Date:MIME-Version:Subject:To:References:From:In-Reply-To:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Language:Content-Type:Content-Transfer-Encoding; s=20140610; t=1699880250; v=1; b=tJ/TLBPDsSREIG+esq+iNqmwxBqE+bHLIGiFgFhvtPG6q/iB/Oxm//QS+/LLwwYPK+fSnilP JtyGnRr21+LZ4QmS8im94D+k/sa/27TMm12YDk5/a1rJZz+3bx3PW3wvBmkmX/gaeYkWyr3+9a4 /sVSqYvmvO2pFcimLbSy5ibM= X-Received: by 127.0.0.2 with SMTP id qWglYY7687511x7C5zNdEDOE; Mon, 13 Nov 2023 04:57:30 -0800 X-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.web10.35981.1699880249422625605 for ; Mon, 13 Nov 2023 04:57:29 -0800 X-Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-231-CSgJcS7sPa29BFwoTjr5yw-1; Mon, 13 Nov 2023 07:57:25 -0500 X-MC-Unique: CSgJcS7sPa29BFwoTjr5yw-1 X-Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 3A8F0101A52D; Mon, 13 Nov 2023 12:57:25 +0000 (UTC) X-Received: from [10.39.192.220] (unknown [10.39.192.220]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9A06D502C; Mon, 13 Nov 2023 12:57:24 +0000 (UTC) Message-ID: <2c9a73ee-34e7-3dd8-3ff9-fef6df0336e6@redhat.com> Date: Mon, 13 Nov 2023 13:57:23 +0100 MIME-Version: 1.0 Subject: Re: [edk2-devel] TPM2 NVM WRITE IN EDK2 To: devel@edk2.groups.io, hckaraca99@gmail.com References: From: "Laszlo Ersek" In-Reply-To: X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.5 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,lersek@redhat.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: MJXZd3pbcWd5k7mSrNAe7q5Sx7686176AA= Content-Language: en-US Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b="tJ/TLBPD"; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=redhat.com (policy=none); spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io On 11/9/23 11:39, Hamit Can Karaca wrote: > Hello, > I am a young UEFI developer and I am trying to use the functions in > Tpm2CommandLib to write data to TPM2. I have defined the index that, I > am going to write data to, using the DefineSpace function. But whenever > I am trying to use the Tpm2NvWrite function, I keep getting > EFI_DEVICE_ERROR with a response code 0x1D5. Is there anything to do > before Tpm2NvWrite that I don't know or do I use the wrong parameters? > If anyone has used these functions please let me know, thanks! I think this should be possible to explain from the TPM2 spec, part 2, "structures". Response code 0x1D5 is binary 111010101. Bit 7 is set, therefore we have to look at the format-1 RC structure: 0001 1 1 010101 ---- - - ------ N F P E N=1 (1-based parameter that the error refers to) F=1 (format-1 response) P=1 (error is associated with a parameter) E=0x15 (error number) In Table 16, RC_FMT1 (value 0x80 -- F bit, or bit 7) says "This bit is SET in all format 1 response codes. The codes in this group may have a value added to them to indicate the handle, session, or parameter to which they apply". Indeed, we have P=1 (error is associated with parameter) and N=1 (1-based parameter number related to the error is 1). Thus, we have TPM_RC_SIZE (= RC_FMT1 + 0x015, 0x95, to which we add P=1 (0x40) and N=1 (0x100) for getting 0x1D5): TPM_RC_SIZE: structure is the wrong size In other words, whatever command you are sending, the TPM seems to reply with "parameter 1 of your command is incorrectly sized". Laszlo -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#111151): https://edk2.groups.io/g/devel/message/111151 Mute This Topic: https://groups.io/mt/102510897/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/leave/12367111/7686176/1913456212/xyzzy [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-