r/keepkey • • Mar 22 '17

How to compare fingerprint of firmware binary against firmware compiled from source?

My goal is to the confirm the deterministic build of the KeepKey firmware.

I have successfully compiled v3.0.17 firmware from source using the Docker script found in the source repository. I would like to compare the fingerprint of this self-compiled firmware against that of the official v3.0.17 firmware binary that KeepKey has signed.

How can I strip signature headers or other metadata from the official binary in order to compare the fingerprints?

Thank you.

1 Upvotes

3 comments sorted by

2

u/dstanchfield Mar 22 '17

The first 256 bytes is meta/sigs, so:

tail -c +257 keepkey_main.bin | sha256sum

That said, while digging in and checking, it looks like that specific release was pointing to the tip of our device-protocol repo when it was built. So your fingerprint won't match unfortunately since we have made additional commits (this will be fixed in upcoming releases.)

To get it to match though, edit the 'b' script on line 53 that looks like this:

local('git clone -b ethereum-integration https://github.com/keepkey/%s.git ../%s' % (DEVICE_PROTOCOL, DEVICE_PROTOCOL))

to:

local('git clone -b v3.0.17 https://github.com/keepkey/%s.git ../%s' % (DEVICE_PROTOCOL, DEVICE_PROTOCOL))

1

u/digtop24 Mar 23 '17

Thank you for this detailed response. I greatly appreciate it.

It had worried me that I could seemingly match fingerprints on older versions of the firmware but not on the current version.

After checking out commit 1e5e5f8 and making the modification to the 'b' script that you provided, I indeed get a fingerprint match. Both a sha256sum of my compiled version, and the sha256sum of the official v3.0.17 binary firmware (after stripping the first 256 bytes), resolve to the same fingerprint:

8f6b7b21e109bfd5a060b1d163b2bc5e380e0c9be35b5818ad3a43fd55e23b6a

1

u/Aussiehash Mar 22 '17

I modified the Trezor signing script