|
| 1 | +name: wolfBoot as Library test |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ 'master', 'main', 'release/**' ] |
| 6 | + pull_request: |
| 7 | + branches: [ '*' ] |
| 8 | + |
| 9 | +jobs: |
| 10 | + test-lib: |
| 11 | + runs-on: ubuntu-latest |
| 12 | + |
| 13 | + strategy: |
| 14 | + fail-fast: false |
| 15 | + matrix: |
| 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] |
| 24 | + steps: |
| 25 | + - uses: actions/checkout@v4 |
| 26 | + with: |
| 27 | + submodules: true |
| 28 | + |
| 29 | + - name: make clean |
| 30 | + run: | |
| 31 | + make keysclean && make -C tools/keytools clean && rm -f include/target.h |
| 32 | +
|
| 33 | + - name: Build test-lib |
| 34 | + env: |
| 35 | + ASYM: ${{ matrix.asym }} |
| 36 | + HASH: ${{ matrix.hash }} |
| 37 | + run: | |
| 38 | + cp config/examples/library.config .config |
| 39 | + make keytools |
| 40 | + ./tools/keytools/keygen --${{ matrix.asym }} -g wolfboot_signing_private_key.der |
| 41 | + echo "Test" > test.bin |
| 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^^} |
| 45 | +
|
| 46 | + - name: Run test-lib |
| 47 | + run: | |
| 48 | + ./test-lib test_v1_signed.bin |
| 49 | + ./test-lib test_v1_signed.bin 2>&1 | grep "Firmware Valid" |
| 50 | +
|
| 51 | + - name: Run test-lib (expect failure) |
| 52 | + run: | |
| 53 | + # Corrupt signed binary |
| 54 | + truncate -s -1 test_v1_signed.bin |
| 55 | + echo "A" >> test_v1_signed.bin |
| 56 | + ./test-lib test_v1_signed.bin |
| 57 | + ./test-lib test_v1_signed.bin 2>&1 | grep "Failure" |
0 commit comments