Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI: Upgrade artifact actions #378

Open
wants to merge 80 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
80 commits
Select commit Hold shift + click to select a range
bf74f34
[nrf fromtree] boot: SHA512 verification
michalek-no May 20, 2024
9cb8f93
[nrf fromlist] imgtool: Add support for calculating SHA512
de-nordic Aug 22, 2024
a92ee3c
[nrf fromlist] boot: Replace boot_encrypt by boot_enc_encrypt and boo…
de-nordic Jul 18, 2024
2b70952
[nrf fromlist] scripts: imgtool: compression
michalek-no Aug 9, 2024
5040256
[nrf fromtree] boot: bootutil: loader: Fix slot info for directXIP/RA…
nordicjm Sep 25, 2024
218c63d
[nrf fromtree] boot: bootutil: loader: Fix issue with using pointers
nordicjm Sep 27, 2024
3d346f7
[nrf fromtree] scripts: imgtool: compression
michalek-no Aug 9, 2024
a46eb1e
[nrf fromlist] boot: bootutil: swap_scratch: Fix compressed image sec…
nordicjm Oct 7, 2024
10df2a3
[nrf fromlist] scripts: imgtool: compression ARM thumb filter
michalek-no Oct 4, 2024
af4e468
[nrf fromlist] zephyr: Fixing Kconfig dependency for SHA512
de-nordic Oct 8, 2024
2b568d8
[nrf fromlist] scipts: imgtool: bugfix #2096
michalek-no Oct 15, 2024
a5786cd
[nrf fromlist] imgtool: Add pure signature support
de-nordic Sep 12, 2024
283fd06
[nrf fromlist] imgtool: create image obj with image_hash
nvlsianpu Oct 19, 2024
3d2808d
[nrf fromtree] bootutil: Add SIG_PURE TLV
de-nordic Aug 2, 2024
6813bbb
[nrf noup] github: Add a commit tags check workflow
carlescufi Oct 10, 2023
7f05233
[nrf noup] zephyr: Remove duplication from cmake
sigvartmh Mar 26, 2019
60c998f
[nrf noup] zephyr: add 'minimal' configuration files
mbolivar-nordic Sep 3, 2021
1e82a20
[nrf noup] boards: add support for Thingy:91
bjda Sep 20, 2019
4be7cf8
[nrf noup] zephyr: Restore default RTC user channel count
Damian-Nordic Mar 21, 2022
932db78
[nrf noup] boards: thingy91x: add board config
maxd-nordic Dec 8, 2023
c13d7b3
[nrf noup] treewide: add NCS partition manager support
SebastianBoe Dec 12, 2018
33cf05d
[nrf noup] boot: nrf53-specific customizations
sigvartmh Aug 27, 2020
0a3f9c7
[nrf noup] zephyr: clean peripherals state before boot
nvlsianpu Feb 27, 2020
9aa2a23
[nrf noup] zephyr: Clean up non-secure RAM if enabled
sigvartmh Jan 6, 2023
4081b79
[nrf noup] loader: Fix reading reset addr to support ext flash
chrta Feb 10, 2022
a97a24c
[nrf noup] zephyr: Fix path variables
nordicjm Jul 11, 2023
c2eb5fc
[nrf noup] loader: Do not check reset vector for XIP image
de-nordic Sep 22, 2023
002409b
[nrf noup] zephyr: Add RAM flash configuration to cache for sysbuild
nordicjm Sep 18, 2023
c6fe3b4
[nrf noup] zephyr: Boot even if EXT_ABI is not provided
sigvartmh Oct 17, 2023
fecd88c
[nrf noup] loader: Add firmware version check downgrade prevention
sigvartmh Sep 27, 2023
2ce124e
[nrf noup] boards: thingy53: disable GPIO ISR support
nika-nordic Oct 9, 2023
38da586
[nrf noup] boot/zephyr/boards: nRF54l15pdk ext flash cfg
nvlsianpu Apr 11, 2024
6b43e71
[nrf noup] loader: work-around for multi-image builds
sigvartmh Mar 30, 2021
3335555
[nrf noup] loader: Fix missing PCD define check
nordicjm Aug 31, 2023
73e8c3d
[nrf noup] boot: Add support for NSIB and multi-image
sigvartmh May 31, 2023
628fcbd
[nrf noup] sysflash: Move partition manager definitions to pm_sysflash.h
de-nordic Aug 10, 2023
dd4451b
[nrf noup] sysflash: Add support for three images
de-nordic Aug 11, 2023
d002ffe
[nrf noup] loader: introduced cleanup of unusable secondary slot
nvlsianpu Feb 15, 2024
da14b70
[nrf noup] boards: nrf54l15: Disable FPROTECT
gchwier Apr 16, 2024
5f10ba0
[nrf noup] loader: remove cleanup for direct xip mode
gchwier May 17, 2024
0cb3858
[nrf noup] boot/zephyr/boards: nrf54l15pdk ext-flash partition
nvlsianpu Apr 15, 2024
a38a17e
[nrf noup] boot/zephyr/boards: nrf54l15pdk ext-flash update
nvlsianpu May 20, 2024
b27bf53
[nrf noup] boards: thingy91x: enable serial recovery
maxd-nordic Mar 12, 2024
6e47305
[nrf noup] boot: zephyr: Disable boot banner if NCS_BOOT_BANNER is used
rlubos May 17, 2024
362a944
[nrf noup] boot/zephyr: fix fw_info search
nvlsianpu May 27, 2024
861a34e
[nrf noup] Revert of zephyr: arm: Update reading the flash image rese…
de-nordic May 28, 2024
4d86e37
[nrf noup] zephyr/boards: fix nrf54l15pdk ext flash dts overlay
nvlsianpu Jun 5, 2024
8f74833
[nrf noup] boot: zephyr: Add NCS boot banner
nordicjm Jun 11, 2024
1953d93
[nrf noup] boot/../loader: skip downgrade prevention for s1/s0
nvlsianpu Jun 13, 2024
5f52f93
[nrf noup] boot/../loader: reboot after updating s0/s1
nvlsianpu Jun 18, 2024
b3d65d9
[nrf noup] bootutil: loader: Fix netcore address checking
nordicjm Aug 29, 2024
4786da4
[nrf noup] boards: nrf54l15dk: Disable FPROTECT
nvlsianpu Sep 18, 2024
8809820
[nrf noup] zephyr: Add support for compressed image updates
nordicjm Aug 22, 2024
106ade3
[nrf noup] boot: Add shared crypto for ECDSA and SHA
sigvartmh Feb 14, 2019
3cdcdb3
[nrf noup] PSA configuration required changes
de-nordic Jul 24, 2024
9e1d883
[nrf noup] PSA implementation of x25519 and ed25519 verification
de-nordic May 29, 2024
10211d4
[nrf noup] bootutil: Provide support for SHA512 with ED25519
de-nordic Aug 2, 2024
b4e5a3b
[nrf noup] bootutil: Enable hash calculation directly on storage
de-nordic Sep 5, 2024
81988f9
[nrf noup] bootutil: PureEdDSA using ED25519
de-nordic Sep 6, 2024
a023c2e
[nrf noup] boot/zephyr/Kconfig: conditionally disable BOOT_MAX_IMG_SE…
nvlsianpu Sep 19, 2024
ded8242
[nrf noup] zephyr: Add support for ARM thumb filter
nordicjm Sep 2, 2024
2d5a490
[nrf noup] Remove setting default MCUboot mbedTLS config
de-nordic Oct 17, 2024
b3c7d3d
[nrf noup] boot: zephyr: Do not lock PCD region with TF-M
MarkusLassila Aug 30, 2024
ba255be
[nrf noup] treewide: Add support for sysbuild assigned images
nordicjm Sep 10, 2024
4aaec13
[nrf noup] boot: bootutil: loader: Add s0/s1 checking of MCUboot image
nordicjm Oct 15, 2024
d5aa215
[nrf noup] treewide: Add child/parent image support back
nordicjm Oct 17, 2024
40543f1
[nrf noup] bootutil: Add support for KMU stored ED25519 signature key
de-nordic Sep 20, 2024
0ab75e0
[nrf noup] boards: Thingy:91 X release config
maxd-nordic Oct 23, 2024
93f4645
[nrf noup] workflows: Add a backport workflow
carlescufi Oct 25, 2024
0a70e49
[nrf noup] zephyr: Fix compressed chunk size mismatch
nordicjm Oct 25, 2024
352a241
[nrf noup] Fix KMU breaking non-KMU builds of MCUboot
de-nordic Oct 25, 2024
062d3e7
[nrf noup] Bring in missing line
de-nordic Oct 25, 2024
4fc8d2d
[nrf noup] zephyr: Fix issues with ARM thumb decompression
nordicjm Oct 29, 2024
16a7789
[nrf noup] zephyr: Fix issues with compression TLVs
nordicjm Oct 30, 2024
99fee89
[nrf noup] boot: zephyr: decompression: Fix stray sizeof() usage
nordicjm Nov 5, 2024
6b030d7
[nrf noup] boot/zephyr: add nrf54l15dk ext flash configs
michalek-no Nov 7, 2024
e60dc3f
[nrf noup] boot: zephyr: Kconfig update nrf54l15dk symbol for ED25519
michalek-no Nov 7, 2024
b836582
[nrf noup] boot: zephyr: Add experimental selection to compression
nordicjm Nov 7, 2024
bcdf6e2
[nrf fromlist] boot_serial: Support sha256, sha384 and sha512
de-nordic Nov 12, 2024
498c0f8
ci: Upgrade artifact actions
jaci-nordic Nov 14, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions .github/workflows/backport.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Backport
on:
pull_request_target:
types:
- closed
- labeled
branches:
- main

