Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp3377830rdh; Mon, 27 Nov 2023 12:37:41 -0800 (PST) X-Google-Smtp-Source: AGHT+IFJzNo2J5Irv2srrqivp+HnkLWz79Eh4iZXlUXiFcYhw2iMF78G96TC5gCFlggMWXFvaasa X-Received: by 2002:a17:90b:1b07:b0:285:9d0d:7e3 with SMTP id nu7-20020a17090b1b0700b002859d0d07e3mr12353861pjb.38.1701117461117; Mon, 27 Nov 2023 12:37:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701117461; cv=none; d=google.com; s=arc-20160816; b=N8O2FACgtvrFneW6Lg1Dzm/pifRPpvqLSgTSJmokTA2P3/lFBCVPUhBW9AB0vMbVBQ fwOcgbU6xmmfKJB/mwcQ4bVubyyTDYggarf/lUwDlrVw4LtcMH0ojts96vva+/lgs35K +icyTrWK+xtC2/N/CUOQQlKW8axP5lzYJ3ls0DnE/KqiY2VJYapYr6eH0wsIBb2HVUTy d3fKalfufoKvDWE/+s9Fsa+EQ30fkK1nkpodVgAzmG9tfDRnviu+G6OsW9gLyOG3T21Q CNjh61XJgVLOvljFMoiKnbAFwpNgs5DBn3KTve3gClSL2GIxsEjn/03zA/p2LmGJ4Nsl +T9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=6dZtFtVOkj3v2LtTIxhqkO3S6miBpByv3GzVmhf3YVU=; fh=/Aqzg51eNQmi2L7RUOUlPUcy5/p17/bUqT4vjvE+pNc=; b=DsTa8yiWkSzy3MD7BSxEKx4cNOefPra4+7hUvzEisBjITYIfhZqSPIvf7pblbvvDrd zaKXdNYQHQOrUMHNOlH6/Up1KGu/g3F96klDWs4kDQ12ivHRbaAbjeAaIlT6EV1nOPQR eQ47UPqrq6wTsb8YIJw1CSebtlojxunO6kaVgzXrPzaf85pYcsoJOIzd95tewhO3AJZI goXFhMw+EIyvPuXYdp0ye2zcur1gA+WFV4DBzgTkjk/8OMt770rBXXEzXT5i+etfK0XS lB/tlk1QT3VP2tDikxpP2rszsyxD0VwXfEeH8DTf3prU88TbKAkqrmxkhiclmmrJ8k8i je0g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=EMzB+O+x; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id jx4-20020a17090b46c400b002839e721d0dsi10420218pjb.77.2023.11.27.12.37.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Nov 2023 12:37:41 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=EMzB+O+x; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 7843F809F8B7; Mon, 27 Nov 2023 12:37:38 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233109AbjK0UhS (ORCPT + 99 others); Mon, 27 Nov 2023 15:37:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49470 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232022AbjK0UhQ (ORCPT ); Mon, 27 Nov 2023 15:37:16 -0500 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 358D093; Mon, 27 Nov 2023 12:37:23 -0800 (PST) Received: from pps.filterd (m0353727.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3ARK7glu015570; Mon, 27 Nov 2023 20:37:19 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=message-id : date : mime-version : subject : to : cc : references : from : in-reply-to : content-type : content-transfer-encoding; s=pp1; bh=6dZtFtVOkj3v2LtTIxhqkO3S6miBpByv3GzVmhf3YVU=; b=EMzB+O+xdsCcRuauPeT9AyRkRBnKlC2X82T+yzMymmXZsR22zWHopFIxqUsty64ex5QH jTrGgb1mDT/3NouBnfIDRqi5DtXbJ2Qe7vVQZcpKrddke9U5JAxC1k4gRqHGX2xpeMTL Cc89fvZMYw8NEOXC58rLOtLnOeqAi5uMulKP2MZoc/SX/eAcropvYeoP6aw7SfNJ1mWz NqoKrUr4GGa53PIXxy+22sWAHsk2/H6YgLkbYJ9FkFRO8YBU5OvT6Fz0WZHeqG3tck56 h2zPGLSNCZpt/cXd847+tX153lRHb+tiyy/hbIUca5PJg60msGjWR7Vn0KsPVFT6UJFt 8A== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3un1v80u17-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 27 Nov 2023 20:37:19 +0000 Received: from m0353727.ppops.net (m0353727.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 3ARK9f8k023274; Mon, 27 Nov 2023 20:37:19 GMT Received: from ppma21.wdc07v.mail.ibm.com (5b.69.3da9.ip4.static.sl-reverse.com [169.61.105.91]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3un1v80u0b-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 27 Nov 2023 20:37:18 +0000 Received: from pps.filterd (ppma21.wdc07v.mail.ibm.com [127.0.0.1]) by ppma21.wdc07v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 3ARJP6YP009565; Mon, 27 Nov 2023 20:37:17 GMT Received: from smtprelay01.wdc07v.mail.ibm.com ([172.16.1.68]) by ppma21.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3ukv8nb792-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 27 Nov 2023 20:37:17 +0000 Received: from smtpav04.wdc07v.mail.ibm.com (smtpav04.wdc07v.mail.ibm.com [10.39.53.231]) by smtprelay01.wdc07v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 3ARKbHv354395314 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 27 Nov 2023 20:37:17 GMT Received: from smtpav04.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2122658056; Mon, 27 Nov 2023 20:37:17 +0000 (GMT) Received: from smtpav04.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2C7E758045; Mon, 27 Nov 2023 20:37:16 +0000 (GMT) Received: from [9.47.158.152] (unknown [9.47.158.152]) by smtpav04.wdc07v.mail.ibm.com (Postfix) with ESMTP; Mon, 27 Nov 2023 20:37:16 +0000 (GMT) Message-ID: <3d900dea-5636-4773-9344-61315c5b7fad@linux.ibm.com> Date: Mon, 27 Nov 2023 15:37:15 -0500 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v6 2/8] tpm: Remove tpm_send() Content-Language: en-US To: Jarkko Sakkinen , linux-integrity@vger.kernel.org Cc: linux-kernel@vger.kernel.org, James Bottomley , William Roberts , David Howells , Jason Gunthorpe , Mimi Zohar , Mario Limonciello , Jerry Snitselaar References: <20231124020237.27116-1-jarkko@kernel.org> <20231124020237.27116-3-jarkko@kernel.org> From: Stefan Berger In-Reply-To: <20231124020237.27116-3-jarkko@kernel.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: _7OXSbSCHb5aBMPFkG3U_4ExYfix84jP X-Proofpoint-GUID: xQe8XJ6xrRmmOZeStl5d_tBviX9DRtlf X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.987,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-11-27_19,2023-11-27_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 malwarescore=0 adultscore=0 mlxscore=0 spamscore=0 mlxlogscore=999 phishscore=0 bulkscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311060000 definitions=main-2311270143 X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Mon, 27 Nov 2023 12:37:38 -0800 (PST) On 11/23/23 21:02, Jarkko Sakkinen wrote: > Open code the last remaining call site for tpm_send(). > > Signed-off-by: Jarkko Sakkinen Reviewed-by: Stefan Berger > --- > v1 [2023-11-21]: A new patch. > --- > drivers/char/tpm/tpm-interface.c | 25 ----------------------- > include/linux/tpm.h | 5 ----- > security/keys/trusted-keys/trusted_tpm1.c | 14 +++++++++++-- > 3 files changed, 12 insertions(+), 32 deletions(-) > > diff --git a/drivers/char/tpm/tpm-interface.c b/drivers/char/tpm/tpm-interface.c > index 66b16d26eecc..163ae247bff2 100644 > --- a/drivers/char/tpm/tpm-interface.c > +++ b/drivers/char/tpm/tpm-interface.c > @@ -342,31 +342,6 @@ int tpm_pcr_extend(struct tpm_chip *chip, u32 pcr_idx, > } > EXPORT_SYMBOL_GPL(tpm_pcr_extend); > > -/** > - * tpm_send - send a TPM command > - * @chip: a &struct tpm_chip instance, %NULL for the default chip > - * @cmd: a TPM command buffer > - * @buflen: the length of the TPM command buffer > - * > - * Return: same as with tpm_transmit_cmd() > - */ > -int tpm_send(struct tpm_chip *chip, void *cmd, size_t buflen) > -{ > - struct tpm_buf buf; > - int rc; > - > - chip = tpm_find_get_ops(chip); > - if (!chip) > - return -ENODEV; > - > - buf.data = cmd; > - rc = tpm_transmit_cmd(chip, &buf, 0, "attempting to a send a command"); > - > - tpm_put_ops(chip); > - return rc; > -} > -EXPORT_SYMBOL_GPL(tpm_send); > - > int tpm_auto_startup(struct tpm_chip *chip) > { > int rc; > diff --git a/include/linux/tpm.h b/include/linux/tpm.h > index 6588ca87cf93..d9d645e9c52c 100644 > --- a/include/linux/tpm.h > +++ b/include/linux/tpm.h > @@ -422,7 +422,6 @@ extern int tpm_pcr_read(struct tpm_chip *chip, u32 pcr_idx, > struct tpm_digest *digest); > extern int tpm_pcr_extend(struct tpm_chip *chip, u32 pcr_idx, > struct tpm_digest *digests); > -extern int tpm_send(struct tpm_chip *chip, void *cmd, size_t buflen); > extern int tpm_get_random(struct tpm_chip *chip, u8 *data, size_t max); > extern struct tpm_chip *tpm_default_chip(void); > void tpm2_flush_context(struct tpm_chip *chip, u32 handle); > @@ -443,10 +442,6 @@ static inline int tpm_pcr_extend(struct tpm_chip *chip, u32 pcr_idx, > return -ENODEV; > } > > -static inline int tpm_send(struct tpm_chip *chip, void *cmd, size_t buflen) > -{ > - return -ENODEV; > -} > static inline int tpm_get_random(struct tpm_chip *chip, u8 *data, size_t max) > { > return -ENODEV; > diff --git a/security/keys/trusted-keys/trusted_tpm1.c b/security/keys/trusted-keys/trusted_tpm1.c > index aa108bea6739..37bce84eef99 100644 > --- a/security/keys/trusted-keys/trusted_tpm1.c > +++ b/security/keys/trusted-keys/trusted_tpm1.c > @@ -356,17 +356,27 @@ static int TSS_checkhmac2(unsigned char *buffer, > */ > int trusted_tpm_send(unsigned char *cmd, size_t buflen) > { > + struct tpm_buf buf; > int rc; > > if (!chip) > return -ENODEV; > > + rc = tpm_try_get_ops(chip); > + if (rc) > + return rc; > + > + buf.flags = 0; > + buf.data = cmd; > dump_tpm_buf(cmd); > - rc = tpm_send(chip, cmd, buflen); > + rc = tpm_transmit_cmd(chip, &buf, 4, "sending data"); > dump_tpm_buf(cmd); > + > if (rc > 0) > - /* Can't return positive return codes values to keyctl */ > + /* TPM error */ > rc = -EPERM; > + > + tpm_put_ops(chip); > return rc; > } > EXPORT_SYMBOL_GPL(trusted_tpm_send);