Skip to content

Commit 73fc193

Browse files
dgarskedanielinux
authored andcommitted
Portability fixes with include < vs ". Added NO_SWAP_EXT to allow support for onboard flash swap sector. Added WOLFSSL_NO_CT_OPS for ECDSA verify only. Added WC_NO_DEFAULT_DEVID to help with code size reduction.
1 parent 8441969 commit 73fc193

File tree

5 files changed

+29
-26
lines changed

5 files changed

+29
-26
lines changed

include/encrypt.h

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -27,25 +27,19 @@
2727
#if defined(__WOLFBOOT) || defined(UNIT_TEST)
2828

2929
#include <stdint.h>
30-
#include <wolfssl/wolfcrypt/settings.h>
31-
#include <wolfssl/wolfcrypt/sha256.h>
30+
#include "wolfssl/wolfcrypt/settings.h"
31+
#include "wolfssl/wolfcrypt/sha256.h"
3232

3333
#include "target.h"
3434
#include "wolfboot/wolfboot.h"
3535

3636
#ifdef ENCRYPT_WITH_CHACHA
37-
#include <wolfssl/wolfcrypt/chacha.h>
37+
#include "wolfssl/wolfcrypt/chacha.h"
3838
#else
39-
#include <wolfssl/wolfcrypt/aes.h>
40-
#endif
41-
#ifdef WOLF_CRYPTO_CB
42-
#include <wolfssl/wolfcrypt/cryptocb.h>
43-
#endif
44-
#ifdef WOLFSSL_RENESAS_TSIP
45-
#include <wolfssl/wolfcrypt/port/Renesas/renesas-tsip-crypt.h>
39+
#include "wolfssl/wolfcrypt/aes.h"
4640
#endif
4741

48-
#include <wolfssl/wolfcrypt/pwdbased.h>
42+
#include "wolfssl/wolfcrypt/pwdbased.h"
4943

5044
#ifdef ENCRYPT_WITH_CHACHA
5145

include/user_settings.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,12 +113,12 @@ extern int tolower(int c);
113113
# define FREESCALE_LTC_TFM
114114
# endif
115115

116-
117116
/* Some ECC options are disabled to reduce size */
118117
# if !defined(WOLFCRYPT_SECURE_MODE)
119118
# if !defined(WOLFBOOT_TPM)
120119
# define NO_ECC_SIGN
121120
# define NO_ECC_DHE
121+
# define WOLFSSL_NO_CT_OPS /* don't use constant time ops in misc.c */
122122
# if !defined(WOLFBOOT_ENABLE_WOLFHSM_CLIENT)
123123
# define NO_ECC_EXPORT
124124
# define NO_ECC_KEY_EXPORT
@@ -502,6 +502,7 @@ extern int tolower(int c);
502502
#define WOLF_CRYPTO_CB_ONLY_RSA
503503
#define WOLFSSL_NO_SW_MATH
504504
#define MAX_CRYPTO_DEVID_CALLBACKS 2
505+
#define WC_NO_DEFAULT_DEVID
505506
#define WOLFSSL_AES_SMALL_TABLES
506507

507508
#ifdef WOLFBOOT_RENESAS_TSIP

