Skip to content

Commit eed01dc

Browse files
committed
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 06eac35 commit eed01dc

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
@@ -161,12 +161,22 @@ extern "C" {
161161

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

164+
#include "wolfssl/wolfcrypt/settings.h"
165+
#include "wolfssl/wolfcrypt/visibility.h"
166+
#include "wolfssl/wolfcrypt/wc_port.h"
167+
#include "wolfssl/wolfcrypt/types.h"
168+
169+
#ifdef WOLFBOOT_RENESAS_TSIP
170+
/* Include these before any algorithm headers */
171+
#include "mcu/all/r_bsp_common.h"
172+
#include "r_bsp_config.h"
173+
#include "r_tsip_rx_if.h"
174+
#include "wolfssl/wolfcrypt/port/Renesas/renesas_tsip_types.h"
175+
#endif
176+
177+
164178
/* Hashing configuration */
165179
#if defined(WOLFBOOT_HASH_SHA256)
166-
#include "wolfssl/wolfcrypt/settings.h"
167-
#include "wolfssl/wolfcrypt/visibility.h"
168-
#include "wolfssl/wolfcrypt/wc_port.h"
169-
#include "wolfssl/wolfcrypt/types.h"
170180
#include "wolfssl/wolfcrypt/sha256.h"
171181
# ifndef WOLFBOOT_SHA_BLOCK_SIZE
172182
# define WOLFBOOT_SHA_BLOCK_SIZE (256)
@@ -182,10 +192,6 @@ extern "C" {
182192
typedef wc_Sha256 wolfBoot_hash_t;
183193
# define HDR_HASH HDR_SHA256
184194
#elif defined(WOLFBOOT_HASH_SHA384)
185-
#include "wolfssl/wolfcrypt/settings.h"
186-
#include "wolfssl/wolfcrypt/visibility.h"
187-
#include "wolfssl/wolfcrypt/wc_port.h"
188-
#include "wolfssl/wolfcrypt/types.h"
189195
#include "wolfssl/wolfcrypt/sha512.h"
190196
# ifndef WOLFBOOT_SHA_BLOCK_SIZE
191197
# define WOLFBOOT_SHA_BLOCK_SIZE (256)
@@ -201,10 +207,6 @@ extern "C" {
201207
typedef wc_Sha384 wolfBoot_hash_t;
202208
# define HDR_HASH HDR_SHA384
203209
#elif defined(WOLFBOOT_HASH_SHA3_384)
204-
#include "wolfssl/wolfcrypt/settings.h"
205-
#include "wolfssl/wolfcrypt/visibility.h"
206-
#include "wolfssl/wolfcrypt/wc_port.h"
207-
#include "wolfssl/wolfcrypt/types.h"
208210
#include "wolfssl/wolfcrypt/sha3.h"
209211
# ifndef WOLFBOOT_SHA_BLOCK_SIZE
210212
# define WOLFBOOT_SHA_BLOCK_SIZE (256)
@@ -234,7 +236,8 @@ extern "C" {
234236

235237
#endif
236238

237-
#if defined(__WOLFBOOT) || defined (__FLASH_OTP_PRIMER) || defined (UNIT_TEST_AUTH) || defined(WOLFBOOT_TPM)
239+
#if defined(__WOLFBOOT) || defined (__FLASH_OTP_PRIMER) || \
240+
defined (UNIT_TEST_AUTH) || defined(WOLFBOOT_TPM)
238241

239242
/* Authentication configuration */
240243
#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)