Skip to content

Commit

Permalink
SFT-3631: Add firmware image test vectors module.
Browse files Browse the repository at this point in the history
* test-vectors/Cargo.toml (features): Add firmware feature.
* test-vectors/src/firmware.rs: New module.
* test-vectors/src/lib.rs (firmware): Register it.
  • Loading branch information
jeandudey committed May 16, 2024
1 parent 281b441 commit e4cedb4
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions test-vectors/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ edition = "2021"
default = ["std"]
std = ["hex/std"]
bip32 = ["bs58", "hex/serde"]
firmware = []
nostr = ["hex/serde"]
psbt = ["hex/serde"]
seedqr = ["bip39/serde", "hex/serde"]
Expand Down
10 changes: 10 additions & 0 deletions test-vectors/src/firmware.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// SPDX-FileCopyrightText: © 2024 Foundation Devices, Inc. <[email protected]>
// SPDX-License-Identifier: GPL-3.0-or-later

pub const VALID_HEADER: &[u8] = include_bytes!("../data/v2.3.0-firmware-header.bin");
pub const INVALID_MAGIC: &[u8] = include_bytes!("../data/v2.3.0-firmware-magic.bin");
pub const INVALID_MAX_LENGTH: &[u8] = include_bytes!("../data/v2.3.0-firmware-max-length.bin");
pub const INVALID_MIN_LENGTH: &[u8] = include_bytes!("../data/v2.3.0-firmware-min-length.bin");
pub const INVALID_PUBLIC_KEY1: &[u8] = include_bytes!("../data/v2.3.0-firmware-public-key1.bin");
pub const INVALID_PUBLIC_KEY2: &[u8] = include_bytes!("../data/v2.3.0-firmware-public-key2.bin");
pub const INVALID_TIMESTAMP: &[u8] = include_bytes!("../data/v2.3.0-firmware-timestamp.bin");
2 changes: 2 additions & 0 deletions test-vectors/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ impl SeedQRVector {

#[cfg(feature = "bip32")]
pub mod bip32;
#[cfg(feature = "firmware")]
pub mod firmware;
#[cfg(feature = "psbt")]
pub mod psbt;

Expand Down

0 comments on commit e4cedb4

Please sign in to comment.