include/wolfboot/wolfboot.h

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -162,12 +162,22 @@ extern "C" {
162162

163163
#if defined(__WOLFBOOT) || defined(UNIT_TEST_AUTH)
164164

165+
#include "wolfssl/wolfcrypt/settings.h"
166+
#include "wolfssl/wolfcrypt/visibility.h"
167+
#include "wolfssl/wolfcrypt/wc_port.h"
168+
#include "wolfssl/wolfcrypt/types.h"
169+
170+
#ifdef WOLFBOOT_RENESAS_TSIP
171+
/* Include these before any algorithm headers */
172+
#include "mcu/all/r_bsp_common.h"
173+
#include "r_bsp_config.h"
174+
#include "r_tsip_rx_if.h"
175+
#include "wolfssl/wolfcrypt/port/Renesas/renesas_tsip_types.h"
176+
#endif
177+
178+
165179
/* Hashing configuration */
166180
#if defined(WOLFBOOT_HASH_SHA256)
167-
#include "wolfssl/wolfcrypt/settings.h"
168-
#include "wolfssl/wolfcrypt/visibility.h"
169-
#include "wolfssl/wolfcrypt/wc_port.h"
170-
#include "wolfssl/wolfcrypt/types.h"
171181
#include "wolfssl/wolfcrypt/sha256.h"
172182
# ifndef WOLFBOOT_SHA_BLOCK_SIZE
173183
# define WOLFBOOT_SHA_BLOCK_SIZE (256)
@@ -183,10 +193,6 @@ extern "C" {
183193
typedef wc_Sha256 wolfBoot_hash_t;
184194
# define HDR_HASH HDR_SHA256
185195
#elif defined(WOLFBOOT_HASH_SHA384)
186-
#include "wolfssl/wolfcrypt/settings.h"
187-
#include "wolfssl/wolfcrypt/visibility.h"
188-
#include "wolfssl/wolfcrypt/wc_port.h"
189-
#include "wolfssl/wolfcrypt/types.h"
190196
#include "wolfssl/wolfcrypt/sha512.h"
191197
# ifndef WOLFBOOT_SHA_BLOCK_SIZE
192198
# define WOLFBOOT_SHA_BLOCK_SIZE (256)
@@ -202,10 +208,6 @@ extern "C" {
202208
typedef wc_Sha384 wolfBoot_hash_t;
203209
# define HDR_HASH HDR_SHA384
204210
#elif defined(WOLFBOOT_HASH_SHA3_384)
205-
#include "wolfssl/wolfcrypt/settings.h"
206-
#include "wolfssl/wolfcrypt/visibility.h"
207-
#include "wolfssl/wolfcrypt/wc_port.h"
208-
#include "wolfssl/wolfcrypt/types.h"
209211
#include "wolfssl/wolfcrypt/sha3.h"
210212
# ifndef WOLFBOOT_SHA_BLOCK_SIZE
211213
# define WOLFBOOT_SHA_BLOCK_SIZE (256)
@@ -235,7 +237,8 @@ extern "C" {
235237

236238
#endif
237239

238-
#if defined(__WOLFBOOT) || defined (__FLASH_OTP_PRIMER) || defined (UNIT_TEST_AUTH) || defined(WOLFBOOT_TPM)
240+
#if defined(__WOLFBOOT) || defined (__FLASH_OTP_PRIMER) || \
241+
defined (UNIT_TEST_AUTH) || defined(WOLFBOOT_TPM)
239242

240243
/* Authentication configuration */
241244
#if defined(WOLFBOOT_NO_SIGN)

options.mk

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -549,7 +549,10 @@ ifeq ($(ENCRYPT),1)
549549
endif
550550

551551
ifeq ($(EXT_FLASH),1)
552-
CFLAGS+= -D"EXT_FLASH=1" -D"PART_UPDATE_EXT=1" -D"PART_SWAP_EXT=1"
552+
CFLAGS+= -D"EXT_FLASH=1" -D"PART_UPDATE_EXT=1"
553+
ifeq ($(NO_SWAP_EXT),)
554+
CFLAGS+= -D"PART_SWAP_EXT=1"
555+
endif
553556
ifeq ($(NO_XIP),1)
554557
CFLAGS+=-D"PART_BOOT_EXT=1"
555558
endif

src/libwolfboot.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1555,6 +1555,8 @@ int RAMFUNCTION chacha_init(void)
15551555
Aes aes_dec, aes_enc;
15561556

15571557
#if defined(WOLFBOOT_RENESAS_TSIP)
1558+
#include "wolfssl/wolfcrypt/port/Renesas/renesas-tsip-crypt.h"
1559+
15581560
/* Provides wrap_enc_key_t structure generated using
15591561
* Renesas Security Key Management Tool. See docs/Renesas.md */
15601562
#include "enckey_data.h"

0 commit comments

Comments
 (0)