105799ae0SJuan Castillo /* 205799ae0SJuan Castillo * Copyright (c) 2015, ARM Limited and Contributors. All rights reserved. 305799ae0SJuan Castillo * 4*82cb2c1aSdp-arm * SPDX-License-Identifier: BSD-3-Clause 505799ae0SJuan Castillo */ 605799ae0SJuan Castillo 705799ae0SJuan Castillo #ifndef __AUTH_MOD_H__ 805799ae0SJuan Castillo #define __AUTH_MOD_H__ 905799ae0SJuan Castillo 1005799ae0SJuan Castillo #if TRUSTED_BOARD_BOOT 1105799ae0SJuan Castillo 1205799ae0SJuan Castillo #include <auth_common.h> 1305799ae0SJuan Castillo #include <cot_def.h> 1405799ae0SJuan Castillo #include <img_parser_mod.h> 1505799ae0SJuan Castillo 1605799ae0SJuan Castillo /* 1705799ae0SJuan Castillo * Image flags 1805799ae0SJuan Castillo */ 1905799ae0SJuan Castillo #define IMG_FLAG_AUTHENTICATED (1 << 0) 2005799ae0SJuan Castillo 2105799ae0SJuan Castillo 2205799ae0SJuan Castillo /* 2305799ae0SJuan Castillo * Authentication image descriptor 2405799ae0SJuan Castillo */ 2505799ae0SJuan Castillo typedef struct auth_img_desc_s { 2605799ae0SJuan Castillo unsigned int img_id; 2705799ae0SJuan Castillo img_type_t img_type; 28b313d755SSoby Mathew const struct auth_img_desc_s *parent; 2905799ae0SJuan Castillo auth_method_desc_t img_auth_methods[AUTH_METHOD_NUM]; 3005799ae0SJuan Castillo auth_param_desc_t authenticated_data[COT_MAX_VERIFIED_PARAMS]; 3105799ae0SJuan Castillo } auth_img_desc_t; 3205799ae0SJuan Castillo 3305799ae0SJuan Castillo /* Public functions */ 3405799ae0SJuan Castillo void auth_mod_init(void); 3505799ae0SJuan Castillo int auth_mod_get_parent_id(unsigned int img_id, unsigned int *parent_id); 3605799ae0SJuan Castillo int auth_mod_verify_img(unsigned int img_id, 3705799ae0SJuan Castillo void *img_ptr, 3805799ae0SJuan Castillo unsigned int img_len); 3905799ae0SJuan Castillo 4005799ae0SJuan Castillo /* Macro to register a CoT defined as an array of auth_img_desc_t */ 4105799ae0SJuan Castillo #define REGISTER_COT(_cot) \ 4205799ae0SJuan Castillo const auth_img_desc_t *const cot_desc_ptr = \ 4305799ae0SJuan Castillo (const auth_img_desc_t *const)&_cot[0]; \ 44aa856917SSandrine Bailleux unsigned int auth_img_flags[sizeof(_cot)/sizeof(_cot[0])] 4505799ae0SJuan Castillo 4605799ae0SJuan Castillo #endif /* TRUSTED_BOARD_BOOT */ 4705799ae0SJuan Castillo 4805799ae0SJuan Castillo #endif /* __AUTH_MOD_H__ */ 49