Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
7 changes: 3 additions & 4 deletions .ci/check-unwanted-symbols
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,11 @@ check_production_bootloader() {
"Use the existing PUKCC SHA-256 implementation in production bootloaders instead."
}

firmware_elf=build/bin/firmware.elf
if [[ -f "$firmware_elf" ]]; then
shopt -s nullglob
for firmware_elf in build/bin/firmware*.elf; do
check_firmware "$firmware_elf"
fi
done

shopt -s nullglob
for bootloader_elf in build/bin/*-bl-*-production.elf; do
check_production_bootloader "$bootloader_elf"
done
Expand Down
18 changes: 10 additions & 8 deletions .github/workflows/ci-common.yml
Original file line number Diff line number Diff line change
Expand Up @@ -207,15 +207,17 @@ jobs:
- bootloader-btc
- bootloader-btc-development
- bootloader-btc-production
- bootloader-plus
- bootloader-plus-development
- bootloader-plus-production
- bootloader-plus-debug
- bootloader-plus-btc
- bootloader-plus-btc-development
- bootloader-plus-btc-production
- bootloader-nova
- bootloader-nova-development
- bootloader-nova-production
- bootloader-nova-debug
- bootloader-nova-btc
- bootloader-nova-btc-development
- bootloader-nova-btc-production
- firmware
- firmware-btc
- firmware-nova
- firmware-nova-btc
- factory-setup
- firmware-debug
- simulator
Expand All @@ -242,7 +244,7 @@ jobs:
run: make -j$(($(nproc)+1)) ${{ matrix.target }}

- name: Check unwanted symbols
if: (matrix.target == 'firmware' || (startsWith(matrix.target, 'bootloader') && endsWith(matrix.target, 'production'))) && !cancelled()
if: ((matrix.target == 'firmware' || matrix.target == 'firmware-nova') || (startsWith(matrix.target, 'bootloader') && endsWith(matrix.target, 'production'))) && !cancelled()
run: ./.ci/check-unwanted-symbols

- name: Print hashes
Expand Down
26 changes: 15 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ firmware: | build
$(MAKE) -C build firmware.elf
firmware-btc: | build
$(MAKE) -C build firmware-btc.elf
firmware-nova: | build
$(MAKE) -C build firmware-nova.elf
firmware-nova-btc: | build
$(MAKE) -C build firmware-nova-btc.elf
firmware-debug: | build-debug
$(MAKE) -C build-debug firmware.elf

Expand All @@ -70,20 +74,20 @@ bootloader-btc-development: | build
bootloader-btc-production: | build
$(MAKE) -C build bb02-bl-btconly-production.elf

bootloader-plus: | build
bootloader-nova: | build
$(MAKE) -C build bb02p-bl-multi.elf
bootloader-plus-development: | build
bootloader-nova-development: | build
$(MAKE) -C build bb02p-bl-multi-development.elf
bootloader-plus-production: | build
bootloader-nova-production: | build
$(MAKE) -C build bb02p-bl-multi-production.elf
bootloader-plus-debug: | build-debug
bootloader-nova-debug: | build-debug
$(MAKE) -C build-debug bb02p-bl-multi-development.elf

bootloader-plus-btc: | build
bootloader-nova-btc: | build
$(MAKE) -C build bb02p-bl-btconly.elf
bootloader-plus-btc-development: | build
bootloader-nova-btc-development: | build
$(MAKE) -C build bb02p-bl-btconly-development.elf
bootloader-plus-btc-production: | build
bootloader-nova-btc-production: | build
$(MAKE) -C build bb02p-bl-btconly-production.elf

factory-setup: | build
Expand Down Expand Up @@ -125,9 +129,9 @@ flash-dev-firmware:
./py/load_firmware.py build/bin/firmware.bin --debug
jlink-flash-bootloader-development: | build
JLinkExe -NoGui 1 -if SWD -device ATSAMD51J20 -speed 4000 -autoconnect 1 -CommanderScript ./build/scripts/bb02-bl-multi-development.jlink
jlink-flash-bootloader-plus-development: | build
jlink-flash-bootloader-nova-development: | build
JLinkExe -NoGui 1 -if SWD -device ATSAMD51J20 -speed 4000 -autoconnect 1 -CommanderScript ./build/scripts/bb02p-bl-multi-development.jlink
jlink-flash-bootloader-btc-plus-development: | build
jlink-flash-bootloader-btc-nova-development: | build
JLinkExe -NoGui 1 -if SWD -device ATSAMD51J20 -speed 4000 -autoconnect 1 -CommanderScript ./build/scripts/bb02p-bl-btconly-development.jlink
jlink-flash-bootloader-development-locked: | build
JLinkExe -NoGui 1 -if SWD -device ATSAMD51J20 -speed 4000 -autoconnect 1 -CommanderScript ./build/scripts/bb02-bl-multi-development-locked.jlink
Expand All @@ -153,8 +157,8 @@ jlink-flash-reset-version:
JLinkExe -NoGui 1 -if SWD -device ATSAMD51J20 -speed 4000 -autoconnect 1 -CommanderScript ./scripts/reset-version.jlink
jlink-flash-set-securechip-optiga:
JLinkExe -NoGui 1 -if SWD -device ATSAMD51J20 -speed 4000 -autoconnect 1 -CommanderScript ./scripts/set-securechip-optiga.jlink
jlink-flash-set-bb02plus:
JLinkExe -NoGui 1 -if SWD -device ATSAMD51J20 -speed 4000 -autoconnect 1 -CommanderScript ./scripts/set-bb02plus.jlink
jlink-flash-set-bb02nova:
JLinkExe -NoGui 1 -if SWD -device ATSAMD51J20 -speed 4000 -autoconnect 1 -CommanderScript ./scripts/set-bb02nova.jlink
jlink-flash-bb02-set-factory-randomness:
JLinkExe -NoGui 1 -if SWD -device ATSAMD51J20 -speed 4000 -autoconnect 1 -CommanderScript ./scripts/bb02-set-factory-randomness.jlink
jlink-erase-firmware-quick:
Expand Down
8 changes: 4 additions & 4 deletions releases/describe_signed_firmware.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
MAGIC_LEN = 4
MAGIC_MULTI = struct.pack(">I", 0x653F362B)
MAGIC_BTCONLY = struct.pack(">I", 0x11233B0B)
MAGIC_BITBOX02PLUS_MULTI = struct.pack(">I", 0x5B648CEB)
MAGIC_BITBOX02PLUS_BTCONLY = struct.pack(">I", 0x48714774)
MAGIC_BITBOX02NOVA_MULTI = struct.pack(">I", 0x5B648CEB)
MAGIC_BITBOX02NOVA_BTCONLY = struct.pack(">I", 0x48714774)

MAX_FIRMWARE_SIZE = 884736
NUM_ROOT_KEYS = 3
Expand Down Expand Up @@ -49,9 +49,9 @@ def main() -> int:
print("This is a BitBox02 Multi firmware.")
elif magic == MAGIC_BTCONLY:
print("This is a BitBox02 Bitcoin-only firmware.")
elif magic == MAGIC_BITBOX02PLUS_MULTI:
elif magic == MAGIC_BITBOX02NOVA_MULTI:
print("This is a BitBox02 Nova Multi firmware")
elif magic == MAGIC_BITBOX02PLUS_BTCONLY:
elif magic == MAGIC_BITBOX02NOVA_BTCONLY:
print("This is a BitBox02 Nova Bitcoin-only firmware.")
else:
print(
Expand Down
File renamed without changes.
44 changes: 27 additions & 17 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -120,14 +120,14 @@ set(QTOUCH-SOURCES
)
set(QTOUCH-SOURCES ${QTOUCH-SOURCES} PARENT_SCOPE)

# The additional files required for the plus platform
set(PLATFORM-BITBOX02-PLUS-SOURCES
# The additional files required for the Nova platform
set(PLATFORM-BITBOX02-NOVA-SOURCES
${CMAKE_SOURCE_DIR}/src/da14531/da14531.c
${CMAKE_SOURCE_DIR}/src/da14531/da14531_protocol.c
${CMAKE_SOURCE_DIR}/src/da14531/da14531_handler.c
${CMAKE_SOURCE_DIR}/src/uart.c
)
set(PLATFORM-BITBOX02-PLUS-SOURCES ${PLATFORM-BITBOX02-PLUS-SOURCES} PARENT_SCOPE)
set(PLATFORM-BITBOX02-NOVA-SOURCES ${PLATFORM-BITBOX02-NOVA-SOURCES} PARENT_SCOPE)

set(PLATFORM-BITBOX02-SOURCES
${CMAKE_SOURCE_DIR}/src/sd_mmc/sd_mmc_start.c
Expand Down Expand Up @@ -192,7 +192,7 @@ set(FIRMWARE-SOURCES
${DRIVER-SOURCES}
${QTOUCH-SOURCES}
${SECURECHIP-SOURCES}
${PLATFORM-BITBOX02-PLUS-SOURCES}
${PLATFORM-BITBOX02-NOVA-SOURCES}
${CMAKE_SOURCE_DIR}/src/common_main.c
)

Expand Down Expand Up @@ -292,7 +292,7 @@ set(BOOTLOADERS-BITBOX02
bb02-bl-btconly-development # Runs signed/unsigned firmware and has bootloader menu
bb02-bl-btconly-production # Runs signed (btc-only keys) firmware and bootloader is locked
)
set(BOOTLOADERS-BITBOX02PLUS
set(BOOTLOADERS-BITBOX02NOVA
bb02p-bl-multi # Runs signed firmware
bb02p-bl-multi-development # Runs signed/unsigned firmware and has bootloader menu
bb02p-bl-multi-development-locked # Runs signed/unsigned firmware, has bootloader menu and bootloader is locked
Expand All @@ -303,7 +303,7 @@ set(BOOTLOADERS-BITBOX02PLUS
)
set(BOOTLOADERS
${BOOTLOADERS-BITBOX02}
${BOOTLOADERS-BITBOX02PLUS}
${BOOTLOADERS-BITBOX02NOVA}
)
set(BOOTLOADERS ${BOOTLOADERS} PARENT_SCOPE)

Expand All @@ -317,6 +317,8 @@ set(DEVDEVICE-BOOTLOADERS
set(FIRMWARES
firmware # Firmware MULTI
firmware-btc # Firmware BTC-ONLY
firmware-nova # Firmware NOVA MULTI
firmware-nova-btc # Firmware NOVA BTC-ONLY
factory-setup # Factory-setup
)
set(FIRMWARES ${FIRMWARES} PARENT_SCOPE)
Expand Down Expand Up @@ -438,15 +440,15 @@ if(CMAKE_CROSSCOMPILING)
target_link_libraries(${elf} PRIVATE -Wl,--print-memory-usage)
endforeach(bootloader)

foreach(bootloader ${DEVDEVICE-BOOTLOADERS} ${BOOTLOADERS-BITBOX02PLUS})
foreach(bootloader ${DEVDEVICE-BOOTLOADERS} ${BOOTLOADERS-BITBOX02NOVA})
set(elf ${bootloader}.elf)
target_link_libraries(${elf} PRIVATE ${QTOUCHLIB_A} ${QTOUCHLIB_B} ${QTOUCHLIB_T})
target_sources(${elf} PRIVATE ${QTOUCH-SOURCES})
endforeach(bootloader)

foreach(bootloader ${BOOTLOADERS-BITBOX02PLUS})
foreach(bootloader ${BOOTLOADERS-BITBOX02NOVA})
set(elf ${bootloader}.elf)
target_sources(${elf} PRIVATE ${PLATFORM-BITBOX02-PLUS-SOURCES})
target_sources(${elf} PRIVATE ${PLATFORM-BITBOX02-NOVA-SOURCES})
target_link_libraries(${bootloader}.elf PRIVATE embedded-swd)
endforeach(bootloader)

Expand All @@ -466,20 +468,20 @@ if(CMAKE_CROSSCOMPILING)
target_compile_definitions(bb02-bl-btconly-production.elf PRIVATE PRODUCT_BITBOX_BTCONLY BOOTLOADER_PRODUCTION)
set_property(TARGET bb02-bl-btconly-production.elf PROPERTY EXCLUDE_FROM_ALL ON)

# BB02PLUS definitions
# BB02NOVA definitions

target_compile_definitions(bb02p-bl-multi.elf PRIVATE PRODUCT_BITBOX_PLUS_MULTI)
target_compile_definitions(bb02p-bl-multi-development.elf PRIVATE PRODUCT_BITBOX_PLUS_MULTI BOOTLOADER_DEVDEVICE)
target_compile_definitions(bb02p-bl-multi-development-locked.elf PRIVATE PRODUCT_BITBOX_PLUS_MULTI BOOTLOADER_DEVDEVICE BOOTLOADER_PRODUCTION)
target_compile_definitions(bb02p-bl-multi.elf PRIVATE PRODUCT_BITBOX_NOVA_MULTI)
target_compile_definitions(bb02p-bl-multi-development.elf PRIVATE PRODUCT_BITBOX_NOVA_MULTI BOOTLOADER_DEVDEVICE)
target_compile_definitions(bb02p-bl-multi-development-locked.elf PRIVATE PRODUCT_BITBOX_NOVA_MULTI BOOTLOADER_DEVDEVICE BOOTLOADER_PRODUCTION)
set_property(TARGET bb02p-bl-multi-development-locked.elf PROPERTY EXCLUDE_FROM_ALL ON)


target_compile_definitions(bb02p-bl-multi-production.elf PRIVATE PRODUCT_BITBOX_PLUS_MULTI BOOTLOADER_PRODUCTION)
target_compile_definitions(bb02p-bl-multi-production.elf PRIVATE PRODUCT_BITBOX_NOVA_MULTI BOOTLOADER_PRODUCTION)
set_property(TARGET bb02p-bl-multi-production.elf PROPERTY EXCLUDE_FROM_ALL ON)

target_compile_definitions(bb02p-bl-btconly.elf PRIVATE PRODUCT_BITBOX_PLUS_BTCONLY)
target_compile_definitions(bb02p-bl-btconly-development.elf PRIVATE PRODUCT_BITBOX_PLUS_BTCONLY BOOTLOADER_DEVDEVICE)
target_compile_definitions(bb02p-bl-btconly-production.elf PRIVATE PRODUCT_BITBOX_PLUS_BTCONLY BOOTLOADER_PRODUCTION)
target_compile_definitions(bb02p-bl-btconly.elf PRIVATE PRODUCT_BITBOX_NOVA_BTCONLY)
target_compile_definitions(bb02p-bl-btconly-development.elf PRIVATE PRODUCT_BITBOX_NOVA_BTCONLY BOOTLOADER_DEVDEVICE)
target_compile_definitions(bb02p-bl-btconly-production.elf PRIVATE PRODUCT_BITBOX_NOVA_BTCONLY BOOTLOADER_PRODUCTION)
set_property(TARGET bb02p-bl-btconly-production.elf PROPERTY EXCLUDE_FROM_ALL ON)

foreach(firmware ${FIRMWARES})
Expand Down Expand Up @@ -535,6 +537,14 @@ if(CMAKE_CROSSCOMPILING)
target_compile_definitions(firmware-btc.elf PRIVATE PRODUCT_BITBOX_BTCONLY "APP_U2F=0")
target_sources(firmware-btc.elf PRIVATE ${PLATFORM-BITBOX02-SOURCES})

target_sources(firmware-nova.elf PRIVATE firmware.c)
target_compile_definitions(firmware-nova.elf PRIVATE PRODUCT_BITBOX_NOVA_MULTI "APP_U2F=1")
target_sources(firmware-nova.elf PRIVATE ${FIRMWARE-U2F-SOURCES} ${FIRMWARE-U2F-DRIVER-SOURCES} ${PLATFORM-BITBOX02-SOURCES})

target_sources(firmware-nova-btc.elf PRIVATE firmware.c)
target_compile_definitions(firmware-nova-btc.elf PRIVATE PRODUCT_BITBOX_NOVA_BTCONLY "APP_U2F=0")
target_sources(firmware-nova-btc.elf PRIVATE ${PLATFORM-BITBOX02-SOURCES})

target_sources(factory-setup.elf PRIVATE factorysetup.c)
target_compile_definitions(factory-setup.elf PRIVATE PRODUCT_BITBOX02_FACTORYSETUP "APP_U2F=0")
target_sources(factory-setup.elf PRIVATE ${PLATFORM-BITBOX02-SOURCES})
Expand Down
18 changes: 9 additions & 9 deletions src/bootloader/bootloader.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@
#include <usb/usb_processing.h>
#include <util.h>

#if defined(BOOTLOADER_DEVDEVICE) || PLATFORM_BITBOX02PLUS == 1
#if defined(BOOTLOADER_DEVDEVICE) || PLATFORM_BITBOX02NOVA == 1
#include <memory/memory_spi.h>
#include <qtouch/qtouch.h>
#endif

#if PLATFORM_BITBOX02PLUS == 1
#if PLATFORM_BITBOX02NOVA == 1
#include <da14531/da14531.h>
#include <da14531/da14531_protocol.h>
#include <uart.h>
Expand Down Expand Up @@ -133,7 +133,7 @@ static const uint8_t _empty_bare_flash_hash[SHA256_DIGEST_LENGTH] = {
#error "FLASH_APP_LEN changed; recompute _empty_bare_flash_hash"
#endif

#if PLATFORM_BITBOX02PLUS == 1
#if PLATFORM_BITBOX02NOVA == 1
extern struct RustByteQueue* uart_write_queue;
#endif

Expand Down Expand Up @@ -180,7 +180,7 @@ static const uint8_t _root_pubkeys[BOOT_NUM_ROOT_SIGNING_KEYS][BOOT_PUBKEY_LEN]
0xf0, 0xca, 0xde, 0x45, 0xd6, 0x1c, 0x51, 0x4d, 0x86, 0x09, 0xfc, 0xa7, 0x64, 0x1c, 0x9e, 0xe2,
}
};
#elif PRODUCT_BITBOX_PLUS_BTCONLY == 1
#elif PRODUCT_BITBOX_NOVA_BTCONLY == 1
static const uint8_t _root_pubkeys[BOOT_NUM_ROOT_SIGNING_KEYS][BOOT_PUBKEY_LEN] = { // order is important
{
0x42, 0xeb, 0x2f, 0xfa, 0x68, 0xd8, 0xc4, 0x62, 0x5a, 0x01, 0x2b, 0x46, 0x7f, 0x04, 0x4a, 0xfc,
Expand All @@ -201,7 +201,7 @@ static const uint8_t _root_pubkeys[BOOT_NUM_ROOT_SIGNING_KEYS][BOOT_PUBKEY_LEN]
0x1d, 0xc3, 0xd6, 0x6b, 0xc5, 0x51, 0x54, 0x67, 0xba, 0xb1, 0xc1, 0xcb, 0x24, 0x48, 0xa8, 0x7a,
}
};
#elif PRODUCT_BITBOX_PLUS_MULTI == 1
#elif PRODUCT_BITBOX_NOVA_MULTI == 1
static const uint8_t _root_pubkeys[BOOT_NUM_ROOT_SIGNING_KEYS][BOOT_PUBKEY_LEN] = { // order is important
{
0x5e, 0x1b, 0x09, 0x1c, 0x8f, 0x71, 0x15, 0xaf, 0xd3, 0x3c, 0x0b, 0x72, 0xe4, 0x4b, 0x3e, 0xd0,
Expand Down Expand Up @@ -324,7 +324,7 @@ void bootloader_render_default_screen(void)
{
UG_ClearBuffer();
_load_logo();
#if PLATFORM_BITBOX02PLUS == 1
#if PLATFORM_BITBOX02NOVA == 1
UG_PutString(0, SCREEN_HEIGHT - 9 * 2 - 5, "See the BitBoxApp");
if (rust_communication_mode_ble_enabled() &&
da14531_connected_state < DA14531_CONNECTED_CONNECTED_SECURED) {
Expand All @@ -343,7 +343,7 @@ void bootloader_render_default_screen(void)
UG_SendBuffer();
}

#if PLATFORM_BITBOX02PLUS
#if PLATFORM_BITBOX02NOVA
extern bool bootloader_pairing_request;
extern uint8_t bootloader_pairing_code_bytes[4];

Expand Down Expand Up @@ -878,7 +878,7 @@ static size_t _api_command(const uint8_t* input, uint8_t* output, const size_t m
break;

case OP_REBOOT: {
#if PLATFORM_BITBOX02PLUS == 1
#if PLATFORM_BITBOX02NOVA == 1
rust_da14531_set_product(rust_util_bytes(NULL, 0), uart_write_queue);
// Send it now, because we are about to reset ourselves
while (rust_bytequeue_num(uart_write_queue)) {
Expand Down Expand Up @@ -1003,7 +1003,7 @@ static bool _devdevice_enter(secbool_u32 firmware_verified)
} else {
UG_PutString(0, SCREEN_HEIGHT - 9, " No firmware found");
}
#if PLATFORM_BITBOX02PLUS == 1
#if PLATFORM_BITBOX02NOVA == 1
struct da14531_firmware_version version;
bool res = memory_spi_get_active_ble_firmware_version(&version);
if (res) {
Expand Down
2 changes: 1 addition & 1 deletion src/bootloader/bootloader.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ void bootloader_jump(void);
*/
void bootloader_render_default_screen(void);

#if PLATFORM_BITBOX02PLUS
#if PLATFORM_BITBOX02NOVA
/**
* Renders a BLE pairing confirmations screen. Use the `confirmed` argument to display the
* "user has confirmed on bitbox" version.
Expand Down
Loading
Loading