1 /*
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied. See the License for the
16 * specific language governing permissions and limitations
17 * under the License.
18 */
19
20 /*
21 * Original code taken from mcuboot project at:
22 * https://github.com/mcu-tools/mcuboot
23 * Git SHA of the original version: ac55554059147fff718015be9f4bd3108123f50a
24 * Modifications are Copyright (c) 2019-2025 Arm Limited.
25 */
26
27 #include <assert.h>
28 #include <stddef.h>
29 #include <stdbool.h>
30 #include <bootutil/sign_key.h>
31 #include "mcuboot_config/mcuboot_config.h"
32 #include "tfm_plat_rotpk.h"
33 #include "tfm_plat_crypto_keys.h"
34
35 unsigned int pub_key_len;
36 struct bootutil_key bootutil_keys[1] = {
37 {
38 .key = 0,
39 .len = &pub_key_len,
40 },
41 };
42 const int bootutil_key_cnt = 1;
43
boot_retrieve_public_key_hash(uint8_t image_index,uint8_t key_index,uint8_t * public_key_hash,size_t * key_hash_size)44 int boot_retrieve_public_key_hash(uint8_t image_index,
45 uint8_t key_index,
46 uint8_t *public_key_hash,
47 size_t *key_hash_size)
48 {
49 (void) key_index;
50 return tfm_plat_get_rotpk_hash(image_index,
51 public_key_hash,
52 (uint32_t *)key_hash_size);
53 }
54