Skip to content

Commit

Permalink
tcti: fix tcti-spi-helper on big endian platforms.
Browse files Browse the repository at this point in the history
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 <slyon@ubuntu.com>
Signed-off-by: Juergen Repp <juergen_repp@web.de>
  • Loading branch information
2 people authored and AndreasFuchsTPM committed Jan 10, 2024
1 parent 13efa42 commit 7465473
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/tss2-tcti/tcti-spi-helper.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
/*
* Copyright 2020 Fraunhofer SIT. All rights reserved.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif

#include <errno.h>
#include <fcntl.h>
#include <inttypes.h>
Expand All @@ -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"

Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 7465473

Please sign in to comment.