From a23a0bd5ff7c34c8259319de6014112113c926b8 Mon Sep 17 00:00:00 2001 From: Jean-Pierre De Jesus DIAZ Date: Mon, 15 Apr 2024 18:52:47 +0200 Subject: [PATCH] SFT-3538: Ignore firmware files. * .gitignore (*.bin): New rule. --- .gitignore | 3 +++ firmware/src/bin/foundation-firmware.rs | 10 ++++++++++ 2 files changed, 13 insertions(+) diff --git a/.gitignore b/.gitignore index 5daf2cb..28cb524 100644 --- a/.gitignore +++ b/.gitignore @@ -12,3 +12,6 @@ target/ # CMake **/cmake-build-debug + +# Firmware files. +*.bin diff --git a/firmware/src/bin/foundation-firmware.rs b/firmware/src/bin/foundation-firmware.rs index f36cb64..829277f 100644 --- a/firmware/src/bin/foundation-firmware.rs +++ b/firmware/src/bin/foundation-firmware.rs @@ -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!( @@ -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)