summaryrefslogtreecommitdiff
path: root/util/signer/image.cc
diff options
context:
space:
mode:
Diffstat (limited to 'util/signer/image.cc')
-rw-r--r--util/signer/image.cc16
1 files changed, 14 insertions, 2 deletions
diff --git a/util/signer/image.cc b/util/signer/image.cc
index 397143bb7c..c7c4e0a63b 100644
--- a/util/signer/image.cc
+++ b/util/signer/image.cc
@@ -361,7 +361,8 @@ void Image::store(int adr, int v) {
}
bool Image::sign(PublicKey& key, const SignedHeader* input_hdr,
- const uint32_t fuses[FUSE_MAX]) {
+ const uint32_t fuses[FUSE_MAX],
+ const uint32_t info[INFO_MAX]) {
BIGNUM* sig = NULL;
SignedHeader* hdr = (SignedHeader*)(&mem_[base_]);
SHA256_CTX sha256;
@@ -371,7 +372,7 @@ bool Image::sign(PublicKey& key, const SignedHeader* input_hdr,
struct {
uint8_t img_hash[SHA256_DIGEST_LENGTH];
uint8_t fuses_hash[SHA256_DIGEST_LENGTH];
- // TODO: flash_fuses_hash
+ uint8_t info_hash[SHA256_DIGEST_LENGTH];
} hashes;
memcpy(hdr, input_hdr, sizeof(SignedHeader));
@@ -400,6 +401,17 @@ bool Image::sign(PublicKey& key, const SignedHeader* input_hdr,
}
fprintf(stderr, "\n");
+ // Hash info
+ SHA256_Init(&sha256);
+ SHA256_Update(&sha256, info, INFO_MAX * sizeof(uint32_t));
+ SHA256_Final(hashes.info_hash, &sha256);
+
+ fprintf(stderr, "info hash :");
+ for (size_t i = 0; i < sizeof(hashes.info_hash); ++i) {
+ fprintf(stderr, "%02x", hashes.info_hash[i]);
+ }
+ fprintf(stderr, "\n");
+
result = key.sign(&hashes, sizeof(hashes), &sig);
if (result != 1) {