Improving matrix.

pull/569/head
David Garske 2025-04-21 16:39:16 -07:00 committed by Daniele Lacamera
parent cc63bf92ab
commit 271ae4c2f0
3 changed files with 21 additions and 42 deletions

View File

@ -13,38 +13,14 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
math: [SPMATH=1, SPMATHALL=1, FASTMATH=1] math: [SPMATH=1 WOLFBOOT_SMALL_STACK=0,
smallstack: [WOLFBOOT_SMALL_STACK=0 WOLFBOOT_HUGE_STACK=1, WOLFBOOT_SMALL_STACK=1] SPMATH=1 WOLFBOOT_SMALL_STACK=1,
include: SPMATHALL=1 WOLFBOOT_SMALL_STACK=0,
- name: ED25519-SHA256 SPMATHALL=1 WOLFBOOT_SMALL_STACK=1,
keygen: --ed25519 SPMATH=0 SPMATHALL=0 WOLFBOOT_SMALL_STACK=0,
sign: --ed25519 --sha256 SPMATH=0 SPMATHALL=0 WOLFBOOT_SMALL_STACK=1]
config: SIGN=ED25519 HASH=SHA256 asym: [ed25519, ecc256, ecc384, ecc521, rsa2048, rsa3072, rsa4096, ed448]
- name: ECC256-SHA256 hash: [sha256, sha384, sha3]
keygen: --ecc256
sign: --ecc256 --sha256
config: SIGN=ECC256 HASH=SHA256
- name: ECC384-SHA384
keygen: --ecc384
sign: --ecc384 --sha384
config: SIGN=ECC384 HASH=SHA384
- name: ECC521-SHA512
keygen: --ecc521
sign: --ecc521 --sha3
config: SIGN=ECC521 HASH=SHA3
- name: RSA2048-SHA256
keygen: --rsa2048
sign: --rsa2048 --sha256
config: SIGN=RSA2048 HASH=SHA256
- name: RSA3072-SHA384
keygen: --rsa3072
sign: --rsa3072 --sha384
config: SIGN=RSA3072 HASH=SHA384
- name: RSA4096-SHA512
keygen: --rsa4096
sign: --rsa4096 --sha3
config: SIGN=RSA4096 HASH=SHA3
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
with: with:
@ -55,13 +31,17 @@ jobs:
make keysclean && make -C tools/keytools clean && rm -f include/target.h make keysclean && make -C tools/keytools clean && rm -f include/target.h
- name: Build test-lib - name: Build test-lib
env:
ASYM: ${{ matrix.asym }}
HASH: ${{ matrix.hash }}
run: | run: |
cp config/examples/library.config .config cp config/examples/library.config .config
make keytools make keytools
./tools/keytools/keygen ${{ matrix.keygen }} -g wolfboot_signing_private_key.der ./tools/keytools/keygen --${{ matrix.asym }} -g wolfboot_signing_private_key.der
echo "Test" > test.bin echo "Test" > test.bin
./tools/keytools/sign ${{ matrix.sign }} test.bin wolfboot_signing_private_key.der 1 ./tools/keytools/sign --${{ matrix.asym }} --${{ matrix.hash }} test.bin wolfboot_signing_private_key.der 1
make test-lib ${{ matrix.math }} ${{ matrix.config }} ${{ matrix.smallstack }} # Convert asym and hash to upper case
make test-lib SIGN=${ASYM^^} HASH=${HASH^^}
- name: Run test-lib - name: Run test-lib
run: | run: |

View File

@ -472,7 +472,7 @@ extern int tolower(int c);
#endif #endif
#ifndef WOLFBOOT_SMALL_STACK #ifndef WOLFBOOT_SMALL_STACK
# ifdef WOLFSSL_SP_MATH # if defined(WOLFSSL_SP_MATH) || defined(WOLFSSL_SP_MATH_ALL)
# define WOLFSSL_SP_NO_MALLOC # define WOLFSSL_SP_NO_MALLOC
# define WOLFSSL_SP_NO_DYN_STACK # define WOLFSSL_SP_NO_DYN_STACK
# endif # endif

View File

@ -1,4 +1,3 @@
/* xmalloc.c /* xmalloc.c
* *
* Fixed-pool implementation of malloc/free for wolfBoot * Fixed-pool implementation of malloc/free for wolfBoot
@ -35,13 +34,12 @@
#endif #endif
#include "target.h" #include "target.h"
#ifdef WOLFBOOT_SMALL_STACK
#ifdef WOLFBOOT_DEBUG_MALLOC #ifdef WOLFBOOT_DEBUG_MALLOC
#include <stdio.h> #include <stdio.h>
#endif #endif
struct xmalloc_slot { struct xmalloc_slot {
uint8_t *addr; uint8_t *addr;
uint32_t size; uint32_t size;
@ -322,8 +320,6 @@ static uint8_t asncheck_buf[ASNCHECK_BUF_SIZE];
#define MPDIGIT_BUF1_SIZE (MP_DIGIT_SIZE * (106 * 4 + 3)) #define MPDIGIT_BUF1_SIZE (MP_DIGIT_SIZE * (106 * 4 + 3))
static uint8_t mp_digit_buf1[MPDIGIT_BUF1_SIZE]; static uint8_t mp_digit_buf1[MPDIGIT_BUF1_SIZE];
#endif #endif
#else #else
#define MP_SCHEME "SP RSA4096" #define MP_SCHEME "SP RSA4096"
#ifdef WOLFSSL_SP_ARM_CORTEX_M_ASM #ifdef WOLFSSL_SP_ARM_CORTEX_M_ASM
@ -346,7 +342,7 @@ static uint8_t asncheck_buf[ASNCHECK_BUF_SIZE];
#endif #endif
{ NULL, 0, 0} { NULL, 0, 0}
}; };
#else /* FAST MATH */ #else /* Old tom's Fast math (tfm.c) */
#define MP_SCHEME "TFM RSA" #define MP_SCHEME "TFM RSA"
#define MP_INT_TYPE_SIZE (sizeof(mp_int)) #define MP_INT_TYPE_SIZE (sizeof(mp_int))
#define MP_MONT_REDUCE_BUF_SIZE (sizeof(fp_digit)*(FP_SIZE + 1)) #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)
static int detect_init = 0; static int detect_init = 0;
if (detect_init++ == 0) { if (detect_init++ == 0) {
printf("MP_SCHEME %s\n", MP_SCHEME); printf("MP_SCHEME %s\n", MP_SCHEME);
printf("MP_DIGIT %d\n", (int)MP_DIGIT_SIZE);
dump_pool(); dump_pool();
} }
printf("MALLOC: Type %d, Size %zd", type, n); printf("MALLOC: Type %d, Size %zd", type, n);
@ -450,3 +447,5 @@ void XFREE(void *ptr, void *heap, int type)
(void)heap; (void)heap;
(void)type; (void)type;
} }
#endif /* WOLFBOOT_SMALL_STACK */