lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220407111849.5676-5-LinoSanfilippo@gmx.de>
Date:   Thu,  7 Apr 2022 13:18:48 +0200
From:   Lino Sanfilippo <LinoSanfilippo@....de>
To:     peterhuewe@....de, jarkko@...nel.org, jgg@...pe.ca,
        =robh+dt@...nel.org
Cc:     devicetree@...r.kernel.org, linux-integrity@...r.kernel.org,
        linux-kernel@...r.kernel.org, stefanb@...ux.ibm.com,
        p.rosenberger@...bus.com, lukas@...ner.de,
        Lino Sanfilippo <LinoSanfilippo@....de>
Subject: [PATCH 4/5] tpm: tpm_tis: make functions available for external linkage

The tpm_tis_phy_ops functions tpm_tis_spi_read16, tpm_tis_spi_read32 and
tpm_tis_spi_write32 are already declared extern to be used outside of
tpm_tim_spi_main.c.

Do the same with tpm_tis_spi_read_bytes and tpm_tis_spi_write_bytes to
allow the external access to the complete set of tpm_tis_phy_ops.

This is in preparation of the assignment of SLB9670 specific phy ops in a
separate file.

Furthermore declare tpm_tis_spi_flow_control extern, so that we can use it
in a SLB9670 specific probe function in the same file.

Signed-off-by: Lino Sanfilippo <LinoSanfilippo@....de>
---
 drivers/char/tpm/tpm_tis_spi.h      |  7 +++++++
 drivers/char/tpm/tpm_tis_spi_main.c | 12 ++++++------
 2 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/drivers/char/tpm/tpm_tis_spi.h b/drivers/char/tpm/tpm_tis_spi.h
index bba73979c368..8f4331d8a4dd 100644
--- a/drivers/char/tpm/tpm_tis_spi.h
+++ b/drivers/char/tpm/tpm_tis_spi.h
@@ -25,6 +25,9 @@ static inline struct tpm_tis_spi_phy *to_tpm_tis_spi_phy(struct tpm_tis_data *da
 	return container_of(data, struct tpm_tis_spi_phy, priv);
 }
 
+extern int tpm_tis_spi_flow_control(struct tpm_tis_spi_phy *phy,
+				    struct spi_transfer *spi_xfer);
+
 extern int tpm_tis_spi_init(struct spi_device *spi, struct tpm_tis_spi_phy *phy,
 			    int irq, const struct tpm_tis_phy_ops *phy_ops);
 
@@ -34,6 +37,10 @@ extern int tpm_tis_spi_transfer(struct tpm_tis_data *data, u32 addr, u16 len,
 extern int tpm_tis_spi_read16(struct tpm_tis_data *data, u32 addr, u16 *result);
 extern int tpm_tis_spi_read32(struct tpm_tis_data *data, u32 addr, u32 *result);
 extern int tpm_tis_spi_write32(struct tpm_tis_data *data, u32 addr, u32 value);
+extern int tpm_tis_spi_read_bytes(struct tpm_tis_data *data, u32 addr, u16 len,
+				  u8 *result);
+extern int tpm_tis_spi_write_bytes(struct tpm_tis_data *data, u32 addr, u16 len,
+				   const u8 *value);
 
 #ifdef CONFIG_TCG_TIS_SPI_CR50
 extern int cr50_spi_probe(struct spi_device *spi);
diff --git a/drivers/char/tpm/tpm_tis_spi_main.c b/drivers/char/tpm/tpm_tis_spi_main.c
index 184396b3af50..b2d13b844659 100644
--- a/drivers/char/tpm/tpm_tis_spi_main.c
+++ b/drivers/char/tpm/tpm_tis_spi_main.c
@@ -45,8 +45,8 @@
  *
  * [1] https://trustedcomputinggroup.org/resource/pc-client-platform-tpm-profile-ptp-specification/
  */
-static int tpm_tis_spi_flow_control(struct tpm_tis_spi_phy *phy,
-				    struct spi_transfer *spi_xfer)
+int tpm_tis_spi_flow_control(struct tpm_tis_spi_phy *phy,
+			     struct spi_transfer *spi_xfer)
 {
 	struct spi_message m;
 	int ret, i;
@@ -140,14 +140,14 @@ int tpm_tis_spi_transfer(struct tpm_tis_data *data, u32 addr, u16 len,
 	return ret;
 }
 
-static int tpm_tis_spi_read_bytes(struct tpm_tis_data *data, u32 addr,
-				  u16 len, u8 *result)
+int tpm_tis_spi_read_bytes(struct tpm_tis_data *data, u32 addr, u16 len,
+			   u8 *result)
 {
 	return tpm_tis_spi_transfer(data, addr, len, result, NULL);
 }
 
-static int tpm_tis_spi_write_bytes(struct tpm_tis_data *data, u32 addr,
-				   u16 len, const u8 *value)
+int tpm_tis_spi_write_bytes(struct tpm_tis_data *data, u32 addr, u16 len,
+			    const u8 *value)
 {
 	return tpm_tis_spi_transfer(data, addr, len, NULL, value);
 }
-- 
2.35.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