Skip to content

Commit 34b38f1

Browse files
committed
2 parents 24ce489 + 349983a commit 34b38f1

File tree

6 files changed

+28
-10
lines changed

6 files changed

+28
-10
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ customers cannot upgrade their bootloader, its changes are recorded separately.
1515
- Bitcoin: allow spendung UTXOs at very high BIP-44 address indices
1616
- Ethereum: allow signing EIP-712 messages containing multi-line strings
1717
- Allow exiting the screen asking to insert the microSD card
18+
- HWW: add initialized status byte to _api_info response
1819

1920
### 9.18.0
2021
- Add support for deriving BIP-39 mnemonics according to BIP-85

CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,8 @@ endif()
9696
#
9797
# Versions MUST contain three parts and start with lowercase 'v'.
9898
# Example 'v1.0.0'. They MUST not contain a pre-release label such as '-beta'.
99-
set(FIRMWARE_VERSION "v9.19.0")
100-
set(FIRMWARE_BTC_ONLY_VERSION "v9.19.0")
99+
set(FIRMWARE_VERSION "v9.20.0")
100+
set(FIRMWARE_BTC_ONLY_VERSION "v9.20.0")
101101
set(BOOTLOADER_VERSION "v1.0.6")
102102

103103
find_package(PythonInterp 3.6 REQUIRED)

py/bitbox02/CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
## [Unreleased]
44

5+
# 7.0.0
6+
- get_info: add optional device initialized boolean to returned tuple
7+
58
# 6.3.0
69
- Allow infering product and version via API call instead of via USB descriptor
710
- Accept EIP1559 transactions in `eth_sign()` - requires BitBox02 firmware v9.16.0

py/bitbox02/bitbox02/bitbox02/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
from __future__ import print_function
1717
import sys
1818

19-
__version__ = "6.3.0"
19+
__version__ = "7.0.0"
2020

2121
if sys.version_info.major != 3 or sys.version_info.minor < 6:
2222
print(

py/bitbox02/bitbox02/communication/bitbox_api_protocol.py

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -546,7 +546,7 @@ def __init__(
546546
elif device_info["product_string"] == BITBOX02BTC:
547547
edition = BitBox02Edition.BTCONLY
548548
else:
549-
version, _, edition, _ = self.get_info(transport)
549+
version, _, edition, _, _ = self.get_info(transport)
550550

551551
self.edition = edition
552552
try:
@@ -680,11 +680,14 @@ def reboot(
680680
return True
681681

682682
@staticmethod
683-
def get_info(transport: TransportLayer) -> Tuple[str, Platform, Union[BitBox02Edition], bool]:
683+
def get_info(
684+
transport: TransportLayer,
685+
) -> Tuple[str, Platform, Union[BitBox02Edition], bool, Optional[bool]]:
684686
"""
685-
Returns (version, platform, edition, unlocked).
686-
This is useful to get the version of the firmware when a usb descriptor is not available
687-
(via BitBoxBridge, etc.).
687+
Returns (version, platform, edition, unlocked, initialized).
688+
This is useful to get the version of the firmware or the device unlocked/initialized status
689+
when a usb descriptor is not available (via BitBoxBridge, etc.). The initialized status is
690+
supported from firmware v9.20.0 (it is None if not supported).
688691
This call does not use a versioned BitBoxProtocol for communication, as the version is not
689692
available (this call is used to get the version), so it must work for all firmware versions.
690693
"""
@@ -704,9 +707,14 @@ def get_info(transport: TransportLayer) -> Tuple[str, Platform, Union[BitBox02Ed
704707
else:
705708
raise Exception("Unknown platform: {}".format(platform))
706709

707-
unlocked_byte = response[0]
710+
unlocked_byte, response = response[0], response[1:]
708711
unlocked = {0x00: False, 0x01: True}[unlocked_byte]
709-
return (version_str, platform, edition, unlocked)
712+
713+
initialized = None
714+
if parse_device_version(version_str) >= semver.VersionInfo(9, 20, 0):
715+
initialized_byte = response[0]
716+
initialized = {0x00: False, 0x01: True}[initialized_byte]
717+
return (version_str, platform, edition, unlocked, initialized)
710718

711719
def check_min_version(self) -> None:
712720
"""

src/hww.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
#include <hardfault.h>
1818
#include <keystore.h>
19+
#include <memory/memory.h>
1920

2021
#include <platform_config.h>
2122
#include <rust/rust.h>
@@ -65,6 +66,7 @@ typedef struct {
6566
* - For the BitBoxBase platform (deprecated):
6667
" - 0x00 - Standard
6768
* 1 byte: 0x00 if the device is locked, 0x01 if the device is unlocked.
69+
* 1 byte: 0x00 if the device is uninitialized, 0x01 if the device is initialized.
6870
* @param[out] buf serialize info to this buffer.
6971
* @return number of bytes written
7072
*/
@@ -97,6 +99,10 @@ static size_t _api_info(uint8_t* buf)
9799
*current = keystore_is_locked() ? 0x00 : 0x01;
98100
current++;
99101

102+
// 1 byte initialized status
103+
*current = memory_is_initialized() ? 0x01 : 0x00;
104+
current++;
105+
100106
return current - buf;
101107
}
102108

0 commit comments

Comments
 (0)