Skip to content

Commit 271ae4c

Browse files
dgarskedanielinux
authored andcommitted
Improving matrix.
1 parent cc63bf9 commit 271ae4c

File tree

3 files changed

+21
-42
lines changed

3 files changed

+21
-42
lines changed

.github/workflows/test-library.yml

Lines changed: 15 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -13,38 +13,14 @@ jobs:
1313
strategy:
1414
fail-fast: false
1515
matrix:
16-
math: [SPMATH=1, SPMATHALL=1, FASTMATH=1]
17-
smallstack: [WOLFBOOT_SMALL_STACK=0 WOLFBOOT_HUGE_STACK=1, WOLFBOOT_SMALL_STACK=1]
18-
include:
19-
- name: ED25519-SHA256
20-
keygen: --ed25519
21-
sign: --ed25519 --sha256
22-
config: SIGN=ED25519 HASH=SHA256
23-
- name: ECC256-SHA256
24-
keygen: --ecc256
25-
sign: --ecc256 --sha256
26-
config: SIGN=ECC256 HASH=SHA256
27-
- name: ECC384-SHA384
28-
keygen: --ecc384
29-
sign: --ecc384 --sha384
30-
config: SIGN=ECC384 HASH=SHA384
31-
- name: ECC521-SHA512
32-
keygen: --ecc521
33-
sign: --ecc521 --sha3
34-
config: SIGN=ECC521 HASH=SHA3
35-
- name: RSA2048-SHA256
36-
keygen: --rsa2048
37-
sign: --rsa2048 --sha256
38-
config: SIGN=RSA2048 HASH=SHA256
39-
- name: RSA3072-SHA384
40-
keygen: --rsa3072
41-
sign: --rsa3072 --sha384
42-
config: SIGN=RSA3072 HASH=SHA384
43-
- name: RSA4096-SHA512
44-
keygen: --rsa4096
45-
sign: --rsa4096 --sha3
46-
config: SIGN=RSA4096 HASH=SHA3
47-
16+
math: [SPMATH=1 WOLFBOOT_SMALL_STACK=0,
17+
SPMATH=1 WOLFBOOT_SMALL_STACK=1,
18+
SPMATHALL=1 WOLFBOOT_SMALL_STACK=0,
19+
SPMATHALL=1 WOLFBOOT_SMALL_STACK=1,
20+
SPMATH=0 SPMATHALL=0 WOLFBOOT_SMALL_STACK=0,
21+
SPMATH=0 SPMATHALL=0 WOLFBOOT_SMALL_STACK=1]
22+
asym: [ed25519, ecc256, ecc384, ecc521, rsa2048, rsa3072, rsa4096, ed448]
23+
hash: [sha256, sha384, sha3]
4824
steps:
4925
- uses: actions/checkout@v4
5026
with:
@@ -55,13 +31,17 @@ jobs:
5531
make keysclean && make -C tools/keytools clean && rm -f include/target.h
5632
5733
- name: Build test-lib
34+
env:
35+
ASYM: ${{ matrix.asym }}
36+
HASH: ${{ matrix.hash }}
5837
run: |
5938
cp config/examples/library.config .config
6039
make keytools
61-
./tools/keytools/keygen ${{ matrix.keygen }} -g wolfboot_signing_private_key.der
40+
./tools/keytools/keygen --${{ matrix.asym }} -g wolfboot_signing_private_key.der
6241
echo "Test" > test.bin
63-
./tools/keytools/sign ${{ matrix.sign }} test.bin wolfboot_signing_private_key.der 1
64-
make test-lib ${{ matrix.math }} ${{ matrix.config }} ${{ matrix.smallstack }}
42+
./tools/keytools/sign --${{ matrix.asym }} --${{ matrix.hash }} test.bin wolfboot_signing_private_key.der 1
43+
# Convert asym and hash to upper case
44+
make test-lib SIGN=${ASYM^^} HASH=${HASH^^}
6545
6646
- name: Run test-lib
6747
run: |

include/user_settings.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -472,7 +472,7 @@ extern int tolower(int c);
472472
#endif
473473

474474
#ifndef WOLFBOOT_SMALL_STACK
475-
# ifdef WOLFSSL_SP_MATH
475+
# if defined(WOLFSSL_SP_MATH) || defined(WOLFSSL_SP_MATH_ALL)
476476
# define WOLFSSL_SP_NO_MALLOC
477477
# define WOLFSSL_SP_NO_DYN_STACK
478478
# endif

src/xmalloc.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
/* xmalloc.c
32
*
43
* Fixed-pool implementation of malloc/free for wolfBoot
@@ -35,13 +34,12 @@
3534
#endif
3635
#include "target.h"
3736

37+
#ifdef WOLFBOOT_SMALL_STACK
3838

3939
#ifdef WOLFBOOT_DEBUG_MALLOC
4040
#include <stdio.h>
4141
#endif
4242

43-
44-
4543
struct xmalloc_slot {
4644
uint8_t *addr;
4745
uint32_t size;
@@ -322,8 +320,6 @@ static uint8_t asncheck_buf[ASNCHECK_BUF_SIZE];
322320
#define MPDIGIT_BUF1_SIZE (MP_DIGIT_SIZE * (106 * 4 + 3))
323321
static uint8_t mp_digit_buf1[MPDIGIT_BUF1_SIZE];
324322
#endif
325-
326-
327323
#else
328324
#define MP_SCHEME "SP RSA4096"
329325
#ifdef WOLFSSL_SP_ARM_CORTEX_M_ASM
@@ -346,7 +342,7 @@ static uint8_t asncheck_buf[ASNCHECK_BUF_SIZE];
346342
#endif
347343
{ NULL, 0, 0}
348344
};
349-
#else /* FAST MATH */
345+
#else /* Old tom's Fast math (tfm.c) */
350346
#define MP_SCHEME "TFM RSA"
351347
#define MP_INT_TYPE_SIZE (sizeof(mp_int))
352348
#define MP_MONT_REDUCE_BUF_SIZE (sizeof(fp_digit)*(FP_SIZE + 1))
@@ -409,6 +405,7 @@ void* XMALLOC(size_t n, void* heap, int type)
409405
static int detect_init = 0;
410406
if (detect_init++ == 0) {
411407
printf("MP_SCHEME %s\n", MP_SCHEME);
408+
printf("MP_DIGIT %d\n", (int)MP_DIGIT_SIZE);
412409
dump_pool();
413410
}
414411
printf("MALLOC: Type %d, Size %zd", type, n);
@@ -450,3 +447,5 @@ void XFREE(void *ptr, void *heap, int type)
450447
(void)heap;
451448
(void)type;
452449
}
450+
451+
#endif /* WOLFBOOT_SMALL_STACK */

0 commit comments

Comments
 (0)