jobs:
backport:
name: Backport
runs-on: ubuntu-22.04
# Only react to merged PRs for security reasons.
# See https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#pull_request_target.
if: >
github.event.pull_request.merged &&
(
github.event.action == 'closed' ||
(
github.event.action == 'labeled' &&
contains(github.event.label.name, 'backport')
)
)
steps:
- name: Backport
uses: zephyrproject-rtos/[email protected]
with:
github_token: ${{ secrets.NCS_GITHUB_TOKEN }}
issue_labels: Backport
labels_template: '["Backport"]'
28 changes: 28 additions & 0 deletions .github/workflows/commit-tags.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Commit tags

on:
pull_request:
types: [synchronize, opened, reopened, edited, labeled, unlabeled,
milestoned, demilestoned, assigned, unassigned, ready_for_review,
review_requested]

jobs:
commit_tags:
runs-on: ubuntu-22.04
name: Run commit tags checks on patch series (PR)
steps:
- name: Update PATH for west
run: |
echo "$HOME/.local/bin" >> $GITHUB_PATH

- name: Checkout the code
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0

- name: Run the commit tags
uses: nrfconnect/action-commit-tags@main
with:
target: .
upstream: mcu-tools/mcuboot/main
3 changes: 2 additions & 1 deletion .github/workflows/imgtool.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,14 @@ jobs:
pipenv run pip install pytest -e .
pipenv run pytest --junitxml=../junit/pytest-results-${{ matrix.python-version }}.xml
- name: Upload test results
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
if: always()
with:
name: pytest-results-${{ matrix.python-version }}
path: |
junit/pytest-results-${{ matrix.python-version }}*.xml
if-no-files-found: ignore
overwrite: true
environment:
if: ${{ github.event_name == 'push' }}
runs-on: ubuntu-latest
Expand Down
25 changes: 18 additions & 7 deletions boot/boot_serial/src/boot_serial.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,17 @@ BOOT_LOG_MODULE_DECLARE(mcuboot);
#define ARRAY_SIZE ZCBOR_ARRAY_SIZE
#endif

