Files
OpenCellular/util/signer/signed_header.h
Vadim Bendebury d9a614826b cr50: add code for the signer utility
This utility reads a binary file, verifies that the first 1024 bytes
of the file are set to zero and replaces this block with a header,
containing the signature and other information required by the recent
CR50 ROM.

A test private key is included, it matches the FPGA ROM public key.

The use convention is simple: two parameters are required, the private
key file name and the binary file name. The signed binary file is saved
in the file with extension ".signed".

BRANCH=none
BUG=chrome-os-partner:43025
TEST=the utility builds using

   g++ -std=c++0x -I . -o signer codesigner.cc publickey.cc -lcrypto

  ec.RO.flat signed with this utility can be successfully bootstrapped
  a CR50 over SPS

Change-Id: I046b13d20f0dd8cff884e37ef966593e01dcb043
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/295208
Reviewed-by: Marius Schilder <mschilder@chromium.org>
2015-08-25 20:10:55 +00:00

30 lines
867 B
C

//
// Copyright 2015 The Chromium OS Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
#ifndef __EC_UTIL_SIGNER_SIGNED_HEADER_H
#define __EC_UTIL_SIGNER_SIGNED_HEADER_H
#include <string.h>
#include <inttypes.h>
typedef struct SignedHeader {
SignedHeader() : magic(-1), image_size(0) {
memset(signature, 'S', sizeof(signature));
memset(tag, 'T', sizeof(tag));
memset(fusemap, 0, sizeof(fusemap));
memset(_pad, -1, sizeof(_pad));
}
uint32_t magic; // -1
uint32_t image_size; // != -1
uint32_t signature[96];
uint32_t tag[8];
uint32_t fusemap[32]; // 1024 bits
uint32_t _pad[256 - 1 - 1 - 96 - 8 - 32];
} SignedHeader;
static_assert(sizeof(SignedHeader) == 1024, "SignedHeader should be 1024 bytes");
#endif // __EC_UTIL_SIGNER_SIGNED_HEADER_H