Instead of manually setting the text section offset and the overlay
file, use the now readily available BOOTLOADER_MCUBOOT Kconfig option to
provide that automatically.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
Allow the user to add additional device tree overlays onto the default
one that sets up the code partition.
Signed-off-by: Marti Bolivar <marti@opensourcefoundries.com>
The macro _MspSet has gone away in Zephyr. Change to use the __set_MSP
macro from the CMSIS code that has always been present. This allows
mcuboot to build with Zephyr after:
commit c028f88b37d2a033d6a85c8d365ef048e1e4d621
Author: Ioannis Glaropoulos <Ioannis.Glaropoulos@nordicsemi.no>
Date: Mon Mar 12 10:45:02 2018 +0100
arch: arm: remove redundant asm inline headers
Fixes#246.
Signed-off-by: David Brown <david.brown@linaro.org>
The Zephyr CMakeLists.txt uses its own logic to have board-specific
overlays, named boards/${BOARD}.prj. However, the only overlay file we
have, arduino_101.conf, isn't in this boards directory, and this target
doesn't build.
Fix this by moving the target into the right directory. Fixes#188.
Signed-off-by: David Brown <david.brown@linaro.org>
The boot loader app needs all the base dependencies, whether or not
`BOOT_SERIAL` is enabled. Therefore, it makes sense for the serial boot
loader to add to, rather than replace, the dependency list.
This bug in the pkg.yml file went unnoticed ealier because of an issue
in newt: it used to effectively ignore the `.OVERWRITE` suffix when it
was applied to `pkg.deps`.
Signed-off-by: Christopher Collins <ccollins@apache.org>
Although MCUboot has used PKCS#1 v2.1 (PSS) for some time now, the mbed
TLS config file was calling out v1.5. This compiled because MCUboot
implements its own specialized version of the signature check, and only
needs the underlying primitives from mbed TLS. (The general code in
mbed TLS is quite a bit larger).
To make it clear that we are always using PSS, change the mbed TLS
configuration to call this out explicitly.
Signed-off-by: David Brown <david.brown@linaro.org>
BOOT_STATUS_ASSERT increments the variable if the macro argument
is evaluated as true, which is incorrect behavior compared to the
ASSERT macro.
Signed-off-by: Johann Fischer <j.fischer@phytec.de>
Upstream zephyr will automatically link mbedtls when CONFIG_MBEDTLS is
enabled.
If user chose to use ECDSA_P256 as signature type, will get a compile
error message in file ${ZEPHYR_BASE}/ext/lib/crypto/mbedtls/zephyr_init.c:
fatal error: config-asn1.h: No such file or directory
Fix this by disable CONFIG_MBEDTLS when ECDSA_P256 signature type is
selected.
Signed-off-by: Ding Tao <miyatsu@qq.com>
2.7.0 fixes a security issue but breaks MCU boot. Bump to this version
so that the simulator will verify that this version works properly.
Signed-off-by: David Brown <david.brown@linaro.org>
In 2f8f06aa25
commit 2f8f06aa25e9d5ee4fc9fe217543c872b39e4d05
Author: Hanno Becker <hanno.becker@arm.com>
Date: Fri Sep 29 11:47:26 2017 +0100
Don't always recompute context length in mbedtls_rsa_get_len
mbed TLS begins assuming that the 'len' field of the context has been
set properly. Previously, we relied on this not being true, and various
tests fail for all keys without setting this.
The fix is to simply set the length based on the value we read.
fixes#235.
Signed-off-by: David Brown <david.brown@linaro.org>
Github pages assumes that links to files using relative
names point to the same location so this should work both
when accessing through the github browser and mcuboot.com
Signed-off-by: Fabio Utzig <utzig@apache.org>
Some platforms prefer images in the Intel Hex (.hex) format. Implement
support for signing images in this format in imgtool.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
Instead of relying on distro packages standardize the imgtool
dependencies into a requirements.txt.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
The upstream Zephyr project is renaming FLASH_DRIVER_NAME to
FLASH_DEV_NAME as part of some changes related to device tree.
Work around this for now by keeping the MCUboot name the same if
FLASH_DRIVER_NAME is not provided by Zephyr, but FLASH_DEV_NAME is.
Signed-off-by: Marti Bolivar <marti@opensourcefoundries.com>
It's recommended practice to mass erase the flash chip before
reflashing mcuboot. Add a configuration option for Zephyr which does
this by default on some Zephyr runner backends which can support
this (pyOCD and dfu-util). Additional runners can be added as needed.
Signed-off-by: Marti Bolivar <marti@opensourcefoundries.com>
When the target doesn't have good enough generic support for MCUBoot,
you can specify the flash layout etc on a per-board basis by creating
a header, boot/zephyr/targets/BOARD.h.
The build system tries to pick this up, but isn't doing it
correctly. Fix it.
Signed-off-by: Marti Bolivar <marti@opensourcefoundries.com>
Enhance the test runner so that it can verify the output of the tests by
itself. This needs the console to be logged to a file, but otherwise
works the same as the current test runner.
Also, the build results are placed in a log file, so that it is easier
to see what is happening.
Signed-off-by: David Brown <david.brown@linaro.org>
Since the Kconfig file was moved in 51a0921006 ("zephyr: Move Kconfig
file to boot/zephyr"), the CMakeLists.txt reference to it needs updating.
Signed-off-by: Marti Bolivar <marti@opensourcefoundries.com>
Since not all ICs default to enabling flash page layout, enable it from
the MCUboot Kconfig options whenever it is available.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
Add a new MCUboot device settings option that enables or configures
features that are specific to a particular device.
Additionally enable software vector relay in Cortex-M0 CPUs that do not
have a hardware mechanism to relay or forward interrupts.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
Since the Kconfig file is only relevant to Zephyr, move it from the root
folder into boot/zephyr, in order to keep all Zephyr-related files
together.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
hello-world is serving as a sample application and should therefore
not define a default board as Zephyr samples do not either.
Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
The documentation claims that one can place per-board overlay files in
the boards/ directory. But no such support has been implemented.
Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
When a relative path was used the build would fail when CMake was
invoked with the -B -H flags. Using an absolute path for the
dts.overlay flags fixes#187.
Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
Link to usage instructions from the main README file and from
docs/index.md so that the usage is visible from the root documentation
files.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
To avoid having multiple documentation standards, transition all
documentation files to the Markdown (md) format and move them to the
docs/ folder.
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
Update the dependencies needed, as well as adding a blurb about how to
password protect the private key.
Signed-off-by: David Brown <david.brown@linaro.org>
Until we fix the padding problem, pad the ecdsa signatures with zeros to
always be 72 bytes long. Add a 'raw_sign' method so that the unit test
can use the real signature.
Signed-off-by: David Brown <david.brown@linaro.org>
Replace the (now broken) ECDSA code with code using the python
'cryptography' library.
Similar to the change to RSA, this changes the format that private keys
are stored, again using PKCS#8. This supports the stronger password
protection as well.
Again, this code will still support reading the older style of public
keys, but other tools that use keys generated by this change will need
to be updated to work with the new format.
Signed-off-by: David Brown <david.brown@linaro.org>
The verification code requires a fixed 32-byte salt, which seems is what
the old crypto library did. Use this same value to avoid having to
modify the code.
Signed-off-by: David Brown <david.brown@linaro.org>
The keygen command allows the `-p` argument which will prompt for a
password, and protect the private key with this password. When loading
keys, it will prompt for a password if it detects a password protected
key.
Signed-off-by: David Brown <david.brown@linaro.org>
The 'cryptography' library is pickier about the data it is asked to
sign. Get the bytes value out of the bytearray for doing the actual
signature.
Signed-off-by: David Brown <david.brown@linaro.org>
Replace RSA code with one using the python 'cryptography' library. This
library is much more complete, and will make adding support for password
protected keys, and separate public keys easier.
There is, however, a significant change brought about by this change:
the private keys are stored in PKCS#8 format, instead of the raw format
that was used previously. This is a more modern format that has a few
advantages, including: supporting stronger password protection, and
allowing the key type to be determined upon read.
This tool will still support reading the old style public keys, but
other tools that use these keys will need to be updated in order to work
with the new format.
This new code has some unit tests to go along with it for some basic
sanity testing of the code.
Signed-off-by: David Brown <david.brown@linaro.org>
Support for PKCS1.5 has been removed from the bootloader for a while
now, remove it as well from the tool.
Signed-off-by: David Brown <david.brown@linaro.org>