blob: bd65098036d2e5ce5d8be4f8ef16b87ca6c13972 [file] [log] [blame]
Juan Castillo8e55d932015-04-02 09:48:16 +01001/*
2 * Copyright (c) 2015, ARM Limited and Contributors. All rights reserved.
3 *
dp-armfa3cf0b2017-05-03 09:38:09 +01004 * SPDX-License-Identifier: BSD-3-Clause
Juan Castillo8e55d932015-04-02 09:48:16 +01005 */
6
7#ifndef __AUTH_MOD_H__
8#define __AUTH_MOD_H__
9
10#if TRUSTED_BOARD_BOOT
11
12#include <auth_common.h>
13#include <cot_def.h>
14#include <img_parser_mod.h>
15
16/*
17 * Image flags
18 */
19#define IMG_FLAG_AUTHENTICATED (1 << 0)
20
21
22/*
23 * Authentication image descriptor
24 */
25typedef struct auth_img_desc_s {
26 unsigned int img_id;
Juan Castillo8e55d932015-04-02 09:48:16 +010027 img_type_t img_type;
Soby Mathew6d4f2622016-01-12 10:30:59 +000028 const struct auth_img_desc_s *parent;
Juan Castillo8e55d932015-04-02 09:48:16 +010029 auth_method_desc_t img_auth_methods[AUTH_METHOD_NUM];
30 auth_param_desc_t authenticated_data[COT_MAX_VERIFIED_PARAMS];
31} auth_img_desc_t;
32
33/* Public functions */
34void auth_mod_init(void);
35int auth_mod_get_parent_id(unsigned int img_id, unsigned int *parent_id);
36int auth_mod_verify_img(unsigned int img_id,
37 void *img_ptr,
38 unsigned int img_len);
39
40/* Macro to register a CoT defined as an array of auth_img_desc_t */
41#define REGISTER_COT(_cot) \
42 const auth_img_desc_t *const cot_desc_ptr = \
43 (const auth_img_desc_t *const)&_cot[0]; \
Sandrine Bailleuxdf8de2d2016-01-04 15:49:23 +000044 unsigned int auth_img_flags[sizeof(_cot)/sizeof(_cot[0])]
Juan Castillo8e55d932015-04-02 09:48:16 +010045
46#endif /* TRUSTED_BOARD_BOOT */
47
48#endif /* __AUTH_MOD_H__ */