1 /*
2  * Copyright (c) 2001-2019, Arm Limited and Contributors. All rights reserved.
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  */
6 
7 /*!
8  @addtogroup cc_sb_defs
9  @{
10  */
11 
12 /*!
13  @file
14  @brief This file contains type definitions for the Secure Boot.
15  */
16 
17 
18 #ifndef _SECURE_BOOT_DEFS_H
19 #define _SECURE_BOOT_DEFS_H
20 
21 #ifdef __cplusplus
22 extern "C"
23 {
24 #endif
25 
26 #include "cc_crypto_boot_defs.h"
27 #include "cc_sec_defs.h"
28 
29 
30 /* General definitions */
31 /***********************/
32 
33 /*! Input or output structure for the Secure Boot verification API. */
34 typedef struct{
35     /*! The NV counter saved in OTP. */
36     uint32_t otpVersion;
37     /*! The key hash to retrieve: The 128-bit Hbk0, the 128-bit Hbk1, or the
38     256-bit Hbk. */
39     CCSbPubKeyIndexType_t keyIndex;
40     /*! The value of the SW version for the certificate-chain. */
41     uint32_t activeMinSwVersionVal;
42     /*! In: The hash of the public key (N||Np), to compare to the public key
43     stored in the certificate. Out: The hash of the public key (N||Np) stored
44     in the certificate, to be used for verification of the public key of the
45     next certificate in the chain. */
46     CCHashResult_t pubKeyHash;
47     /*! Internal flag for the initialization indication. */
48     uint32_t initDataFlag;
49 }CCSbCertInfo_t;
50 
51 
52 
53 /*! The size of the data of the SW-image certificate. */
54 #define SW_REC_SIGNED_DATA_SIZE_IN_BYTES            44  // HS(8W) + load_adddr(1) + maxSize(1) + isCodeEncUsed(1)
55 /*! The size of the additional-data of the SW-image certificate in bytes. */
56 #define SW_REC_NONE_SIGNED_DATA_SIZE_IN_BYTES       8   // storage_addr(1) + ActualSize(1)
57 /*! The size of the additional-data of the SW-image certificate in words. */
58 #define SW_REC_NONE_SIGNED_DATA_SIZE_IN_WORDS       SW_REC_NONE_SIGNED_DATA_SIZE_IN_BYTES/CC_32BIT_WORD_SIZE
59 /*! Indication whether or not to load the SW image to memory. */
60 #define CC_SW_COMP_NO_MEM_LOAD_INDICATION       0xFFFFFFFFUL
61 
62 
63 #ifdef __cplusplus
64 }
65 #endif
66 
67 /*!
68  @}
69  */
70 #endif
71