From f873f170ea1c8413450e8080b1e5ca7dc450f465 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lukas=20M=C3=A4rdian?= Date: Tue, 22 Aug 2023 13:02:25 +0200 Subject: [PATCH] tcti-spi-helper: uint32_t is conversion to a void* buffer fails on big endian We need to convert it back to the correct endianess. https://github.com/tpm2-software/tpm2-tss/issues/2531 --- src/tss2-tcti/tcti-spi-helper.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/tss2-tcti/tcti-spi-helper.c b/src/tss2-tcti/tcti-spi-helper.c index 515a53639..2d914894c 100644 --- a/src/tss2-tcti/tcti-spi-helper.c +++ b/src/tss2-tcti/tcti-spi-helper.c @@ -2,6 +2,8 @@ /* * Copyright 2020 Fraunhofer SIT. All rights reserved. */ +#define _BSD_SOURCE +#include #include #include #include @@ -312,7 +314,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 le32toh(status); } static void spi_tpm_helper_write_sts_reg(TSS2_TCTI_SPI_HELPER_CONTEXT* ctx, uint32_t status)