From 7465473fa9addd547b1c8fd38fd0b266760c16c0 Mon Sep 17 00:00:00 2001 From: Juergen Repp Date: Thu, 9 Nov 2023 12:16:13 +0100 Subject: [PATCH] tcti: fix tcti-spi-helper on big endian platforms. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Based on #2686 In the function spi_tpm_helper_read_sts_reg the result is converted back to the correct endianess. Addresses #2531 Co-authored-by: Lukas Märdian Signed-off-by: Juergen Repp --- src/tss2-tcti/tcti-spi-helper.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/tss2-tcti/tcti-spi-helper.c b/src/tss2-tcti/tcti-spi-helper.c index d2fda8ec0..b7d058243 100644 --- a/src/tss2-tcti/tcti-spi-helper.c +++ b/src/tss2-tcti/tcti-spi-helper.c @@ -2,6 +2,10 @@ /* * Copyright 2020 Fraunhofer SIT. All rights reserved. */ +#ifdef HAVE_CONFIG_H +#include +#endif + #include #include #include @@ -18,6 +22,7 @@ #include "tss2_mu.h" #include "tcti-common.h" #include "tcti-spi-helper.h" +#include "util/tss2_endian.h" #define LOGMODULE tcti #include "util/log.h" @@ -313,7 +318,7 @@ static uint32_t spi_tpm_helper_read_sts_reg(TSS2_TCTI_SPI_HELPER_CONTEXT* ctx) { uint32_t status = 0; spi_tpm_helper_read_reg(ctx, TCTI_SPI_HELPER_TPM_STS_REG, &status, sizeof(status)); - return status; + return LE_TO_HOST_32(status); } static void spi_tpm_helper_write_sts_reg(TSS2_TCTI_SPI_HELPER_CONTEXT* ctx, uint32_t status)