1 /*
2  * Copyright 2020 NXP
3  * All rights reserved.
4  *
5  * SPDX-License-Identifier: BSD-3-Clause
6  *
7  */
8 
9 #ifndef _FSL_IAP_SKBOOT_AUTHENTICATE_H_
10 #define _FSL_IAP_SKBOOT_AUTHENTICATE_H_
11 
12 #include "fsl_common.h"
13 
14 /*!
15  * @addtogroup skboot_authenticate
16  * @{
17  */
18 
19 /*******************************************************************************
20  * Definitions
21  *******************************************************************************/
22 
23 /*! @brief SKBOOT return status*/
24 typedef enum _skboot_status
25 {
26     kStatus_SKBOOT_Success               = 0x5ac3c35au, /*!< SKBOOT return success status.*/
27     kStatus_SKBOOT_Fail                  = 0xc35ac35au, /*!< SKBOOT return fail status.*/
28     kStatus_SKBOOT_InvalidArgument       = 0xc35a5ac3u, /*!< SKBOOT return invalid argument status.*/
29     kStatus_SKBOOT_KeyStoreMarkerInvalid = 0xc3c35a5au, /*!< SKBOOT return Keystore invalid Marker status.*/
30     kStatus_SKBOOT_HashcryptFinishedWithStatusSuccess =
31         0xc15a5ac3, /*!< SKBOOT return Hashcrypt finished with the success status.*/
32     kStatus_SKBOOT_HashcryptFinishedWithStatusFail =
33         0xc15a5acb, /*!< SKBOOT return Hashcrypt finished with the fail status.*/
34 } skboot_status_t;
35 
36 /*! @brief Secure bool flag*/
37 typedef enum _secure_bool
38 {
39     kSECURE_TRUE                       = 0xc33cc33cU, /*!< Secure true flag.*/
40     kSECURE_FALSE                      = 0x5aa55aa5U, /*!< Secure false flag.*/
41     kSECURE_CALLPROTECT_SECURITY_FLAGS = 0xc33c5aa5U, /*!< Secure call protect the security flag.*/
42     kSECURE_CALLPROTECT_IS_APP_READY   = 0x5aa5c33cU, /*!< Secure call protect the app is ready flag.*/
43     kSECURE_TRACKER_VERIFIED           = 0x55aacc33U, /*!< Secure tracker verified flag.*/
44 } secure_bool_t;
45 
46 /*******************************************************************************
47  * Externs
48  ******************************************************************************/
49 
50 /*******************************************************************************
51  * API
52  ******************************************************************************/
53 #if defined(__cplusplus)
54 extern "C" {
55 #endif
56 
57 /*!
58  * @brief Authenticate entry function with ARENA allocator init
59  *
60  * This is called by ROM boot or by ROM API g_skbootAuthenticateInterface
61  */
62 skboot_status_t skboot_authenticate(const uint8_t *imageStartAddr, secure_bool_t *isSignVerified);
63 
64 /*!
65  * @brief Interface for image authentication API
66  */
67 void HASH_IRQHandler(void);
68 
69 #if defined(__cplusplus)
70 }
71 #endif
72 
73 /*!
74  *@}
75  */
76 
77 #endif /* _FSL_IAP_SKBOOT_AUTHENTICATE_H_ */
78