blob: 39f5372e51256b81a6fef0ae5fa56034b87211f8 [file] [log] [blame]
Juan Castillo8e55d932015-04-02 09:48:16 +01001/*
Joel Huttone9919bb2019-02-20 11:56:46 +00002 * Copyright (c) 2015-2019, ARM Limited and Contributors. All rights reserved.
Juan Castillo8e55d932015-04-02 09:48:16 +01003 *
dp-armfa3cf0b2017-05-03 09:38:09 +01004 * SPDX-License-Identifier: BSD-3-Clause
Juan Castillo8e55d932015-04-02 09:48:16 +01005 */
6
Antonio Nino Diaz5eb88372018-11-08 10:20:19 +00007#ifndef AUTH_MOD_H
8#define AUTH_MOD_H
Juan Castillo8e55d932015-04-02 09:48:16 +01009
10#if TRUSTED_BOARD_BOOT
11
Antonio Nino Diaze0f90632018-12-14 00:18:21 +000012#include <common/tbbr/cot_def.h>
13#include <common/tbbr/tbbr_img_def.h>
14#include <drivers/auth/auth_common.h>
15#include <drivers/auth/img_parser_mod.h>
Juan Castillo8e55d932015-04-02 09:48:16 +010016
17/*
18 * Image flags
19 */
20#define IMG_FLAG_AUTHENTICATED (1 << 0)
21
22
23/*
24 * Authentication image descriptor
25 */
26typedef struct auth_img_desc_s {
27 unsigned int img_id;
Juan Castillo8e55d932015-04-02 09:48:16 +010028 img_type_t img_type;
Soby Mathew6d4f2622016-01-12 10:30:59 +000029 const struct auth_img_desc_s *parent;
Joel Hutton69931af2019-03-11 11:37:38 +000030 const auth_method_desc_t *const img_auth_methods;
31 const auth_param_desc_t *const authenticated_data;
Juan Castillo8e55d932015-04-02 09:48:16 +010032} auth_img_desc_t;
33
34/* Public functions */
35void auth_mod_init(void);
36int auth_mod_get_parent_id(unsigned int img_id, unsigned int *parent_id);
37int auth_mod_verify_img(unsigned int img_id,
38 void *img_ptr,
39 unsigned int img_len);
40
Joel Huttone9919bb2019-02-20 11:56:46 +000041/* Macro to register a CoT defined as an array of auth_img_desc_t pointers */
Juan Castillo8e55d932015-04-02 09:48:16 +010042#define REGISTER_COT(_cot) \
Joel Huttone9919bb2019-02-20 11:56:46 +000043 const auth_img_desc_t **const cot_desc_ptr = \
44 (const auth_img_desc_t **const)_cot; \
Roberto Vargasbe126ed2018-02-12 12:36:17 +000045 unsigned int auth_img_flags[MAX_NUMBER_IDS]
Juan Castillo8e55d932015-04-02 09:48:16 +010046
Joel Huttone9919bb2019-02-20 11:56:46 +000047extern const auth_img_desc_t **const cot_desc_ptr;
Roberto Vargas52f707f2018-02-12 12:36:17 +000048extern unsigned int auth_img_flags[MAX_NUMBER_IDS];
49
Juan Castillo8e55d932015-04-02 09:48:16 +010050#endif /* TRUSTED_BOARD_BOOT */
51
Antonio Nino Diaz5eb88372018-11-08 10:20:19 +000052#endif /* AUTH_MOD_H */