#if defined(MCUBOOT_SHA512)
#define IMAGE_HASH_SIZE (64)
#define IMAGE_SHA_TLV IMAGE_TLV_SHA512
#elif defined(MCUBOOT_SIGN_EC384)
#define IMAGE_HASH_SIZE (48)
#define IMAGE_SHA_TLV IMAGE_TLV_SHA384
#else
#define IMAGE_HASH_SIZE (32)
#define IMAGE_SHA_TLV IMAGE_TLV_SHA256
#endif

#ifndef MCUBOOT_SERIAL_MAX_RECEIVE_SIZE
#define MCUBOOT_SERIAL_MAX_RECEIVE_SIZE 512
#endif
Expand All @@ -91,7 +102,7 @@ BOOT_LOG_MODULE_DECLARE(mcuboot);
#define BOOT_SERIAL_IMAGE_STATE_SIZE_MAX 0
#endif
#ifdef MCUBOOT_SERIAL_IMG_GRP_HASH
#define BOOT_SERIAL_HASH_SIZE_MAX 36
#define BOOT_SERIAL_HASH_SIZE_MAX (IMAGE_HASH_SIZE + 4)
#else
#define BOOT_SERIAL_HASH_SIZE_MAX 0
#endif
Expand Down Expand Up @@ -263,7 +274,7 @@ bs_list(char *buf, int len)
const struct flash_area *fap;
uint8_t image_index;
#ifdef MCUBOOT_SERIAL_IMG_GRP_HASH
uint8_t hash[32];
uint8_t hash[IMAGE_HASH_SIZE];
#endif

zcbor_map_start_encode(cbor_state, 1);
Expand Down Expand Up @@ -336,7 +347,7 @@ bs_list(char *buf, int len)
}

#ifdef MCUBOOT_SERIAL_IMG_GRP_HASH
/* Retrieve SHA256 hash of image for identification */
/* Retrieve hash of image for identification */
rc = boot_serial_get_hash(&hdr, fap, hash);
#endif

Expand Down Expand Up @@ -440,7 +451,7 @@ bs_set(char *buf, int len)
*/
uint8_t image_index = 0;
size_t decoded = 0;
uint8_t hash[32];
uint8_t hash[IMAGE_HASH_SIZE];
bool confirm;
struct zcbor_string img_hash;
bool ok;
Expand Down Expand Up @@ -523,7 +534,7 @@ bs_set(char *buf, int len)
}
}

/* Retrieve SHA256 hash of image for identification */
/* Retrieve hash of image for identification */
rc = boot_serial_get_hash(&hdr, fap, hash);
flash_area_close(fap);

Expand Down Expand Up @@ -1467,9 +1478,9 @@ static int boot_serial_get_hash(const struct image_header *hdr,
break;
}

if (type == IMAGE_TLV_SHA256) {
if (type == IMAGE_SHA_TLV) {
/* Get the image's hash value from the manifest section. */
if (len != 32) {
if (len != IMAGE_HASH_SIZE) {
return -1;
}

Expand Down
2 changes: 1 addition & 1 deletion boot/boot_serial/src/boot_serial_encryption.c
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ decrypt_region_inplace(struct boot_loader_state *state,
blk_sz = tlv_off - (off + bytes_copied);
}
}
boot_encrypt(BOOT_CURR_ENC(state), slot,
boot_enc_decrypt(BOOT_CURR_ENC(state), slot,
(off + bytes_copied + idx) - hdr->ih_hdr_size, blk_sz,
blk_off, &buf[idx]);
}
Expand Down
38 changes: 36 additions & 2 deletions boot/bootutil/include/bootutil/crypto/aes_ctr.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
#include "mcuboot_config/mcuboot_config.h"

#if (defined(MCUBOOT_USE_MBED_TLS) + \
defined(MCUBOOT_USE_TINYCRYPT)) != 1
#error "One crypto backend must be defined: either MBED_TLS or TINYCRYPT"
defined(MCUBOOT_USE_TINYCRYPT) + defined(MCUBOOT_USE_PSA_CRYPTO)) != 1
#error "One crypto backend must be defined: either MBED_TLS or TINYCRYPT or PSA"
#endif

#if defined(MCUBOOT_USE_MBED_TLS)
Expand All @@ -38,12 +38,46 @@
#define BOOTUTIL_CRYPTO_AES_CTR_BLOCK_SIZE TC_AES_BLOCK_SIZE
#endif /* MCUBOOT_USE_TINYCRYPT */


#if defined(MCUBOOT_USE_PSA_CRYPTO)
#include <psa/crypto.h>
#include "bootutil/enc_key_public.h"
#define BOOTUTIL_CRYPTO_AES_CTR_KEY_SIZE BOOT_ENC_KEY_SIZE
#define BOOTUTIL_CRYPTO_AES_CTR_BLOCK_SIZE (16)
#endif

#include <stdint.h>

#ifdef __cplusplus
extern "C" {
#endif

#if defined(MCUBOOT_USE_PSA_CRYPTO)
typedef struct {
/* Fixme: This should not be, here, psa_key_id should be passed */
uint8_t key[BOOT_ENC_KEY_SIZE];
} bootutil_aes_ctr_context;

void bootutil_aes_ctr_init(bootutil_aes_ctr_context *ctx);

static inline void bootutil_aes_ctr_drop(bootutil_aes_ctr_context *ctx)
{
memset(ctx, 0, sizeof(ctx));
}

static inline int bootutil_aes_ctr_set_key(bootutil_aes_ctr_context *ctx, const uint8_t *k)
{
memcpy(ctx->key, k, sizeof(ctx->key));

return 0;
}

int bootutil_aes_ctr_encrypt(bootutil_aes_ctr_context *ctx, uint8_t *counter,
const uint8_t *m, uint32_t mlen, size_t blk_off, uint8_t *c);
int bootutil_aes_ctr_decrypt(bootutil_aes_ctr_context *ctx, uint8_t *counter,
const uint8_t *c, uint32_t clen, size_t blk_off, uint8_t *m);
#endif

#if defined(MCUBOOT_USE_MBED_TLS)
typedef mbedtls_aes_context bootutil_aes_ctr_context;
static inline void bootutil_aes_ctr_init(bootutil_aes_ctr_context *ctx)
Expand Down
64 changes: 58 additions & 6 deletions boot/bootutil/include/bootutil/crypto/ecdsa.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@

#if (defined(MCUBOOT_USE_TINYCRYPT) + \
defined(MCUBOOT_USE_CC310) + \
defined(MCUBOOT_USE_NRF_EXTERNAL_CRYPTO) + \
defined(MCUBOOT_USE_PSA_OR_MBED_TLS)) != 1
#error "One crypto backend must be defined: either CC310/TINYCRYPT/MBED_TLS/PSA_CRYPTO"
#endif
Expand Down Expand Up @@ -70,12 +71,18 @@
#include "bootutil/sign_key.h"
#include "common.h"

#if defined(MCUBOOT_USE_NRF_EXTERNAL_CRYPTO)
#include <bl_crypto.h>
#define NUM_ECC_BYTES (256 / 8)
#endif /* MCUBOOT_USE_NRF_EXTERNAL_CRYPTO */

