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

[nrf noup] boot: zephyr: let secondary_1 slot be in regular flash #235

Open
wants to merge 89 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
89 commits
Select commit Hold shift + click to select a range
cf90d55
[nrf noup] zephyr: Remove duplication from cmake
sigvartmh Mar 26, 2019
5b6e0b2
[nrf noup] boot: add 'minimal' configuration files
mbolivar-nordic Sep 3, 2021
74bb73a
[nrf noup] boot: zephyr: add support for Thingy:91
bjda Sep 20, 2019
4c1d75f
[nrf noup] boot: zephyr: Enable zeroize ALT func
Vge0rge Feb 3, 2022
8ba5c7f
[nrf noup] Restore default RTC user channel count
Damian-Nordic Mar 21, 2022
39f179d
[nrf noup] ci: add downstream-only NCS customizations
thst-nordic Nov 23, 2018
e02925a
[nrf noup] bootutil: loader: work-around for multi-image builds
sigvartmh Mar 30, 2021
16fd63c
[nrf noup] treewide: add NCS partition manager support
SebastianBoe Dec 12, 2018
5f71e80
[nrf noup] boot: bootutil: Add shared crypto for ECDSA and SHA
sigvartmh Feb 14, 2019
0030544
[nrf noup] boot: nrf53-specific customizations
sigvartmh Aug 27, 2020
1f14ccb
[nrf noup] do_boot: clean peripherals state before boot
nvlsianpu Feb 27, 2020
a47c9c4
[nrf noup] zephyr: Clean up non-secure RAM if enabled
sigvartmh Jan 6, 2023
c8e7fbd
[nrf noup] zephyr: Set at least provide EXT_API
Vge0rge Nov 8, 2021
48ad055
[nrf noup] loader: Fix reading reset addr to support ext flash
chrta Feb 10, 2022
685c58e
[nrf noup] boot: bootutil: Add required signature decoding
de-nordic Apr 21, 2023
09bad48
[nrf noup] bootloader: mcuboot: Fix wrong use of if defined
osaether Jun 20, 2023
5777337
[nrf noup] Fix path variables
nordicjm Jul 11, 2023
815fa3a
[nrf noup] bootutil: Fix missing PCD define check
nordicjm Aug 31, 2023
52997e1
[nrf noup] boot: zephyr: Add ifdef protection for RAM locking
nordicjm Aug 31, 2023
a0c919b
[nrf fromtree] zephyr: Provide third image cases for direct image upload
de-nordic Sep 4, 2023
b518e13
[nrf noup] booutil: loader: Add support for NSIB and multi-image
sigvartmh May 31, 2023
0383b7c
[nrf noup] zephyr: Move partition manager definitions to pm_sysflash.h
de-nordic Aug 10, 2023
745cf4e
[nrf noup] booutil: loader: Fixup for NSIB and multi-image
sigvartmh Sep 15, 2023
5822244
[nrf noup] zephyr: Add support for three images
de-nordic Aug 11, 2023
4fe70b6
[nrf noup] booutil: loader: Do not check reset vector for XIP image
de-nordic Sep 22, 2023
100ea3d
[nrf fromtree] zephyr: Fix boot serial extensions
nordicjm Aug 29, 2023
1e6532a
[nrf fromtree] zephyr: Fall back to minimal C library
nordicjm Sep 12, 2023
ec0aa5f
[nrf fromtree] boot_serial: Fix include
nordicjm Sep 12, 2023
c15589e
[nrf fromtree] bootutil: Add mode for XIP with revert
nordicjm Sep 27, 2023
eb1ff87
[nrf fromtree] bootutil: Add shared data support for XIP with revert …
nordicjm Sep 27, 2023
d9ed9a6
[nrf noup] github: Add a commit tags check workflow
carlescufi Oct 10, 2023
9cd1de1
[nrf noup] zephyr: Add RAM flash configuration to cache for sysbuild
nordicjm Sep 18, 2023
862bca5
[nrf noup] sysflash: pm_sysflash: Fix incorrect define exclude for NSIB
sigvartmh Oct 16, 2023
01f17eb
[nrf noup] boot: zephyr: Boot even if EXT_ABI is not provided
sigvartmh Oct 17, 2023
4d9859a
[nrf noup] loader: Add firmware version check downgrade prevention
sigvartmh Sep 27, 2023
2891664
[nrf noup] crypto: ecdsa: Fix shared crypto MCUBoot EXT_ABI
sigvartmh Oct 10, 2023
adab597
[nrf noup] boards: thingy53: disable GPIO ISR support
nika-nordic Oct 9, 2023
c65b011
Revert "[nrf noup] boards: thingy53: disable GPIO ISR support"
de-nordic Dec 15, 2023
621a102
Revert "[nrf noup] crypto: ecdsa: Fix shared crypto MCUBoot EXT_ABI"
de-nordic Dec 15, 2023
17d745b
Revert "[nrf noup] loader: Add firmware version check downgrade preve…
de-nordic Dec 15, 2023
d617937
Revert "[nrf noup] boot: zephyr: Boot even if EXT_ABI is not provided"
de-nordic Dec 15, 2023
46e2c5f
Revert "[nrf noup] sysflash: pm_sysflash: Fix incorrect define exclud…
de-nordic Dec 15, 2023
a77c658
Revert "[nrf noup] zephyr: Add RAM flash configuration to cache for s…
de-nordic Dec 15, 2023
064317a
Revert "[nrf fromtree] bootutil: Add shared data support for XIP with…
de-nordic Dec 15, 2023
6ffc7a8
Revert "[nrf fromtree] bootutil: Add mode for XIP with revert"
de-nordic Dec 15, 2023
6e93f89
Revert "[nrf fromtree] boot_serial: Fix include"
de-nordic Dec 15, 2023
938fee4
Revert "[nrf fromtree] zephyr: Fall back to minimal C library"
de-nordic Dec 15, 2023
4ffc7e5
Revert "[nrf fromtree] zephyr: Fix boot serial extensions"
de-nordic Dec 15, 2023
d4ec39f
Revert "[nrf noup] booutil: loader: Do not check reset vector for XIP…
de-nordic Dec 15, 2023
7f264cb
Revert "[nrf noup] zephyr: Add support for three images"
de-nordic Dec 15, 2023
6b1b597
Revert "[nrf noup] booutil: loader: Fixup for NSIB and multi-image"
de-nordic Dec 15, 2023
40b8248
Revert "[nrf noup] zephyr: Move partition manager definitions to pm_s…
de-nordic Dec 15, 2023
71c3335
Revert "[nrf noup] booutil: loader: Add support for NSIB and multi-im…
de-nordic Dec 15, 2023
ccf1951
Revert "[nrf fromtree] zephyr: Provide third image cases for direct i…
de-nordic Dec 15, 2023
80e1aa1
Revert "[nrf noup] boot: zephyr: Add ifdef protection for RAM locking"
de-nordic Dec 15, 2023
759d139
Revert "[nrf noup] bootutil: Fix missing PCD define check"
de-nordic Dec 15, 2023
37c1045
Revert "[nrf noup] Fix path variables"
de-nordic Dec 15, 2023
ffcb820
Revert "[nrf noup] bootloader: mcuboot: Fix wrong use of if defined"
de-nordic Dec 15, 2023
211fd1e
Revert "[nrf noup] loader: Fix reading reset addr to support ext flash"
de-nordic Dec 15, 2023
131f9a5
Revert "[nrf noup] zephyr: Clean up non-secure RAM if enabled"
de-nordic Dec 15, 2023
78400ba
Revert "[nrf noup] do_boot: clean peripherals state before boot"
de-nordic Dec 15, 2023
b5e78c0
Revert "[nrf noup] boot: nrf53-specific customizations"
de-nordic Dec 15, 2023
2f210c2
Revert "[nrf noup] treewide: add NCS partition manager support"
de-nordic Dec 15, 2023
d887ba1
Revert "[nrf noup] Restore default RTC user channel count"
de-nordic Dec 15, 2023
5d24482
[nrf mergeup] Merge upstream up to commit 0c0470e294dcfb52aab92299356…
de-nordic Dec 15, 2023
9fa2c07
[nrf noup] Restore default RTC user channel count
Damian-Nordic Mar 21, 2022
71fe2df
[nrf noup] treewide: add NCS partition manager support
SebastianBoe Dec 12, 2018
2bbd3b1
[nrf noup] boot: nrf53-specific customizations
sigvartmh Aug 27, 2020
4c8e041
[nrf noup] do_boot: clean peripherals state before boot
nvlsianpu Feb 27, 2020
b8a544d
[nrf noup] zephyr: Clean up non-secure RAM if enabled
sigvartmh Jan 6, 2023
9403865
[nrf noup] loader: Fix reading reset addr to support ext flash
chrta Feb 10, 2022
7f2386f
[nrf noup] bootloader: mcuboot: Fix wrong use of if defined
osaether Jun 20, 2023
be3e7c6
[nrf noup] Fix path variables
nordicjm Jul 11, 2023
5932630
[nrf noup] bootutil: Fix missing PCD define check
nordicjm Aug 31, 2023
0098451
[nrf noup] boot: zephyr: Add ifdef protection for RAM locking
nordicjm Aug 31, 2023
03af90f
[nrf noup] booutil: loader: Add support for NSIB and multi-image
sigvartmh May 31, 2023
c3b33eb
[nrf noup] zephyr: Move partition manager definitions to pm_sysflash.h
de-nordic Aug 10, 2023
0d43674
[nrf noup] booutil: loader: Fixup for NSIB and multi-image
sigvartmh Sep 15, 2023
77c7e25
[nrf noup] zephyr: Add support for three images
de-nordic Aug 11, 2023
30181d8
[nrf noup] booutil: loader: Do not check reset vector for XIP image
de-nordic Sep 22, 2023
c19337f
[nrf noup] zephyr: Add RAM flash configuration to cache for sysbuild
nordicjm Sep 18, 2023
d700515
[nrf noup] sysflash: pm_sysflash: Fix incorrect define exclude for NSIB
sigvartmh Oct 16, 2023
e6e72a0
[nrf noup] boot: zephyr: Boot even if EXT_ABI is not provided
sigvartmh Oct 17, 2023
4441695
[nrf noup] loader: Add firmware version check downgrade prevention
sigvartmh Sep 27, 2023
4015754
[nrf noup] crypto: ecdsa: Fix shared crypto MCUBoot EXT_ABI
sigvartmh Oct 10, 2023
69805fa
[nrf noup] boards: thingy53: disable GPIO ISR support
nika-nordic Oct 9, 2023
beebb23
[nrf noup] bootutil: crypto: sha: Fix external crypto defines
nordicjm Dec 15, 2023
a9d5fa7
[nrf noup] boards: thingy91x: add board config
maxd-nordic Dec 8, 2023
18135b8
[nrf noup] boot: zephyr: let secondary_1 slot be in regular flash
sigvartmh Jan 25, 2023
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
19 changes: 19 additions & 0 deletions .github/workflows/backport.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Backport
on:
pull_request:
types:
- closed
- labeled

jobs:
backport:
runs-on: ubuntu-18.04
name: Backport
steps:
- name: Backport Bot
uses: Gaurav0/[email protected]
with:
bot_username: NordicBuilder
bot_token: 151a9b45052f9ee8be5a59963d31ad7b92c3ecb5
bot_token_key: 67bb1f1f998d546859786a4088917c65415c0ebd
github_token: ${{ secrets.GITHUB_TOKEN }}
31 changes: 31 additions & 0 deletions .github/workflows/commit-tags.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Commit tags

on: pull_request

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: Install python dependencies
run: |
pip3 install setuptools
pip3 install wheel
pip3 install gitlint
- name: Run the commit tags
uses: nrfconnect/action-commit-tags@main
with:
target: '.'
baserev: origin/${{ github.base_ref }}
revrange: 'none'
57 changes: 57 additions & 0 deletions .gitlint
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# All these sections are optional, edit this file as you like.
[general]
ignore=title-trailing-punctuation, T3, title-max-length, T1, body-hard-tab, B3, B1
# verbosity should be a value between 1 and 3, the commandline -v flags take precedence over this
verbosity = 3
# By default gitlint will ignore merge commits. Set to 'false' to disable.
ignore-merge-commits=true
# Enable debug mode (prints more output). Disabled by default
debug = false

# Set the extra-path where gitlint will search for user defined rules
# See http://jorisroovers.github.io/gitlint/user_defined_rules for details
extra-path=../../zephyr/scripts/gitlint

[title-max-length-no-revert]
line-length=72

[body-min-line-count]
min-line-count=1

[body-max-line-count]
max-line-count=200

[title-starts-with-subsystem]
regex = ^(?!subsys:)(([^:]+):)(\s([^:]+):)*\s(.+)$

[title-must-not-contain-word]
# Comma-separated list of words that should not occur in the title. Matching is case
# insensitive. It's fine if the keyword occurs as part of a larger word (so "WIPING"
# will not cause a violation, but "WIP: my title" will.
words=wip

[title-match-regex]
# python like regex (https://docs.python.org/2/library/re.html) that the
# commit-msg title must be matched to.
# Note that the regex can contradict with other rules if not used correctly
# (e.g. title-must-not-contain-word).
#regex=^US[0-9]*

[max-line-length-with-exceptions]
# B1 = body-max-line-length
line-length=72

[body-min-length]
min-length=3

[body-is-missing]
# Whether to ignore this rule on merge commits (which typically only have a title)
# default = True
ignore-merge-commits=false

[body-changed-file-mention]
# List of files that need to be explicitly mentioned in the body when they are changed
# This is useful for when developers often erroneously edit certain files or git submodules.
# By specifying this rule, developers can only change the file when they explicitly reference
# it in the commit message.
#files=gitlint/rules.py,README.md
6 changes: 6 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
@Library("CI_LIB") _

def pipeline = new ncs.sdk_mcuboot.Main()

pipeline.run(JOB_NAME)

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 @@ -594,6 +603,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
32 changes: 32 additions & 0 deletions boot/bootutil/include/bootutil/crypto/sha.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@

#if (defined(MCUBOOT_USE_PSA_OR_MBED_TLS) + \
defined(MCUBOOT_USE_TINYCRYPT) + \
defined(MCUBOOT_USE_NRF_EXTERNAL_CRYPTO) + \
defined(MCUBOOT_USE_CC310)) != 1
#error "One crypto backend must be defined: either CC310/MBED_TLS/TINYCRYPT/PSA_CRYPTO"
#endif
Expand Down Expand Up @@ -206,6 +207,37 @@ static inline int bootutil_sha_finish(bootutil_sha_context *ctx,
}
#endif /* MCUBOOT_USE_CC310 */

#if defined(MCUBOOT_USE_NRF_EXTERNAL_CRYPTO)

#include <bl_crypto.h>

typedef bl_sha256_ctx_t bootutil_sha_context;

static inline void bootutil_sha_init(bootutil_sha_context *ctx)
{
bl_sha256_init(ctx);
}

static inline void bootutil_sha_drop(bootutil_sha_context *ctx)
{
(void)ctx;
}

static inline int bootutil_sha_update(bootutil_sha_context *ctx,
const void *data,
uint32_t data_len)
{
return bl_sha256_update(ctx, data, data_len);
}

static inline int bootutil_sha_finish(bootutil_sha_context *ctx,
uint8_t *output)
{
bl_sha256_finalize(ctx, output);
return 0;
}
#endif /* MCUBOOT_USE_NRF_EXTERNAL_CRYPTO */

#ifdef __cplusplus
}
#endif
Expand Down
Loading
Loading