Skip to content

Commit 2f05d44

Browse files
committed
Fixed SPI defines, fix TPM SHA alignment in header
1 parent 5779baa commit 2f05d44

4 files changed

Lines changed: 5 additions & 7 deletions

File tree

hal/spi/spi_drv_stm32.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ void spi_init(int polarity, int phase)
156156
APB2_CLOCK_ER |= SPI1_APB2_CLOCK_ER_VAL;
157157
spi1_reset();
158158
SPI1_CR1 = SPI_CR1_MASTER | (5 << 3) | (polarity << 1) | (phase << 0);
159-
SPI1_CR2 |= SPI_CR2_SSOE;
159+
SPI1_CR2 = SPI_CR2_SSOE | (0x07 << 8);
160160
SPI1_CR1 |= SPI_CR1_SPI_EN;
161161
}
162162
}

hal/spi/spi_drv_stm32.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,7 @@
2323
#define GPIOD_BASE (0x40020C00)
2424
#define GPIOE_BASE (0x40021000)
2525
#define SPI_GPIO GPIOB_BASE
26-
#define SPI_CS_GPIO GPIOB_BASE
27-
#define SPI_PIO_BASE GPIOB_BASE
28-
#define SPI_CS_PIO_BASE GPIOE_BASE
26+
#define SPI_CS_GPIO GPIOE_BASE
2927
#define SPI_CS_FLASH 1 /* Flash CS connected to GPIOE1 */
3028
#define SPI_CS_TPM 0 /* TPM CS connected to GPIOE0 */
3129
#define SPI1_PIN_AF 5 /* Alternate function for SPI pins */

lib/wolfssl

Submodule wolfssl updated 191 files

src/image.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ static int image_hash(struct wolfBoot_image *img, uint8_t *hashBuf)
346346
{
347347
const char gUsageAuth[]="wolfBoot TPM Usage Auth";
348348
uint8_t *stored_sha, *end_sha;
349-
uint8_t stored_sha_len;
349+
uint16_t stored_sha_len;
350350
uint8_t *p;
351351
int blksz;
352352
uint32_t position = 0;
@@ -364,7 +364,7 @@ static int image_hash(struct wolfBoot_image *img, uint8_t *hashBuf)
364364
(const byte*)gUsageAuth, sizeof(gUsageAuth)-1);
365365
if (rc != 0)
366366
return -1;
367-
end_sha = stored_sha - 2;
367+
end_sha = stored_sha - 4;
368368
while (p < end_sha) {
369369
blksz = SHA256_BLOCK_SIZE;
370370
if (end_sha - p < blksz)

0 commit comments

Comments
 (0)