Skip to content

Commit

Permalink
SFT-3538: Ignore firmware files.
Browse files Browse the repository at this point in the history
* .gitignore (*.bin): New rule.
  • Loading branch information
jeandudey committed May 9, 2024
1 parent 6b06ac0 commit a23a0bd
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,6 @@ target/

# CMake
**/cmake-build-debug

# Firmware files.
*.bin
10 changes: 10 additions & 0 deletions firmware/src/bin/foundation-firmware.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ fn main() -> Result<()> {
engine.input(&file_buf[header_len..]);
let validation_hash = sha256d::Hash::from_engine(engine);

// This one is just for debugging.
let mut engine = sha256::Hash::engine();
engine.input(&header.information.serialize());
engine.input(&file_buf[header_len..]);
let single_hash = sha256::Hash::from_engine(engine);

let firmware_length = file_buf.len() - header_len;
if firmware_length != usize::try_from(header.information.length).unwrap() {
bail!(
Expand Down Expand Up @@ -77,6 +83,10 @@ fn main() -> Result<()> {
" Validation Hash: {}",
hex::encode(validation_hash.to_byte_array())
);
println!(
" Single Hash: {}",
hex::encode(single_hash.to_byte_array())
);
println!();

verify_signature(&SECP256K1, &header, &validation_hash, None)
Expand Down

0 comments on commit a23a0bd

Please sign in to comment.