Skip to content

Commit d507708

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 d507708

5 files changed

Lines changed: 28 additions & 24 deletions

File tree

include/encrypt.h

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,25 +27,22 @@
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>
39+
#include "wolfssl/wolfcrypt/aes.h"
4040
#endif
4141
#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>
42+
#include "wolfssl/wolfcrypt/cryptocb.h"
4643
#endif
4744

48-
#include <wolfssl/wolfcrypt/pwdbased.h>
45+
#include "wolfssl/wolfcrypt/pwdbased.h"
4946

5047
#ifdef ENCRYPT_WITH_CHACHA
5148

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: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -161,12 +161,20 @@ 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+
#ifdef WOLFBOOT_RENESAS_TSIP
169+
#include "r_bsp_common.h"
170+
#include "r_bsp_config.h"
171+
#include "r_tsip_rx_if.h"
172+
#include "wolfssl/wolfcrypt/port/Renesas/renesas_tsip_types.h"
173+
#endif
174+
175+
164176
/* Hashing configuration */
165177
#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"
170178
#include "wolfssl/wolfcrypt/sha256.h"
171179
# ifndef WOLFBOOT_SHA_BLOCK_SIZE
172180
# define WOLFBOOT_SHA_BLOCK_SIZE (256)
@@ -182,10 +190,6 @@ extern "C" {
182190
typedef wc_Sha256 wolfBoot_hash_t;
183191
# define HDR_HASH HDR_SHA256
184192
#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"
189193
#include "wolfssl/wolfcrypt/sha512.h"
190194
# ifndef WOLFBOOT_SHA_BLOCK_SIZE
191195
# define WOLFBOOT_SHA_BLOCK_SIZE (256)
@@ -201,10 +205,6 @@ extern "C" {
201205
typedef wc_Sha384 wolfBoot_hash_t;
202206
# define HDR_HASH HDR_SHA384
203207
#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"
208208
#include "wolfssl/wolfcrypt/sha3.h"
209209
# ifndef WOLFBOOT_SHA_BLOCK_SIZE
210210
# define WOLFBOOT_SHA_BLOCK_SIZE (256)
@@ -234,7 +234,8 @@ extern "C" {
234234

235235
#endif
236236

237-
#if defined(__WOLFBOOT) || defined (__FLASH_OTP_PRIMER) || defined (UNIT_TEST_AUTH) || defined(WOLFBOOT_TPM)
237+
#if defined(__WOLFBOOT) || defined (__FLASH_OTP_PRIMER) || \
238+
defined (UNIT_TEST_AUTH) || defined(WOLFBOOT_TPM)
238239

239240
/* Authentication configuration */
240241
#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)