Skip to content

Commit 1c07a99

Browse files
committed
libwolfboot: fix encrypted test-app builds
1 parent 6ffae1a commit 1c07a99

1 file changed

Lines changed: 13 additions & 11 deletions

File tree

src/libwolfboot.c

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,19 @@
6262

6363
#include <stddef.h> /* for size_t */
6464

65+
#ifdef EXT_ENCRYPTED
66+
static int encrypt_key_is_erased(const uint8_t *key, uint32_t len)
67+
{
68+
uint8_t diff = 0;
69+
uint32_t i;
70+
71+
for (i = 0; i < len; i++)
72+
diff |= key[i] ^ FLASH_BYTE_ERASED;
73+
74+
return diff == 0;
75+
}
76+
#endif
77+
6578
#if defined(EXT_ENCRYPTED) && (defined(__WOLFBOOT) || defined(UNIT_TEST) || defined(MMU))
6679
#include "encrypt.h"
6780
static int encrypt_initialized = 0;
@@ -84,17 +97,6 @@ static int encrypt_key_is_valid(const uint8_t *key, uint32_t len)
8497
return (has_one != 0) && (has_zero != 0);
8598
}
8699

87-
static int encrypt_key_is_erased(const uint8_t *key, uint32_t len)
88-
{
89-
uint8_t diff = 0;
90-
uint32_t i;
91-
92-
for (i = 0; i < len; i++)
93-
diff |= key[i] ^ FLASH_BYTE_ERASED;
94-
95-
return diff == 0;
96-
}
97-
98100
#define FALLBACK_IV_OFFSET 0x00100000U
99101
#if !defined(XMEMSET)
100102
#include <string.h>

0 commit comments

Comments
 (0)