From nobody Sat Nov 2 14:31:20 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Authentication-Results: mx.zoho.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org; Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1486655525742639.038879950516; Thu, 9 Feb 2017 07:52:05 -0800 (PST) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 3EE2D81F53; Thu, 9 Feb 2017 07:52:04 -0800 (PST) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id E95D981F22 for ; Thu, 9 Feb 2017 07:52:02 -0800 (PST) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga101.jf.intel.com with ESMTP; 09 Feb 2017 07:52:01 -0800 Received: from jyao1-mobl.ccr.corp.intel.com ([10.255.88.151]) by orsmga002.jf.intel.com with ESMTP; 09 Feb 2017 07:52:00 -0800 X-Original-To: edk2-devel@lists.01.org X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.35,349,1484035200"; d="scan'208";a="42060198" From: Jiewen Yao To: edk2-devel@lists.01.org Date: Thu, 9 Feb 2017 07:51:56 -0800 Message-Id: <1486655516-11504-1-git-send-email-jiewen.yao@intel.com> X-Mailer: git-send-email 2.7.4.windows.1 Subject: [edk2] [PATCH] SecurityPkg/TpmCommandLib: Add Tpm2ReadPublic. X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Yao Jiewen , Chao Zhang , Long Qin MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Cc: Chao Zhang Cc: Long Qin Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Yao Jiewen Reviewed-by: Chao Zhang --- SecurityPkg/Include/Library/Tpm2CommandLib.h | 22 +- SecurityPkg/Library/Tpm2CommandLib/Tpm2CommandLib.inf | 3 +- SecurityPkg/Library/Tpm2CommandLib/Tpm2Object.c | 346 ++++++++++++++= ++++++ 3 files changed, 369 insertions(+), 2 deletions(-) diff --git a/SecurityPkg/Include/Library/Tpm2CommandLib.h b/SecurityPkg/Inc= lude/Library/Tpm2CommandLib.h index f7a04f2..80ada73 100644 --- a/SecurityPkg/Include/Library/Tpm2CommandLib.h +++ b/SecurityPkg/Include/Library/Tpm2CommandLib.h @@ -1,7 +1,7 @@ /** @file This library is used by other modules to send TPM2 command. =20 -Copyright (c) 2013 - 2016, Intel Corporation. All rights reserved.
+Copyright (c) 2013 - 2017, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD = License which accompanies this distribution. The full text of the license may be = found at @@ -959,6 +959,26 @@ Tpm2PolicyGetDigest ( OUT TPM2B_DIGEST *PolicyHash ); =20 +/** + This command allows access to the public area of a loaded object. + + @param[in] ObjectHandle TPM handle of an object + @param[out] OutPublic Structure containing the public area= of an object + @param[out] Name Name of the object + @param[out] QualifiedName The Qualified Name of the object + + @retval EFI_SUCCESS Operation completed successfully. + @retval EFI_DEVICE_ERROR Unexpected device behavior. +**/ +EFI_STATUS +EFIAPI +Tpm2ReadPublic ( + IN TPMI_DH_OBJECT ObjectHandle, + OUT TPM2B_PUBLIC *OutPublic, + OUT TPM2B_NAME *Name, + OUT TPM2B_NAME *QualifiedName + ); + // // Help function // diff --git a/SecurityPkg/Library/Tpm2CommandLib/Tpm2CommandLib.inf b/Securi= tyPkg/Library/Tpm2CommandLib/Tpm2CommandLib.inf index 740af3f..481a878 100644 --- a/SecurityPkg/Library/Tpm2CommandLib/Tpm2CommandLib.inf +++ b/SecurityPkg/Library/Tpm2CommandLib/Tpm2CommandLib.inf @@ -3,7 +3,7 @@ # # This library is used by other modules to send TPM 2.0 command. # -# Copyright (c) 2013 - 2014, Intel Corporation. All rights reserved.
+# Copyright (c) 2013 - 2017, Intel Corporation. All rights reserved.
# This program and the accompanying materials # are licensed and made available under the terms and conditions of the BS= D License # which accompanies this distribution. The full text of the license may be= found at @@ -40,6 +40,7 @@ Tpm2EnhancedAuthorization.c Tpm2Test.c Tpm2DictionaryAttack.c + Tpm2Object.c Tpm2Miscellaneous.c Tpm2Help.c =20 diff --git a/SecurityPkg/Library/Tpm2CommandLib/Tpm2Object.c b/SecurityPkg/= Library/Tpm2CommandLib/Tpm2Object.c new file mode 100644 index 0000000..e070ff2 --- /dev/null +++ b/SecurityPkg/Library/Tpm2CommandLib/Tpm2Object.c @@ -0,0 +1,346 @@ +/** @file + Implement TPM2 Object related command. + +Copyright (c) 2017, Intel Corporation. All rights reserved.
+This program and the accompanying materials +are licensed and made available under the terms and conditions of the BSD = License +which accompanies this distribution. The full text of the license may be = found at +http://opensource.org/licenses/bsd-license.php + +THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLI= ED. + +**/ + +#include +#include +#include +#include +#include +#include + +#pragma pack(1) + +typedef struct { + TPM2_COMMAND_HEADER Header; + TPMI_DH_OBJECT ObjectHandle; +} TPM2_READ_PUBLIC_COMMAND; + +typedef struct { + TPM2_RESPONSE_HEADER Header; + TPM2B_PUBLIC OutPublic; + TPM2B_NAME Name; + TPM2B_NAME QualifiedName; +} TPM2_READ_PUBLIC_RESPONSE; + +#pragma pack() + +/** + This command allows access to the public area of a loaded object. + + @param[in] ObjectHandle TPM handle of an object + @param[out] OutPublic Structure containing the public area= of an object + @param[out] Name Name of the object + @param[out] QualifiedName The Qualified Name of the object + + @retval EFI_SUCCESS Operation completed successfully. + @retval EFI_DEVICE_ERROR Unexpected device behavior. +**/ +EFI_STATUS +EFIAPI +Tpm2ReadPublic ( + IN TPMI_DH_OBJECT ObjectHandle, + OUT TPM2B_PUBLIC *OutPublic, + OUT TPM2B_NAME *Name, + OUT TPM2B_NAME *QualifiedName + ) +{ + EFI_STATUS Status; + TPM2_READ_PUBLIC_COMMAND SendBuffer; + TPM2_READ_PUBLIC_RESPONSE RecvBuffer; + UINT32 SendBufferSize; + UINT32 RecvBufferSize; + TPM_RC ResponseCode; + UINT8 *Buffer; + UINT16 OutPublicSize; + UINT16 NameSize; + UINT16 QualifiedNameSize; + + // + // Construct command + // + SendBuffer.Header.tag =3D SwapBytes16(TPM_ST_NO_SESSIONS); + SendBuffer.Header.commandCode =3D SwapBytes32(TPM_CC_ReadPublic); + + SendBuffer.ObjectHandle =3D SwapBytes32 (ObjectHandle); + + SendBufferSize =3D (UINT32) sizeof (SendBuffer); + SendBuffer.Header.paramSize =3D SwapBytes32 (SendBufferSize); + + // + // send Tpm command + // + RecvBufferSize =3D sizeof (RecvBuffer); + Status =3D Tpm2SubmitCommand (SendBufferSize, (UINT8 *)&SendBuffer, &Rec= vBufferSize, (UINT8 *)&RecvBuffer); + if (EFI_ERROR (Status)) { + return Status; + } + + if (RecvBufferSize < sizeof (TPM2_RESPONSE_HEADER)) { + DEBUG ((DEBUG_ERROR, "Tpm2ReadPublic - RecvBufferSize Error - %x\n", R= ecvBufferSize)); + return EFI_DEVICE_ERROR; + } + ResponseCode =3D SwapBytes32(RecvBuffer.Header.responseCode); + if (ResponseCode !=3D TPM_RC_SUCCESS) { + DEBUG ((DEBUG_ERROR, "Tpm2ReadPublic - responseCode - %x\n", SwapBytes= 32(RecvBuffer.Header.responseCode))); + } + switch (ResponseCode) { + case TPM_RC_SUCCESS: + // return data + break; + case TPM_RC_SEQUENCE: + // objectHandle references a sequence object + return EFI_INVALID_PARAMETER; + default: + return EFI_DEVICE_ERROR; + } + + // + // Basic check + // + OutPublicSize =3D SwapBytes16 (RecvBuffer.OutPublic.size); + NameSize =3D SwapBytes16 (ReadUnaligned16 ((UINT16 *)((UINT8 *)&RecvBuff= er + sizeof(TPM2_RESPONSE_HEADER) + + sizeof(UINT16) + OutPublicSize))); + QualifiedNameSize =3D SwapBytes16 (ReadUnaligned16 ((UINT16 *)((UINT8 *)= &RecvBuffer + sizeof(TPM2_RESPONSE_HEADER) + + sizeof(UINT16) + OutPublicSize + + sizeof(UINT16) + NameSize))); + + if (RecvBufferSize !=3D sizeof(TPM2_RESPONSE_HEADER) + sizeof(UINT16) + = OutPublicSize + sizeof(UINT16) + NameSize + sizeof(UINT16) + QualifiedNameS= ize) { + DEBUG ((DEBUG_ERROR, "Tpm2ReadPublic - RecvBufferSize %x Error - OutPu= blicSize %x, NameSize %x, QualifiedNameSize %x\n", RecvBufferSize, OutPubli= cSize, NameSize, QualifiedNameSize)); + return EFI_DEVICE_ERROR; + } + + // + // Return the response + // + Buffer =3D (UINT8 *)&RecvBuffer.OutPublic; + CopyMem (OutPublic, &RecvBuffer.OutPublic, sizeof(UINT16) + OutPublicSiz= e); + OutPublic->size =3D OutPublicSize; + OutPublic->publicArea.type =3D SwapBytes16 (OutPublic->publicArea.type); + OutPublic->publicArea.nameAlg =3D SwapBytes16 (OutPublic->publicArea.nam= eAlg); + WriteUnaligned32 ((UINT32 *)&OutPublic->publicArea.objectAttributes, Swa= pBytes32 (ReadUnaligned32 ((UINT32 *)&OutPublic->publicArea.objectAttribute= s))); + Buffer =3D (UINT8 *)&RecvBuffer.OutPublic.publicArea.authPolicy; + OutPublic->publicArea.authPolicy.size =3D SwapBytes16 (ReadUnaligned16 (= (UINT16 *)Buffer)); + Buffer +=3D sizeof(UINT16); + CopyMem (OutPublic->publicArea.authPolicy.buffer, Buffer, OutPublic->pub= licArea.authPolicy.size); + Buffer +=3D OutPublic->publicArea.authPolicy.size; + + // TPMU_PUBLIC_PARMS + switch (OutPublic->publicArea.type) { + case TPM_ALG_KEYEDHASH: + OutPublic->publicArea.parameters.keyedHashDetail.scheme.scheme =3D Swa= pBytes16 (ReadUnaligned16 ((UINT16 *)Buffer)); + Buffer +=3D sizeof(UINT16); + switch (OutPublic->publicArea.parameters.keyedHashDetail.scheme.scheme= ) { + case TPM_ALG_HMAC: + OutPublic->publicArea.parameters.keyedHashDetail.scheme.details.hmac= .hashAlg =3D SwapBytes16 (ReadUnaligned16 ((UINT16 *)Buffer)); + Buffer +=3D sizeof(UINT16); + break; + case TPM_ALG_XOR: + OutPublic->publicArea.parameters.keyedHashDetail.scheme.details.xor.= hashAlg =3D SwapBytes16 (ReadUnaligned16 ((UINT16 *)Buffer)); + Buffer +=3D sizeof(UINT16); + OutPublic->publicArea.parameters.keyedHashDetail.scheme.details.xor.= kdf =3D SwapBytes16 (ReadUnaligned16 ((UINT16 *)Buffer)); + Buffer +=3D sizeof(UINT16); + break; + default: + return EFI_UNSUPPORTED; + } + case TPM_ALG_SYMCIPHER: + OutPublic->publicArea.parameters.symDetail.algorithm =3D SwapBytes16 (= ReadUnaligned16 ((UINT16 *)Buffer)); + Buffer +=3D sizeof(UINT16); + switch (OutPublic->publicArea.parameters.symDetail.algorithm) { + case TPM_ALG_AES: + OutPublic->publicArea.parameters.symDetail.keyBits.aes =3D SwapBytes= 16 (ReadUnaligned16 ((UINT16 *)Buffer)); + Buffer +=3D sizeof(UINT16); + OutPublic->publicArea.parameters.symDetail.mode.aes =3D SwapBytes16 = (ReadUnaligned16 ((UINT16 *)Buffer)); + Buffer +=3D sizeof(UINT16); + break; + case TPM_ALG_SM4: + OutPublic->publicArea.parameters.symDetail.keyBits.SM4 =3D SwapBytes= 16 (ReadUnaligned16 ((UINT16 *)Buffer)); + Buffer +=3D sizeof(UINT16); + OutPublic->publicArea.parameters.symDetail.mode.SM4 =3D SwapBytes16 = (ReadUnaligned16 ((UINT16 *)Buffer)); + Buffer +=3D sizeof(UINT16); + break; + case TPM_ALG_XOR: + OutPublic->publicArea.parameters.symDetail.keyBits.xor =3D SwapBytes= 16 (ReadUnaligned16 ((UINT16 *)Buffer)); + Buffer +=3D sizeof(UINT16); + break; + case TPM_ALG_NULL: + break; + default: + return EFI_UNSUPPORTED; + } + break; + case TPM_ALG_RSA: + OutPublic->publicArea.parameters.rsaDetail.symmetric.algorithm =3D Swa= pBytes16 (ReadUnaligned16 ((UINT16 *)Buffer)); + Buffer +=3D sizeof(UINT16); + switch (OutPublic->publicArea.parameters.rsaDetail.symmetric.algorithm= ) { + case TPM_ALG_AES: + OutPublic->publicArea.parameters.rsaDetail.symmetric.keyBits.aes =3D= SwapBytes16 (ReadUnaligned16 ((UINT16 *)Buffer)); + Buffer +=3D sizeof(UINT16); + OutPublic->publicArea.parameters.rsaDetail.symmetric.mode.aes =3D Sw= apBytes16 (ReadUnaligned16 ((UINT16 *)Buffer)); + Buffer +=3D sizeof(UINT16); + break; + case TPM_ALG_SM4: + OutPublic->publicArea.parameters.rsaDetail.symmetric.keyBits.SM4 =3D= SwapBytes16 (ReadUnaligned16 ((UINT16 *)Buffer)); + Buffer +=3D sizeof(UINT16); + OutPublic->publicArea.parameters.rsaDetail.symmetric.mode.SM4 =3D Sw= apBytes16 (ReadUnaligned16 ((UINT16 *)Buffer)); + Buffer +=3D sizeof(UINT16); + break; + case TPM_ALG_NULL: + break; + default: + return EFI_UNSUPPORTED; + } + OutPublic->publicArea.parameters.rsaDetail.scheme.scheme =3D SwapBytes= 16 (ReadUnaligned16 ((UINT16 *)Buffer)); + Buffer +=3D sizeof(UINT16); + switch (OutPublic->publicArea.parameters.rsaDetail.scheme.scheme) { + case TPM_ALG_RSASSA: + OutPublic->publicArea.parameters.rsaDetail.scheme.details.rsassa.has= hAlg =3D SwapBytes16 (ReadUnaligned16 ((UINT16 *)Buffer)); + Buffer +=3D sizeof(UINT16); + break; + case TPM_ALG_RSAPSS: + OutPublic->publicArea.parameters.rsaDetail.scheme.details.rsapss.has= hAlg =3D SwapBytes16 (ReadUnaligned16 ((UINT16 *)Buffer)); + Buffer +=3D sizeof(UINT16); + break; + case TPM_ALG_RSAES: + break; + case TPM_ALG_OAEP: + OutPublic->publicArea.parameters.rsaDetail.scheme.details.oaep.hashA= lg =3D SwapBytes16 (ReadUnaligned16 ((UINT16 *)Buffer)); + Buffer +=3D sizeof(UINT16); + break; + case TPM_ALG_NULL: + break; + default: + return EFI_UNSUPPORTED; + } + OutPublic->publicArea.parameters.rsaDetail.keyBits =3D SwapBytes16 (Re= adUnaligned16 ((UINT16 *)Buffer)); + Buffer +=3D sizeof(UINT16); + OutPublic->publicArea.parameters.rsaDetail.exponent =3D SwapBytes16 (R= eadUnaligned16 ((UINT16 *)Buffer)); + Buffer +=3D sizeof(UINT32); + break; + case TPM_ALG_ECC: + OutPublic->publicArea.parameters.eccDetail.symmetric.algorithm =3D Swa= pBytes16 (ReadUnaligned16 ((UINT16 *)Buffer)); + Buffer +=3D sizeof(UINT16); + switch (OutPublic->publicArea.parameters.eccDetail.symmetric.algorithm= ) { + case TPM_ALG_AES: + OutPublic->publicArea.parameters.eccDetail.symmetric.keyBits.aes =3D= SwapBytes16 (ReadUnaligned16 ((UINT16 *)Buffer)); + Buffer +=3D sizeof(UINT16); + OutPublic->publicArea.parameters.eccDetail.symmetric.mode.aes =3D Sw= apBytes16 (ReadUnaligned16 ((UINT16 *)Buffer)); + Buffer +=3D sizeof(UINT16); + break; + case TPM_ALG_SM4: + OutPublic->publicArea.parameters.eccDetail.symmetric.keyBits.SM4 =3D= SwapBytes16 (ReadUnaligned16 ((UINT16 *)Buffer)); + Buffer +=3D sizeof(UINT16); + OutPublic->publicArea.parameters.eccDetail.symmetric.mode.SM4 =3D Sw= apBytes16 (ReadUnaligned16 ((UINT16 *)Buffer)); + Buffer +=3D sizeof(UINT16); + break; + case TPM_ALG_NULL: + break; + default: + return EFI_UNSUPPORTED; + } + OutPublic->publicArea.parameters.eccDetail.scheme.scheme =3D SwapBytes= 16 (ReadUnaligned16 ((UINT16 *)Buffer)); + Buffer +=3D sizeof(UINT16); + switch (OutPublic->publicArea.parameters.eccDetail.scheme.scheme) { + case TPM_ALG_ECDSA: + OutPublic->publicArea.parameters.eccDetail.scheme.details.ecdsa.hash= Alg =3D SwapBytes16 (ReadUnaligned16 ((UINT16 *)Buffer)); + Buffer +=3D sizeof(UINT16); + break; + case TPM_ALG_ECDAA: + OutPublic->publicArea.parameters.eccDetail.scheme.details.ecdaa.hash= Alg =3D SwapBytes16 (ReadUnaligned16 ((UINT16 *)Buffer)); + Buffer +=3D sizeof(UINT16); + break; + case TPM_ALG_ECSCHNORR: + OutPublic->publicArea.parameters.eccDetail.scheme.details.ecSchnorr.= hashAlg =3D SwapBytes16 (ReadUnaligned16 ((UINT16 *)Buffer)); + Buffer +=3D sizeof(UINT16); + break; + case TPM_ALG_ECDH: + break; + case TPM_ALG_NULL: + break; + default: + return EFI_UNSUPPORTED; + } + OutPublic->publicArea.parameters.eccDetail.curveID =3D SwapBytes16 (Re= adUnaligned16 ((UINT16 *)Buffer)); + Buffer +=3D sizeof(UINT16); + OutPublic->publicArea.parameters.eccDetail.kdf.scheme =3D SwapBytes16 = (ReadUnaligned16 ((UINT16 *)Buffer)); + Buffer +=3D sizeof(UINT16); + switch (OutPublic->publicArea.parameters.eccDetail.kdf.scheme) { + case TPM_ALG_MGF1: + OutPublic->publicArea.parameters.eccDetail.kdf.details.mgf1.hashAlg = =3D SwapBytes16 (ReadUnaligned16 ((UINT16 *)Buffer)); + Buffer +=3D sizeof(UINT16); + break; + case TPM_ALG_KDF1_SP800_108: + OutPublic->publicArea.parameters.eccDetail.kdf.details.kdf1_sp800_10= 8.hashAlg =3D SwapBytes16 (ReadUnaligned16 ((UINT16 *)Buffer)); + Buffer +=3D sizeof(UINT16); + break; + case TPM_ALG_KDF1_SP800_56a: + OutPublic->publicArea.parameters.eccDetail.kdf.details.kdf1_SP800_56= a.hashAlg =3D SwapBytes16 (ReadUnaligned16 ((UINT16 *)Buffer)); + Buffer +=3D sizeof(UINT16); + break; + case TPM_ALG_KDF2: + OutPublic->publicArea.parameters.eccDetail.kdf.details.kdf2.hashAlg = =3D SwapBytes16 (ReadUnaligned16 ((UINT16 *)Buffer)); + Buffer +=3D sizeof(UINT16); + break; + case TPM_ALG_NULL: + break; + default: + return EFI_UNSUPPORTED; + } + break; + default: + return EFI_UNSUPPORTED; + } + + // TPMU_PUBLIC_ID + switch (OutPublic->publicArea.type) { + case TPM_ALG_KEYEDHASH: + OutPublic->publicArea.unique.keyedHash.size =3D SwapBytes16 (ReadUnali= gned16 ((UINT16 *)Buffer)); + Buffer +=3D sizeof(UINT16); + CopyMem (OutPublic->publicArea.unique.keyedHash.buffer, Buffer, OutPub= lic->publicArea.unique.keyedHash.size); + Buffer +=3D OutPublic->publicArea.unique.keyedHash.size; + break; + case TPM_ALG_SYMCIPHER: + OutPublic->publicArea.unique.sym.size =3D SwapBytes16 (ReadUnaligned16= ((UINT16 *)Buffer)); + Buffer +=3D sizeof(UINT16); + CopyMem (OutPublic->publicArea.unique.sym.buffer, Buffer, OutPublic->p= ublicArea.unique.sym.size); + Buffer +=3D OutPublic->publicArea.unique.sym.size; + break; + case TPM_ALG_RSA: + OutPublic->publicArea.unique.rsa.size =3D SwapBytes16 (ReadUnaligned16= ((UINT16 *)Buffer)); + Buffer +=3D sizeof(UINT16); + CopyMem (OutPublic->publicArea.unique.rsa.buffer, Buffer, OutPublic->p= ublicArea.unique.rsa.size); + Buffer +=3D OutPublic->publicArea.unique.rsa.size; + break; + case TPM_ALG_ECC: + OutPublic->publicArea.unique.ecc.x.size =3D SwapBytes16 (ReadUnaligned= 16 ((UINT16 *)Buffer)); + Buffer +=3D sizeof(UINT16); + CopyMem (OutPublic->publicArea.unique.ecc.x.buffer, Buffer, OutPublic-= >publicArea.unique.ecc.x.size); + Buffer +=3D OutPublic->publicArea.unique.ecc.x.size; + OutPublic->publicArea.unique.ecc.y.size =3D SwapBytes16 (ReadUnaligned= 16 ((UINT16 *)Buffer)); + Buffer +=3D sizeof(UINT16); + CopyMem (OutPublic->publicArea.unique.ecc.y.buffer, Buffer, OutPublic-= >publicArea.unique.ecc.y.size); + Buffer +=3D OutPublic->publicArea.unique.ecc.y.size; + break; + default: + return EFI_UNSUPPORTED; + } + + CopyMem (Name->name, (UINT8 *)&RecvBuffer + sizeof(TPM2_RESPONSE_HEADER)= + sizeof(UINT16) + OutPublicSize + sizeof(UINT16), NameSize); + Name->size =3D NameSize; + + CopyMem (QualifiedName->name, (UINT8 *)&RecvBuffer + sizeof(TPM2_RESPONS= E_HEADER) + sizeof(UINT16) + OutPublicSize + sizeof(UINT16) + NameSize + si= zeof(UINT16), QualifiedNameSize); + QualifiedName->size =3D QualifiedNameSize; + + return EFI_SUCCESS; +} --=20 2.7.4.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel