Skip to content

Commit bbca448

Browse files
committed
[nrf mergeup] Merge upstream up to commit 2fce976
Reular upmerge to upstream: 2fce976 Signed-off-by: Andrzej Puzdrowski <[email protected]>
2 parents d816ab0 + 2fce976 commit bbca448

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+914
-2190
lines changed

.github/workflows/imgtool.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
on:
22
push:
33
branches:
4-
- master
4+
- main
55
- v*-branch
66

77
name: imgtool

.github/workflows/mynewt.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
on:
33
push:
44
branches:
5-
- master
5+
- main
66
pull_request:
77

88
name: Mynewt

.github/workflows/sim.yaml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
on:
33
push:
44
branches:
5-
- master
5+
- main
66
pull_request:
77

88
name: Sim
@@ -26,10 +26,7 @@ jobs:
2626
- "sig-ecdsa-mbedtls enc-kw validate-primary-slot"
2727
- "sig-rsa validate-primary-slot overwrite-only large-write"
2828
- "sig-ecdsa enc-ec256 validate-primary-slot"
29-
# ecdsa-mbedtls and enc-ec256 are not currently supported
30-
# together, as the ec256 code requires only one backend be
31-
# active.
32-
# - "sig-ecdsa-mbedtls enc-ec256 validate-primary-slot"
29+
- "sig-ecdsa-mbedtls enc-ec256-mbedtls validate-primary-slot"
3330
- "sig-rsa validate-primary-slot overwrite-only downgrade-prevention"
3431
runs-on: ubuntu-latest
3532
env:

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
[submodule "sim/mbedtls"]
22
path = ext/mbedtls
33
url = https://github.com/ARMmbed/mbedtls
4+
[submodule "boot/cypress/libs/mtb-pdl-cat1"]
5+
path = boot/cypress/libs/mtb-pdl-cat1
6+
url = https://github.com/cypresssemiconductorco/mtb-pdl-cat1.git
47
[submodule "boot/cypress/libs/pdl/psoc6pdl"]
58
path = boot/cypress/libs/pdl/psoc6pdl
69
url = https://github.com/cypresssemiconductorco/psoc6pdl.git

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
[![Build Status (Sim)](https://github.com/mcu-tools/mcuboot/workflows/Sim/badge.svg)][sim]
66
[![Build Status (Mynewt)](https://github.com/mcu-tools/mcuboot/workflows/Mynewt/badge.svg)][mynewt]
77
[![Publishing Status (imgtool)](https://github.com/mcu-tools/mcuboot/workflows/imgtool/badge.svg)][imgtool]
8-
[![Build Status (Travis CI)](https://img.shields.io/travis/mcu-tools/mcuboot/master.svg?label=travis-ci)][travis]
8+
[![Build Status (Travis CI)](https://img.shields.io/travis/mcu-tools/mcuboot/main.svg?label=travis-ci)][travis]
99
[![Apache 2.0](https://img.shields.io/badge/License-Apache%202.0-blue.svg)][license]
1010

1111
[pypi]: https://pypi.org/project/imgtool/
@@ -14,7 +14,7 @@
1414
[mynewt]: https://github.com/mcu-tools/mcuboot/actions?query=workflow:Mynewt
1515
[imgtool]: https://github.com/mcu-tools/mcuboot/actions?query=workflow:imgtool
1616
[travis]: https://travis-ci.org/mcu-tools/mcuboot
17-
[license]: https://github.com/mcu-tools/mcuboot/blob/master/LICENSE
17+
[license]: https://github.com/mcu-tools/mcuboot/blob/main/LICENSE
1818

1919
This is mcuboot version 1.8.0-dev
2020

boot/boot_serial/src/boot_serial.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
#include "bootutil/bootutil_log.h"
2828

2929
#ifdef __ZEPHYR__
30-
#include <power/reboot.h>
30+
#include <sys/reboot.h>
3131
#include <sys/byteorder.h>
3232
#include <sys/__assert.h>
3333
#include <drivers/flash.h>
@@ -436,7 +436,11 @@ bs_reset(char *buf, int len)
436436
bs_empty_rsp(buf, len);
437437

438438
#ifdef __ZEPHYR__
439+
#ifdef CONFIG_MULTITHREADING
439440
k_sleep(K_MSEC(250));
441+
#else
442+
k_busy_wait(250000);
443+
#endif
440444
sys_reboot(SYS_REBOOT_COLD);
441445
#else
442446
os_cputime_delay_usecs(250000);

boot/bootutil/include/bootutil/bootutil_public.h

Lines changed: 41 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* Copyright (c) 2017-2019 Linaro LTD
55
* Copyright (c) 2016-2019 JUUL Labs
6-
* Copyright (c) 2019-2020 Arm Limited
6+
* Copyright (c) 2019-2021 Arm Limited
77
* Copyright (c) 2020 Nordic Semiconductor ASA
88
*
99
* Original license:
@@ -147,25 +147,54 @@ int boot_swap_type_multi(int image_index);
147147
int boot_swap_type(void);
148148

149149
/**
150-
* Marks the image in the secondary slot as pending. On the next reboot,
151-
* the system will perform a one-time boot of the the secondary slot image.
150+
* Marks the image with the given index in the secondary slot as pending. On the
151+
* next reboot, the system will perform a one-time boot of the the secondary
152+
* slot image.
152153
*
153-
* @param permanent Whether the image should be used permanently or
154-
* only tested once:
155-
* 0=run image once, then confirm or revert.
156-
* 1=run image forever.
154+
* @param image_index Image pair index.
157155
*
158-
* @return 0 on success; nonzero on failure.
156+
* @param permanent Whether the image should be used permanently or
157+
* only tested once:
158+
* 0=run image once, then confirm or revert.
159+
* 1=run image forever.
160+
*
161+
* @return 0 on success; nonzero on failure.
162+
*/
163+
int boot_set_pending_multi(int image_index, int permanent);
164+
165+
/**
166+
* Marks the image with index 0 in the secondary slot as pending. On the next
167+
* reboot, the system will perform a one-time boot of the the secondary slot
168+
* image. Note that this API is kept for compatibility. The
169+
* boot_set_pending_multi() API is recommended.
170+
*
171+
* @param permanent Whether the image should be used permanently or
172+
* only tested once:
173+
* 0=run image once, then confirm or revert.
174+
* 1=run image forever.
175+
*
176+
* @return 0 on success; nonzero on failure.
159177
*/
160178
int boot_set_pending(int permanent);
161179

162180
/**
163-
* @brief Marks the image in the primary slot as confirmed.
181+
* Marks the image with the given index in the primary slot as confirmed. The
182+
* system will continue booting into the image in the primary slot until told to
183+
* boot from a different slot.
164184
*
165-
* The system will continue booting into the image in the primary slot until
166-
* told to boot from a different slot.
185+
* @param image_index Image pair index.
167186
*
168-
* @return 0 on success; nonzero on failure.
187+
* @return 0 on success; nonzero on failure.
188+
*/
189+
int boot_set_confirmed_multi(int image_index);
190+
191+
/**
192+
* Marks the image with index 0 in the primary slot as confirmed. The system
193+
* will continue booting into the image in the primary slot until told to boot
194+
* from a different slot. Note that this API is kept for compatibility. The
195+
* boot_set_confirmed_multi() API is recommended.
196+
*
197+
* @return 0 on success; nonzero on failure.
169198
*/
170199
int boot_set_confirmed(void);
171200

boot/bootutil/include/bootutil/crypto/ecdh_p256.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ static inline int bootutil_ecdh_p256_shared_secret(bootutil_ecdh_p256_context *c
6868
#endif /* MCUBOOT_USE_TINYCRYPT */
6969

7070
#if defined(MCUBOOT_USE_MBED_TLS)
71+
#define NUM_ECC_BYTES 32
72+
7173
typedef struct bootutil_ecdh_p256_context {
7274
mbedtls_ecp_group grp;
7375
mbedtls_ecp_point P;

boot/bootutil/src/bootutil_misc.c

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -294,47 +294,6 @@ boot_read_enc_key(int image_index, uint8_t slot, struct boot_status *bs)
294294
}
295295
#endif
296296

297-
/**
298-
* Write trailer data; status bytes, swap_size, etc
299-
*
300-
* @returns 0 on success, != 0 on error.
301-
*/
302-
static int
303-
boot_write_trailer(const struct flash_area *fap, uint32_t off,
304-
const uint8_t *inbuf, uint8_t inlen)
305-
{
306-
uint8_t buf[BOOT_MAX_ALIGN];
307-
uint8_t align;
308-
uint8_t erased_val;
309-
int rc;
310-
311-
align = flash_area_align(fap);
312-
if (inlen > BOOT_MAX_ALIGN || align > BOOT_MAX_ALIGN) {
313-
return -1;
314-
}
315-
erased_val = flash_area_erased_val(fap);
316-
if (align < inlen) {
317-
align = inlen;
318-
}
319-
memcpy(buf, inbuf, inlen);
320-
memset(&buf[inlen], erased_val, align - inlen);
321-
322-
rc = flash_area_write(fap, off, buf, align);
323-
if (rc != 0) {
324-
return BOOT_EFLASH;
325-
}
326-
327-
return 0;
328-
}
329-
330-
static int
331-
boot_write_trailer_flag(const struct flash_area *fap, uint32_t off,
332-
uint8_t flag_val)
333-
{
334-
const uint8_t buf[1] = { flag_val };
335-
return boot_write_trailer(fap, off, buf, 1);
336-
}
337-
338297
int
339298
boot_write_copy_done(const struct flash_area *fap)
340299
{

boot/bootutil/src/bootutil_priv.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,10 @@ int boot_write_image_ok(const struct flash_area *fap);
251251
int boot_write_swap_info(const struct flash_area *fap, uint8_t swap_type,
252252
uint8_t image_num);
253253
int boot_write_swap_size(const struct flash_area *fap, uint32_t swap_size);
254+
int boot_write_trailer(const struct flash_area *fap, uint32_t off,
255+
const uint8_t *inbuf, uint8_t inlen);
256+
int boot_write_trailer_flag(const struct flash_area *fap, uint32_t off,
257+
uint8_t flag_val);
254258
int boot_read_swap_size(int image_index, uint32_t *swap_size);
255259
int boot_slots_compatible(struct boot_loader_state *state);
256260
uint32_t boot_status_internal_off(const struct boot_status *bs, int elem_sz);

0 commit comments

Comments
 (0)