#ifdef __cplusplus
extern "C" {
#endif

#if (defined(MCUBOOT_USE_TINYCRYPT) || defined(MCUBOOT_USE_MBED_TLS) || \
defined(MCUBOOT_USE_CC310)) && !defined(MCUBOOT_USE_PSA_CRYPTO)
defined(MCUBOOT_USE_CC310) || defined(MCUBOOT_USE_NRF_EXTERNAL_CRYPTO)) \
&& !defined(MCUBOOT_USE_PSA_CRYPTO)
/*
* Declaring these like this adds NULL termination.
*/
Expand Down Expand Up @@ -127,8 +134,6 @@ static int bootutil_import_key(uint8_t **cp, uint8_t *end)
}
#endif /* (MCUBOOT_USE_TINYCRYPT || MCUBOOT_USE_MBED_TLS || MCUBOOT_USE_CC310) && !MCUBOOT_USE_PSA_CRYPTO */

#if defined(MCUBOOT_USE_TINYCRYPT)
#ifndef MCUBOOT_ECDSA_NEED_ASN1_SIG
/*
* cp points to ASN1 string containing an integer.
* Verify the tag, and that the length is 32 bytes. Helper function.
Expand Down Expand Up @@ -178,8 +183,8 @@ static int bootutil_decode_sig(uint8_t signature[NUM_ECC_BYTES * 2], uint8_t *cp
}
return 0;
}
#endif /* not MCUBOOT_ECDSA_NEED_ASN1_SIG */

#if defined(MCUBOOT_USE_TINYCRYPT)
typedef uintptr_t bootutil_ecdsa_context;
static inline void bootutil_ecdsa_init(bootutil_ecdsa_context *ctx)
{
Expand Down Expand Up @@ -248,16 +253,20 @@ static inline int bootutil_ecdsa_verify(bootutil_ecdsa_context *ctx,
{
(void)ctx;
(void)pk_len;
(void)sig_len;
(void)hash_len;
uint8_t dsig[2 * NUM_ECC_BYTES];

if (bootutil_decode_sig(dsig, sig, sig + sig_len)) {
return -1;
}

/* Only support uncompressed keys. */
if (pk[0] != 0x04) {
return -1;
}
pk++;

return cc310_ecdsa_verify_secp256r1(hash, pk, sig, BOOTUTIL_CRYPTO_ECDSA_P256_HASH_SIZE);
return cc310_ecdsa_verify_secp256r1(hash, pk, dsig, BOOTUTIL_CRYPTO_ECDSA_P256_HASH_SIZE);
}

static inline int bootutil_ecdsa_parse_public_key(bootutil_ecdsa_context *ctx,
Expand Down Expand Up @@ -613,6 +622,49 @@ static inline int bootutil_ecdsa_parse_public_key(bootutil_ecdsa_context *ctx,

#endif /* MCUBOOT_USE_MBED_TLS */

#if defined(MCUBOOT_USE_NRF_EXTERNAL_CRYPTO)
typedef uintptr_t bootutil_ecdsa_context;
static inline void bootutil_ecdsa_init(bootutil_ecdsa_context *ctx)
{
(void)ctx;
}

static inline void bootutil_ecdsa_drop(bootutil_ecdsa_context *ctx)
{
(void)ctx;
}

static inline int bootutil_ecdsa_verify(bootutil_ecdsa_context *ctx,
uint8_t *pk, size_t pk_len,
uint8_t *hash, size_t hash_len,
uint8_t *sig, size_t sig_len)
{
(void)ctx;
(void)pk_len;
(void)hash_len;
uint8_t dsig[2 * NUM_ECC_BYTES];

if (bootutil_decode_sig(dsig, sig, sig + sig_len)) {
return -1;
}

/* Only support uncompressed keys. */
if (pk[0] != 0x04) {
return -1;
}
pk++;

return bl_secp256r1_validate(hash, BOOTUTIL_CRYPTO_ECDSA_P256_HASH_SIZE, pk, dsig);
}

static inline int bootutil_ecdsa_parse_public_key(bootutil_ecdsa_context *ctx,
uint8_t **cp,uint8_t *end)
{
(void)ctx;
return bootutil_import_key(cp, end);
}
#endif /* MCUBOOT_USE_NRF_EXTERNAL_CRYPTO */

#ifdef __cplusplus
}
#endif
Expand Down
Loading
Loading