Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp4998449imm; Tue, 18 Sep 2018 02:40:38 -0700 (PDT) X-Google-Smtp-Source: ANB0Vdai/+nsfrVhHN0ZmYTzpkAhmZD/mrvzrfjwxqfmNu66YyNfimOzn2++spWwH1lkdI4XinY/ X-Received: by 2002:a62:89d8:: with SMTP id n85-v6mr29861370pfk.83.1537263638560; Tue, 18 Sep 2018 02:40:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537263638; cv=none; d=google.com; s=arc-20160816; b=fM4Uk5Gb6imbl/fVcVuqmUrRUslZG80dVVxUv2I+ua+BTSh9zY0B4bxuQTFviC8w7q 0N/6wUhg2PFYRdJDIIP2XapSGpmDA+OTkOlX4YREWSlUzg2cxrYO0ysajknu8ddlN9/5 U63GOP0hnPgCqHZbo9khf2z4Le6LnftuuEf2diKvXh8Khv+ZH5YDIca/peMwH3YL/fyL /p0XypHTXoCgFIiNrYnwAFrST1+71JF/rtrc1Lun1Kd+jjWTeqJmvRxYYCu/ctBXDatj VjVIdCQ84kCWzbWkv+fSpdFdk9HSa2g2KG9IPdCt/n4eHsF6f/8Mtxo/QBiEAWOyfIXR wP1A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=cRv4Fe0vSX7lP9X1pEJYOSvlCLuic+clv7ia81CjVcI=; b=WtRR6ZP6lHMHA9p+Deq0c7u1AhE6ksP4xtQJ+lxUFqFQkdU1y0mgQ8yuab/YWgQQx1 ZwJQoBWHphbzxAkWPKGjaUJsHe0Rwp1qClo1hXLt/5iJzpbN3XQqzYHOkXQalmVnAPJ5 /80eIUUm5ONdSU/mVhC//l4ud2MYQX3WdiYXlhREvu71vjOQkOF7ILdLIPm12eneAXmA VkqKOanNOXsmGJunwQYuB9ZJhSgeZoj2ZzNd2a+acMHU1WiLcOGkTj3SRYc2iJDaSZfI vQSjTEN646360KCPFJLPTl07mBcS3+0nRQHlx7aUVRllmVANGt1di3OeExt0sAnfTfA2 mSYA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v8-v6si17751265pga.487.2018.09.18.02.40.23; Tue, 18 Sep 2018 02:40:38 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729989AbeIRPKb (ORCPT + 99 others); Tue, 18 Sep 2018 11:10:31 -0400 Received: from mga01.intel.com ([192.55.52.88]:59400 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729669AbeIRPK3 (ORCPT ); Tue, 18 Sep 2018 11:10:29 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 18 Sep 2018 02:38:42 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.53,389,1531810800"; d="scan'208";a="71724221" Received: from twinkler-lnx.jer.intel.com ([10.12.91.48]) by fmsmga008.fm.intel.com with ESMTP; 18 Sep 2018 02:38:40 -0700 From: Tomas Winkler To: Jarkko Sakkinen , Jason Gunthorpe Cc: Alexander Usyskin , Tadeusz Struk , linux-integrity@vger.kernel.org, linux-security-module@vger.kernel.org, linux-kernel@vger.kernel.org, Tomas Winkler Subject: [PATCH v3 20/20] tpm1: reimplement tpm1_continue_selftest() using tpm_buf Date: Tue, 18 Sep 2018 12:34:59 +0300 Message-Id: <20180918093459.19165-21-tomas.winkler@intel.com> X-Mailer: git-send-email 2.14.4 In-Reply-To: <20180918093459.19165-1-tomas.winkler@intel.com> References: <20180918093459.19165-1-tomas.winkler@intel.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Reimplement tpm1_continue_selftest() using tpm_buf structure. This is the last command using the old tpm_cmd_t structure and now the structure can be removed. Signed-off-by: Tomas Winkler --- V3: new in the series drivers/char/tpm/tpm.h | 9 --------- drivers/char/tpm/tpm1-cmd.c | 16 ++++++++-------- 2 files changed, 8 insertions(+), 17 deletions(-) diff --git a/drivers/char/tpm/tpm.h b/drivers/char/tpm/tpm.h index dbbfb7118c31..5d018f61b812 100644 --- a/drivers/char/tpm/tpm.h +++ b/drivers/char/tpm/tpm.h @@ -377,15 +377,6 @@ enum tpm_sub_capabilities { TPM_CAP_PROP_TIS_DURATION = 0x120, }; -typedef union { - struct tpm_input_header in; - struct tpm_output_header out; -} tpm_cmd_header; - -struct tpm_cmd_t { - tpm_cmd_header header; -} __packed; - /* 128 bytes is an arbitrary cap. This could be as large as TPM_BUFSIZE - 18 * bytes, but 128 is still a relatively large number of random bytes and diff --git a/drivers/char/tpm/tpm1-cmd.c b/drivers/char/tpm/tpm1-cmd.c index c4a0bacb1378..f30d2801c2e0 100644 --- a/drivers/char/tpm/tpm1-cmd.c +++ b/drivers/char/tpm/tpm1-cmd.c @@ -604,11 +604,6 @@ int tpm1_pcr_read(struct tpm_chip *chip, u32 pcr_idx, u8 *res_buf) #define TPM_ORD_CONTINUE_SELFTEST 83 #define CONTINUE_SELFTEST_RESULT_SIZE 10 -static const struct tpm_input_header continue_selftest_header = { - .tag = cpu_to_be16(TPM_TAG_RQU_COMMAND), - .length = cpu_to_be32(10), - .ordinal = cpu_to_be32(TPM_ORD_CONTINUE_SELFTEST), -}; /** * tpm_continue_selftest -- run TPM's selftest @@ -619,12 +614,17 @@ static const struct tpm_input_header continue_selftest_header = { */ static int tpm1_continue_selftest(struct tpm_chip *chip) { + struct tpm_buf buf; int rc; - struct tpm_cmd_t cmd; - cmd.header.in = continue_selftest_header; - rc = tpm_transmit_cmd(chip, NULL, &cmd, CONTINUE_SELFTEST_RESULT_SIZE, + rc = tpm_buf_init(&buf, TPM_TAG_RQU_COMMAND, TPM_ORD_CONTINUE_SELFTEST); + if (rc) + return rc; + rc = tpm_transmit_cmd(chip, NULL, &buf.data, PAGE_SIZE, 0, 0, "continue selftest"); + + tpm_buf_destroy(&buf); + return rc; } -- 2.14.4