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_gen_defs
9  @{
10  */
11 
12 /*!
13  @file
14  @brief This file contains all of the definitions and structures used for the
15  Secure Boot and Secure Debug.
16  */
17 
18 #ifndef _SECURE_BOOT_GEN_DEFS_H
19 #define _SECURE_BOOT_GEN_DEFS_H
20 
21 #ifdef __cplusplus
22 extern "C"
23 {
24 #endif
25 
26 
27 #include "secureboot_basetypes.h"
28 #include "cc_sec_defs.h"
29 #include "cc_pal_sb_plat.h"
30 
31 /* General definitions */
32 /***********************/
33 
34 /*! The maximal size of the additional-data of the Secure Boot in bytes. */
35 #define CC_SB_MAX_SIZE_ADDITIONAL_DATA_BYTES    128
36 
37 /*! Definition of public key hash array. */
38 typedef uint32_t CCSbCertPubKeyHash_t[HASH_RESULT_SIZE_IN_WORDS];
39 /*! Definition of <em>SoC_ID</em> array. */
40 typedef uint32_t CCSbCertSocId_t[HASH_RESULT_SIZE_IN_WORDS];
41 
42 
43 /********* Function pointer definitions ***********/
44 
45 /*! @brief Typedef of the pointer to the Flash read function that you
46 must implement.
47 
48 The Flash read function is called to read the certificates and SW modules from
49 flash memory.
50 
51   @note It is your responsibility to verify that this function does not copy
52   data from restricted memory regions.
53  */
54 typedef uint32_t (*CCSbFlashReadFunc) (
55                      /*! [in] The address for reading from flash memory. */
56                      CCAddr_t flashAddress,
57                      /*! [out] A pointer to the RAM destination address to
58                      write the data to. */
59                      uint8_t *memDst,
60                      /*! [in] The size to read in bytes. */
61                      uint32_t sizeToRead,
62                      /*! [in] For partner use. */
63                      void* context
64                      );
65 
66 
67 /*! @brief Typedef of the pointer to the Flash write function that you must
68 implement.
69 
70   The Flash write function is called to write authenticated and decrypted SW
71   modules to flash memory. */
72 typedef uint32_t (*CCBsvFlashWriteFunc) (
73                     /*! [in] The address for writing to flash memory. */
74                     CCAddr_t flashAddress,
75                     /*! [out] A pointer to the RAM source to read the
76                     data from. */
77                     uint8_t *memSrc,
78                     /*! [in] The size to write in bytes. */
79                     uint32_t sizeToWrite,
80                     /*! [in] For partner use. */
81                     void* context
82                     );
83 
84 /********* End of Function pointer definitions ***********/
85 
86 
87 #ifdef __cplusplus
88 }
89 #endif
90 
91 
92 /*!
93  @}
94  */
95 #endif
96