From patchwork Thu Jul 8 18:38:11 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Berger X-Patchwork-Id: 12366087 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DFA8EC07E96 for ; Thu, 8 Jul 2021 18:49:52 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8FA29613B0 for ; Thu, 8 Jul 2021 18:49:52 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8FA29613B0 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.vnet.ibm.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:59546 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m1Z5r-0002a5-NT for qemu-devel@archiver.kernel.org; Thu, 08 Jul 2021 14:49:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42260) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m1Yuy-0007JP-L1 for qemu-devel@nongnu.org; Thu, 08 Jul 2021 14:38:36 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:10788) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m1Yuq-0003cS-LD for qemu-devel@nongnu.org; Thu, 08 Jul 2021 14:38:36 -0400 Received: from pps.filterd (m0098393.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 168IXCHO042678 for ; Thu, 8 Jul 2021 14:38:27 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=AVK7ZCPmI3NsRthShr1GNojXpjmNWzLvfUJq1x2mnB4=; b=sDoJ24859MTtfQEh1d0QtbBfmMphTkR0dFMAK4jvgrmcLGUYQxzO7kfSMD1LfNubxkaC uLQ1tlKvaLCHyWkj2pMv/mxQIqrxJ7+m8eUuklYRqWmz8xy6Jdcp/uS+5npv8os8f0Yy jUCXeFkewxngpyw2r38ikHUYbbTrYE9+DsHE8SwwL8ti6RHd3DcYNaY3ZqfZxyzIBj4b OWdlGfynjzwzyk8m6FeH3bRNrs4rvfMIfpAXHtMNDhhUyfj0m3tTj0bgrfkciaGI1lLg mEUlnHKJlly4GNKHaFzXfnEV/kJvKjAz/iQUVCLYch23sKZSeVeu4xzJriSeOko+HkRv pQ== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 39mk53r3wy-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 08 Jul 2021 14:38:27 -0400 Received: from m0098393.ppops.net (m0098393.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 168IXFC1042912 for ; Thu, 8 Jul 2021 14:38:27 -0400 Received: from ppma05wdc.us.ibm.com (1b.90.2fa9.ip4.static.sl-reverse.com [169.47.144.27]) by mx0a-001b2d01.pphosted.com with ESMTP id 39mk53r3wj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 08 Jul 2021 14:38:27 -0400 Received: from pps.filterd (ppma05wdc.us.ibm.com [127.0.0.1]) by ppma05wdc.us.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 168I68Bv022279; Thu, 8 Jul 2021 18:38:25 GMT Received: from b03cxnp08027.gho.boulder.ibm.com (b03cxnp08027.gho.boulder.ibm.com [9.17.130.19]) by ppma05wdc.us.ibm.com with ESMTP id 39jfhdanxk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 08 Jul 2021 18:38:25 +0000 Received: from b03ledav001.gho.boulder.ibm.com (b03ledav001.gho.boulder.ibm.com [9.17.130.232]) by b03cxnp08027.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 168IcPjZ14221994 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 8 Jul 2021 18:38:25 GMT Received: from b03ledav001.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 0A0B56E050; Thu, 8 Jul 2021 18:38:25 +0000 (GMT) Received: from b03ledav001.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9CC856E053; Thu, 8 Jul 2021 18:38:24 +0000 (GMT) Received: from sbct-3.pok.ibm.com?044watson.ibm.com (unknown [9.47.158.153]) by b03ledav001.gho.boulder.ibm.com (Postfix) with ESMTP; Thu, 8 Jul 2021 18:38:24 +0000 (GMT) From: Stefan Berger To: qemu-devel@nongnu.org, marcandre.lureau@redhat.com Subject: [PATCH v2 6/9] tests: tpm: Create TPM 1.2 response in TPM emulator Date: Thu, 8 Jul 2021 14:38:11 -0400 Message-Id: <20210708183814.925960-7-stefanb@linux.vnet.ibm.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210708183814.925960-1-stefanb@linux.vnet.ibm.com> References: <20210708183814.925960-1-stefanb@linux.vnet.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: J9fSEsjVC-ofACbrIV-u52cn1MK3IuNT X-Proofpoint-GUID: Kf621htaHsXF2d8HcQiDhb9Zp8aUk0rR X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391, 18.0.790 definitions=2021-07-08_10:2021-07-08, 2021-07-08 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 impostorscore=0 mlxlogscore=999 bulkscore=0 spamscore=0 priorityscore=1501 clxscore=1015 phishscore=0 adultscore=0 lowpriorityscore=0 malwarescore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2107080095 Received-SPF: none client-ip=148.163.156.1; envelope-from=stefanb@linux.vnet.ibm.com; helo=mx0a-001b2d01.pphosted.com X-Spam_score_int: -19 X-Spam_score: -2.0 X-Spam_bar: -- X-Spam_report: (-2.0 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Igor Mammedov , Stefan Berger , philmd@redhat.com, Stefan Berger Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Stefan Berger Acked-by: Igor Mammedov --- tests/qtest/tpm-emu.c | 5 +++++ tests/qtest/tpm-emu.h | 3 +++ 2 files changed, 8 insertions(+) diff --git a/tests/qtest/tpm-emu.c b/tests/qtest/tpm-emu.c index 8baf49eafd..32c704194b 100644 --- a/tests/qtest/tpm-emu.c +++ b/tests/qtest/tpm-emu.c @@ -62,6 +62,11 @@ static void *tpm_emu_tpm_thread(void *data) s->tpm_msg->len = cpu_to_be32(sizeof(struct tpm_hdr)); s->tpm_msg->code = cpu_to_be32(TPM_RC_FAILURE); break; + case TPM_VERSION_1_2: + s->tpm_msg->tag = cpu_to_be16(TPM_TAG_RSP_COMMAND); + s->tpm_msg->len = cpu_to_be32(sizeof(struct tpm_hdr)); + s->tpm_msg->code = cpu_to_be32(TPM_FAIL); + break; default: g_debug("unsupport TPM version %u", s->tpm_version); g_assert_not_reached(); diff --git a/tests/qtest/tpm-emu.h b/tests/qtest/tpm-emu.h index f7b1e3c6ab..b5354ea101 100644 --- a/tests/qtest/tpm-emu.h +++ b/tests/qtest/tpm-emu.h @@ -16,6 +16,9 @@ #define TPM_RC_FAILURE 0x101 #define TPM2_ST_NO_SESSIONS 0x8001 +#define TPM_FAIL 9 +#define TPM_TAG_RSP_COMMAND 0xc4 + #include "qemu/sockets.h" #include "io/channel.h" #include "sysemu/tpm.h"