mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2026-01-09 17:11:42 +00:00
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>
30 lines
867 B
C
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
|