Skip to content

Commit

Permalink
tcti-spi-helper: uint32_t is conversion to a void* buffer fails on bi…
Browse files Browse the repository at this point in the history
…g endian

We need to convert it back to the correct endianess.
tpm2-software#2531

Signed-off-by: Lukas Märdian <slyon@ubuntu.com>
  • Loading branch information
slyon committed Aug 22, 2023
1 parent b7bad34 commit a59da58
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 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,8 @@
/*
* Copyright 2020 Fraunhofer SIT. All rights reserved.
*/
#define _BSD_SOURCE
#include <endian.h>
#include <errno.h>
#include <fcntl.h>
#include <inttypes.h>
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit a59da58

Please sign in to comment.