Skip to content

Commit

Permalink
Version 5.0.0 release (#174)
Browse files Browse the repository at this point in the history
- Bump version to 5.0.0
- Updated version references in firmware, middleware, unit tests, CI workflows and documentation
- Updated CHANGELOG
  • Loading branch information
amendelzon authored Apr 9, 2024
1 parent f884685 commit 5c19f28
Show file tree
Hide file tree
Showing 24 changed files with 226 additions and 212 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
run: |
aws s3 sync \
middleware/coverage/ \
s3://${{ secrets.CODECOVERAGE_S3_BUCKET }}/powhsm_4.1.x/middleware_coverage_report \
s3://${{ secrets.CODECOVERAGE_S3_BUCKET }}/powhsm_5.0.x/middleware_coverage_report \
--sse aws:kms --sse-kms-key-id ${{ secrets.CODECOVERAGE_KMS_KEY_ID }} \
--no-progress --follow-symlinks --delete --only-show-errors
Expand All @@ -49,7 +49,7 @@ jobs:
run: |
aws s3 sync \
ledger/coverage/output/ \
s3://${{ secrets.CODECOVERAGE_S3_BUCKET }}/powhsm_4.1.x/firmware_coverage_report \
s3://${{ secrets.CODECOVERAGE_S3_BUCKET }}/powhsm_5.0.x/firmware_coverage_report \
--sse aws:kms --sse-kms-key-id ${{ secrets.CODECOVERAGE_KMS_KEY_ID }} \
--no-progress --follow-symlinks --delete --only-show-errors
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ jobs:
uses: actions/checkout@v3
with:
repository: rootstock/hsm-integration-test
ref: 4.0.0.segwit.plus
ref: 5.0.0.plus
path: hsm-integration-test
ssh-key: ${{ secrets.HSM_INTEGRATION_TEST_SSH_KEY }}

Expand Down
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
# Changelog

## [5.0.0] - 09/04/2024

### Features/enhancements

- Implemented authorised segwit transaction signing
- Added firmware static analysis to CI
- Middleware and Firmware code coverage
- Unified wa_store function into unique WA_STORE macro
- Updated bug bounty program handler, domains and program response time

### Fixes

- Brother validation on advance blockchain payload
- Bumped pyinstaller, pycryptodome, pycryptodomex to address dependabot findings

## [4.0.2] - 01/12/2023

### Features/enhancements
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
![Tests](https://github.com/rsksmart/rsk-powhsm/actions/workflows/run-tests.yml/badge.svg)
![Python linter](https://github.com/rsksmart/rsk-powhsm/actions/workflows/lint-python.yml/badge.svg)
![C linter](https://github.com/rsksmart/rsk-powhsm/actions/workflows/lint-c.yml/badge.svg)
[![Middleware coverage](https://img.shields.io/endpoint?url=https://d16sboe9lzo4ru.cloudfront.net/powhsm_4.1.x/middleware_coverage_report/badge.json)](https://d16sboe9lzo4ru.cloudfront.net/powhsm_4.1.x/middleware_coverage_report/index.html)
[![Firmware coverage](https://img.shields.io/endpoint?url=https://d16sboe9lzo4ru.cloudfront.net/powhsm_4.1.x/firmware_coverage_report/badge.json)](https://d16sboe9lzo4ru.cloudfront.net/powhsm_4.1.x/firmware_coverage_report/index.html)
[![Middleware coverage](https://img.shields.io/endpoint?url=https://d16sboe9lzo4ru.cloudfront.net/powhsm_5.0.x/middleware_coverage_report/badge.json)](https://d16sboe9lzo4ru.cloudfront.net/powhsm_5.0.x/middleware_coverage_report/index.html)
[![Firmware coverage](https://img.shields.io/endpoint?url=https://d16sboe9lzo4ru.cloudfront.net/powhsm_5.0.x/firmware_coverage_report/badge.json)](https://d16sboe9lzo4ru.cloudfront.net/powhsm_5.0.x/firmware_coverage_report/index.html)

[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](./LICENSE)

Expand Down
4 changes: 2 additions & 2 deletions docs/attestation.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ Before diving into the UI attestation, it is important to recall a few relevant

To generate the attestation, the UI uses the configured attestation scheme to sign a message generated by the concatenation of:

- A predefined header (`HSM:UI:4.0`).
- A predefined header (`HSM:UI:5.0`).
- A 32 byte user-defined value. By default, the attestation generation client supplies the latest RSK block hash as this value, so it can then be used as a minimum timestamp reference for the attestation generation.
- The compressed public key corresponding to the private key obtained by deriving the generated seed with the BIP32 path `m/44'/0'/0'/0/0` (normally used as the BTC key by the Signer application).
- The hash of the currently authorized Signer version.
Expand All @@ -62,7 +62,7 @@ As a consequence of the aforementioned features, this message guarantees that th

### Signer attestation

To generate the attestation, the Signer uses the configured attestation scheme to sign a message containing a predefined header (`HSM:SIGNER:4.0`) and the `sha256sum` of the concatenation of the authorized public keys (see the [protocol](./protocol.md) for details on this) lexicographically ordered by their UTF-encoded derivation path. This message guarantees that the device is running a specific version of the Signer and that those keys are in control of the ledger device.
To generate the attestation, the Signer uses the configured attestation scheme to sign a message containing a predefined header (`HSM:SIGNER:5.0`) and the `sha256sum` of the concatenation of the authorized public keys (see the [protocol](./protocol.md) for details on this) lexicographically ordered by their UTF-encoded derivation path. This message guarantees that the device is running a specific version of the Signer and that those keys are in control of the ledger device.

## Attestation file format

Expand Down
4 changes: 2 additions & 2 deletions docs/heartbeat.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ certification -- to verify.
To generate the heartbeat, the Signer uses the configured endorsement scheme to sign a
message generated by the concatenation of:

- A predefined header (`HSM:SIGNER:HB:4.0:`).
- A predefined header (`HSM:SIGNER:HB:5.0:`).
- A 32 byte value corresponding to the currently known best block hash.
- A value corresponding to the first 8 bytes of the last successful authorized signed
operation's transaction hash.
Expand All @@ -53,7 +53,7 @@ transactions.
To generate the heartbeat, the UI uses the configured endorsement scheme to sign a message
generated by the concatenation of:

- A predefined header (`HSM:UI:HB:4.0:`).
- A predefined header (`HSM:UI:HB:5.0:`).
- A 32 byte user-defined value. This value can vary and could be, for example, used as a
timestamp reference for the end user.
- A 32 byte value corresponding to the currently authorized Signer hash.
Expand Down
24 changes: 12 additions & 12 deletions docs/protocol.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# FedHM protocol definition v4.x
# PowHSM protocol definition v5.x

## Definitions

Expand All @@ -21,7 +21,7 @@
#### Response
```
{
"version": 4,
"version": 5,
"errorcode": i
}
```
Expand Down Expand Up @@ -61,7 +61,7 @@ inputs.
"hhhh", "hhhh", ..., "hhhh"
]
},
"version": 4
"version": 5
}
```

Expand Down Expand Up @@ -120,7 +120,7 @@ section for details).
"message": {
"hash": "hhhh", // (**)
},
"version": 4
"version": 5
}
// (*) the given string must be the
Expand Down Expand Up @@ -150,7 +150,7 @@ This operation can return `0`, `-101`, `-102`, `-103`, and generic errors. See t
{
"command": "getPubKey",
"keyId": "xxxxx", // (*)
"version": 4
"version": 5
}
// (*) the given string must be the
Expand Down Expand Up @@ -181,7 +181,7 @@ This operation can return `0`, `-103`, and generic errors. See the error codes s
"brothers": [
["hhhh", ..., "hhhh"], ..., ["hhhh", ..., "hhhh"] // (**)
],
"version": 4
"version": 5
}
// (*) each element must be the binary serialization of a block header as
Expand Down Expand Up @@ -215,7 +215,7 @@ This operation can return `0`, `1`, `-201`, `-202`, `-204`, `-205`, and generic
```
{
"command": "resetAdvanceBlockchain",
"version": 4
"version": 5
}
```

Expand All @@ -235,7 +235,7 @@ This operation can return `0` and generic errors. See the error codes section fo
```
{
"command": "blockchainState",
"version": 4
"version": 5
}
```

Expand Down Expand Up @@ -277,7 +277,7 @@ This operation can return `0` and generic errors. See the error codes section fo
"blocks": [
"hhhh", "hhhh", ..., "hhhh" // (*)
],
"version": 4
"version": 5
}
// (*) each element must be the binary serialization of a block header as
Expand All @@ -301,7 +301,7 @@ This operation can return `0`, `-201`, `-203`, `-204`, and generic errors. See t
```
{
"command": "blockchainParameters",
"version": 4
"version": 5
}
```

Expand Down Expand Up @@ -330,7 +330,7 @@ This operation can return `0` and generic errors. See the error codes section fo
{
"command": "signerHeartbeat",
"udValue": "hhhh" (*),
"version": 4
"version": 5
}
// (*) Value corresponds to the user-defined value, and must be 16 bytes in size.
Expand Down Expand Up @@ -364,7 +364,7 @@ This operation can return `0`, `-301` and generic errors. See the error codes se
{
"command": "uiHeartbeat",
"udValue": "hhhh" (*),
"version": 4
"version": 5
}
// (*) Value corresponds to the user-defined value, and must be 32 bytes in size.
Expand Down
2 changes: 1 addition & 1 deletion ledger/src/signer/src/attestation.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
// -----------------------------------------------------------------------

// Attestation message prefix
#define ATT_MSG_PREFIX "HSM:SIGNER:4.0"
#define ATT_MSG_PREFIX "HSM:SIGNER:5.0"
#define ATT_MSG_PREFIX_LENGTH (sizeof(ATT_MSG_PREFIX) - sizeof(""))

// -----------------------------------------------------------------------
Expand Down
4 changes: 2 additions & 2 deletions ledger/src/signer/src/defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
#include "constants.h"

// Version and patchlevel
#define VERSION_MAJOR 0x04
#define VERSION_MAJOR 0x05
#define VERSION_MINOR 0x00
#define VERSION_PATCH 0x02
#define VERSION_PATCH 0x00

#endif // __DEFS_H
2 changes: 1 addition & 1 deletion ledger/src/signer/src/heartbeat.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ typedef enum {
} err_code_heartbeat_t;

// Heartbeat message prefix
#define HEARTBEAT_MSG_PREFIX "HSM:SIGNER:HB:4.0:"
#define HEARTBEAT_MSG_PREFIX "HSM:SIGNER:HB:5.0:"
#define HEARTBEAT_MSG_PREFIX_LENGTH (sizeof(HEARTBEAT_MSG_PREFIX) - sizeof(""))

// User-defined value size
Expand Down
2 changes: 1 addition & 1 deletion ledger/src/ui/src/attestation.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ typedef enum {
} err_code_att_t;

// Attestation message prefix
#define ATT_MSG_PREFIX "HSM:UI:4.0"
#define ATT_MSG_PREFIX "HSM:UI:5.0"
#define ATT_MSG_PREFIX_LENGTH (sizeof(ATT_MSG_PREFIX) - sizeof(""))

// User defined value size
Expand Down
4 changes: 2 additions & 2 deletions ledger/src/ui/src/defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
#include "constants.h"

// Version and patchlevel
#define VERSION_MAJOR 0x04
#define VERSION_MAJOR 0x05
#define VERSION_MINOR 0x00
#define VERSION_PATCH 0x02
#define VERSION_PATCH 0x00

#endif // __DEFS_H
2 changes: 1 addition & 1 deletion ledger/src/ui/src/ui_heartbeat.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ typedef enum {
} err_code_ui_heartbeat_t;

// Heartbeat message prefix
#define UI_HEARTBEAT_MSG_PREFIX "HSM:UI:HB:4.0:"
#define UI_HEARTBEAT_MSG_PREFIX "HSM:UI:HB:5.0:"
#define UI_HEARTBEAT_MSG_PREFIX_LENGTH \
(sizeof(UI_HEARTBEAT_MSG_PREFIX) - sizeof(""))

Expand Down
8 changes: 4 additions & 4 deletions ledger/src/ui/test/attestation/test_attestation.c
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ void test_get_attestation_ud_value() {
assert(3 == get_attestation(rx, &G_att_ctx));
// PREFIX + UD_VALUE + Compressed pubkey + Signer hash + Iteration
ASSERT_MEMCMP(
"HSM:UI:4.0"
"HSM:UI:5.0"
"\x46\x8d\xa8\x7f\x6a\x85\xe6\x40\x93\x27\xe1\x17\xe8\xc7\xd2\x11\x0c"
"\x73\x60\x22\x26\xbb\xb5\xed\xf2\x7d\x98\xc8\xa3\x1b\xcc\xf0"
"\x02\xe6\xd7\x1d\x5c\x2b\x06\x36\x03\x53\xfb\xd8\x22\x7a\xb3\xab\xfc"
Expand Down Expand Up @@ -208,7 +208,7 @@ void test_get_attestation_get_msg() {
*N_onboarded_ui = 1;
memcpy(
G_att_ctx.msg,
"HSM:UI:4.0"
"HSM:UI:5.0"
"\x46\x8d\xa8\x7f\x6a\x85\xe6\x40\x93\x27\xe1\x17\xe8\xc7\xd2\x11\x0c"
"\x73\x60\x22\x26\xbb\xb5\xed\xf2\x7d\x98\xc8\xa3\x1b\xcc\xf0"
"\x03\xe6\xd7\x1d\x5c\x2b\x06\x36\x03\x53\xfb\xd8\x22\x7a\xb3\xab\xfc"
Expand All @@ -225,7 +225,7 @@ void test_get_attestation_get_msg() {
assert((APDU_TOTAL_DATA_SIZE_OUT + 3) == get_attestation(rx, &G_att_ctx));
ASSERT_APDU(
"\x80\x50\x02\x01"
"HSM:UI:4.0"
"HSM:UI:5.0"
"\x46\x8d\xa8\x7f\x6a\x85\xe6\x40\x93\x27\xe1\x17\xe8\xc7\xd2\x11\x0c"
"\x73\x60\x22\x26\xbb\xb5\xed\xf2\x7d\x98\xc8\xa3\x1b\xcc\xf0"
"\x03\xe6\xd7\x1d\x5c\x2b\x06\x36\x03\x53\xfb\xd8\x22\x7a\xb3\xab\xfc"
Expand All @@ -249,7 +249,7 @@ void test_get_attestation_get_msg_wrong_state() {
*N_onboarded_ui = 1;
memcpy(
&G_att_ctx.msg,
"HSM:UI:4.0"
"HSM:UI:5.0"
"\x46\x8d\xa8\x7f\x6a\x85\xe6\x40\x93\x27\xe1\x17\xe8\xc7\xd2\x11\x0c"
"\x73\x60\x22\x26\xbb\xb5\xed\xf2\x7d\x98\xc8\xa3\x1b\xcc\xf0"
"\x03\xe6\xd7\x1d\x5c\x2b\x06\x36\x03\x53\xfb\xd8\x22\x7a\xb3\xab\xfc"
Expand Down
4 changes: 2 additions & 2 deletions ledger/src/ui/test/onboard/test_onboard.c
Original file line number Diff line number Diff line change
Expand Up @@ -313,11 +313,11 @@ void test_is_onboarded() {

G_device_onboarded = true;
assert(5 == is_onboarded());
ASSERT_APDU("\x80\x01\x04\x00\x02");
ASSERT_APDU("\x80\x01\x05\x00\x00");

G_device_onboarded = false;
assert(5 == is_onboarded());
ASSERT_APDU("\x80\x00\x04\x00\x02");
ASSERT_APDU("\x80\x00\x05\x00\x00");
}

int main() {
Expand Down
2 changes: 1 addition & 1 deletion ledger/src/ui/test/ui_heartbeat/test_ui_heartbeat.c
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ void test_op_ud_value() {

assert_ok("\x80\x60\x01");

const char expected_msg[] = "HSM:UI:HB:4.0:" // Prefix
const char expected_msg[] = "HSM:UI:HB:5.0:" // Prefix
"\x11" // UD
"\x22\x22\x22\x22\x22\x22\x22\x22\x22\x22" // .
"\x22\x22\x22\x22\x22\x22\x22\x22\x22\x22" // .
Expand Down
2 changes: 1 addition & 1 deletion ledger/test/cases/heartbeat.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@


class Heartbeat(TestCase):
EXPECTED_HEADER = "HSM:SIGNER:HB:4.0:"
EXPECTED_HEADER = "HSM:SIGNER:HB:5.0:"
EHL = len(EXPECTED_HEADER)

@classmethod
Expand Down
4 changes: 2 additions & 2 deletions middleware/admin/verify_attestation.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
from .certificate import HSMCertificate


UI_MESSAGE_HEADER = b"HSM:UI:4.0"
SIGNER_MESSAGE_HEADER = b"HSM:SIGNER:4.0"
UI_MESSAGE_HEADER = b"HSM:UI:5.0"
SIGNER_MESSAGE_HEADER = b"HSM:SIGNER:5.0"
UI_DERIVATION_PATH = "m/44'/0'/0'/0/0"
UD_VALUE_LENGTH = 32
PUBKEY_COMPRESSED_LENGTH = 33
Expand Down
2 changes: 1 addition & 1 deletion middleware/comm/protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class HSM2Protocol:
ERROR_CODE_UNKNOWN = -906

# Protocol version
VERSION = 4
VERSION = 5

# Commands
VERSION_COMMAND = "version"
Expand Down
4 changes: 2 additions & 2 deletions middleware/ledger/protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@

class HSM2ProtocolLedger(HSM2Protocol):
# Current manager supported versions for HSM UI and HSM SIGNER (<=)
UI_VERSION = HSM2FirmwareVersion(4, 0, 2)
APP_VERSION = HSM2FirmwareVersion(4, 0, 2)
UI_VERSION = HSM2FirmwareVersion(5, 0, 0)
APP_VERSION = HSM2FirmwareVersion(5, 0, 0)

# Amount of time to wait to make sure the app is opened
OPEN_APP_WAIT = 1 # second
Expand Down
4 changes: 2 additions & 2 deletions middleware/tests/admin/test_verify_attestation.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,14 @@ def setUp(self):
)
self.pubkeys_hash = pubkeys_hash.digest()

self.ui_msg = b"HSM:UI:4.0" + \
self.ui_msg = b"HSM:UI:5.0" + \
bytes.fromhex("aa"*32) + \
bytes.fromhex("bb"*33) + \
bytes.fromhex("cc"*32) + \
bytes.fromhex("0123")
self.ui_hash = bytes.fromhex("ee" * 32)

self.signer_msg = b"HSM:SIGNER:4.0" + \
self.signer_msg = b"HSM:SIGNER:5.0" + \
bytes.fromhex(self.pubkeys_hash.hex())
self.signer_hash = bytes.fromhex("ff" * 32)

Expand Down
Loading

0 comments on commit 5c19f28

Please sign in to comment.