From nobody Sun Nov 2 11:46:59 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1509145531591471.7276137903041; Fri, 27 Oct 2017 16:05:31 -0700 (PDT) Received: from localhost ([::1]:59189 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e8Dgh-0003p9-1n for importer@patchew.org; Fri, 27 Oct 2017 19:05:15 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40040) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e8Dee-0002ed-Fs for qemu-devel@nongnu.org; Fri, 27 Oct 2017 19:03:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e8DeY-0003wJ-RB for qemu-devel@nongnu.org; Fri, 27 Oct 2017 19:03:08 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:39476) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1e8DeY-0003v8-Gc for qemu-devel@nongnu.org; Fri, 27 Oct 2017 19:03:02 -0400 Received: from pps.filterd (m0098393.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id v9RN06ia060170 for ; Fri, 27 Oct 2017 19:02:58 -0400 Received: from e14.ny.us.ibm.com (e14.ny.us.ibm.com [129.33.205.204]) by mx0a-001b2d01.pphosted.com with ESMTP id 2dvcurjcf6-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Fri, 27 Oct 2017 19:02:57 -0400 Received: from localhost by e14.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 27 Oct 2017 19:02:56 -0400 Received: from b01cxnp22035.gho.pok.ibm.com (9.57.198.25) by e14.ny.us.ibm.com (146.89.104.201) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Fri, 27 Oct 2017 19:02:54 -0400 Received: from b01ledav006.gho.pok.ibm.com (b01ledav006.gho.pok.ibm.com [9.57.199.111]) by b01cxnp22035.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v9RN2stx47055034; Fri, 27 Oct 2017 23:02:54 GMT Received: from b01ledav006.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 58E6CAC043; Fri, 27 Oct 2017 19:03:39 -0400 (EDT) Received: from sbct-3.watson.ibm.com (unknown [9.47.158.153]) by b01ledav006.gho.pok.ibm.com (Postfix) with ESMTP id 4C5ECAC040; Fri, 27 Oct 2017 19:03:39 -0400 (EDT) From: Stefan Berger To: qemu-devel@nongnu.org Date: Fri, 27 Oct 2017 19:02:38 -0400 X-Mailer: git-send-email 2.5.5 In-Reply-To: <1509145361-11218-1-git-send-email-stefanb@linux.vnet.ibm.com> References: <1509145361-11218-1-git-send-email-stefanb@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 17102723-0052-0000-0000-00000278CE1F X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00007964; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000239; SDB=6.00937412; UDB=6.00472471; IPR=6.00717675; BA=6.00005660; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00017751; XFM=3.00000015; UTC=2017-10-27 23:02:55 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17102723-0053-0000-0000-00005273D589 Message-Id: <1509145361-11218-5-git-send-email-stefanb@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-10-27_10:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=3 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1707230000 definitions=main-1710270296 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 148.163.156.1 Subject: [Qemu-devel] [PATCH v2 4/7] tpm: Implement tpm_sized_buffer_reset X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: amarnath.valluri@intel.com, marcandre.lureau@gmail.com, Stefan Berger Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Stefan Berger --- hw/tpm/tpm_tis.c | 5 ----- hw/tpm/tpm_util.c | 7 +++++++ hw/tpm/tpm_util.h | 7 +++++++ 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/hw/tpm/tpm_tis.c b/hw/tpm/tpm_tis.c index 90dca4e..60887c3 100644 --- a/hw/tpm/tpm_tis.c +++ b/hw/tpm/tpm_tis.c @@ -48,11 +48,6 @@ typedef enum { TPM_TIS_STATE_RECEPTION, } TPMTISState; =20 -typedef struct TPMSizedBuffer { - uint32_t size; - uint8_t *buffer; -} TPMSizedBuffer; - /* locality data -- all fields are persisted */ typedef struct TPMLocality { TPMTISState state; diff --git a/hw/tpm/tpm_util.c b/hw/tpm/tpm_util.c index daf1faa..6132a14 100644 --- a/hw/tpm/tpm_util.c +++ b/hw/tpm/tpm_util.c @@ -151,3 +151,10 @@ int tpm_util_test_tpmdev(int tpm_fd, TPMVersion *tpm_v= ersion) =20 return 1; } + +void tpm_sized_buffer_reset(TPMSizedBuffer *tsb) +{ + g_free(tsb->buffer); + tsb->buffer =3D NULL; + tsb->size =3D 0; +} diff --git a/hw/tpm/tpm_util.h b/hw/tpm/tpm_util.h index aca10c9..4c0d596 100644 --- a/hw/tpm/tpm_util.h +++ b/hw/tpm/tpm_util.h @@ -36,4 +36,11 @@ static inline uint32_t tpm_cmd_get_size(const void *b) return be32_to_cpu(*(const uint32_t *)(b + 2)); } =20 +typedef struct TPMSizedBuffer { + uint32_t size; + uint8_t *buffer; +} TPMSizedBuffer; + +void tpm_sized_buffer_reset(TPMSizedBuffer *tsb); + #endif /* TPM_TPM_UTIL_H */ --=20 2.5.5