blob: ca97d5ac39c107b4fdf8a64121a5b56d72e0da2f [file] [log] [blame]
Tamas Ban5db57532019-07-17 10:59:02 +01001/*
2 * Copyright (c) 2019, Arm Limited. All rights reserved.
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 *
6 */
7
8#include <stdint.h>
9#include "platform/include/tfm_plat_crypto_keys.h"
10/**
11 * \file tfm_rotpk.c
12 *
13 * This file contains the hash value (SHA256) of the public parts of the
14 * firmware signing keys in bl2/ext/mcuboot folder (*.pem files).
15 * This simulates when the hash of the Root of Trust Public Key is programmed
16 * to an immutable device memory to be able to validate the image verification
17 * key.
18 *
19 * \note These key-hash values must be provisioned to the SoC during the
20 * production, independently from firmware binaries. This solution
21 * (hard-coded key-hash values in firmware) is not suited for use in
22 * production!
23 */
24
25#if defined(BL2)
26#if (MCUBOOT_SIGN_RSA_LEN == 2048)
27/* Hash of public key: bl2/ext/mcuboot/root-rsa-2048.pem */
28uint8_t rotpk_hash_0[ROTPK_HASH_LEN] = {
29 0xfc, 0x57, 0x01, 0xdc, 0x61, 0x35, 0xe1, 0x32,
30 0x38, 0x47, 0xbd, 0xc4, 0x0f, 0x04, 0xd2, 0xe5,
31 0xbe, 0xe5, 0x83, 0x3b, 0x23, 0xc2, 0x9f, 0x93,
32 0x59, 0x3d, 0x00, 0x01, 0x8c, 0xfa, 0x99, 0x94,
33};
34
35#elif (MCUBOOT_SIGN_RSA_LEN == 3072)
36/* Hash of public key: bl2/ext/mcuboot/root-rsa-3072.pem */
37uint8_t rotpk_hash_0[ROTPK_HASH_LEN] = {
38 0xbf, 0xe6, 0xd8, 0x6f, 0x88, 0x26, 0xf4, 0xff,
39 0x97, 0xfb, 0x96, 0xc4, 0xe6, 0xfb, 0xc4, 0x99,
40 0x3e, 0x46, 0x19, 0xfc, 0x56, 0x5d, 0xa2, 0x6a,
41 0xdf, 0x34, 0xc3, 0x29, 0x48, 0x9a, 0xdc, 0x38,
42};
43
44#else
45#error "No public key available for given signing algorithm."
46#endif
47
48const struct tfm_plat_rotpk_t device_rotpk[] = {
49 {
50 .key_hash = rotpk_hash_0,
51 .hash_len = ROTPK_HASH_LEN,
52 },
53};
54
55const uint32_t rotpk_key_cnt = 1;
56#endif /* BL2 */