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 #ifndef _SECUREBOOT_ERROR_H
9 #define _SECUREBOOT_ERROR_H
10 
11 /*! @file
12 @brief This file defines the error code types returned from the secure boot code.
13 */
14 
15 #ifdef __cplusplus
16 extern "C"
17 {
18 #endif
19 
20 
21 /************************ Defines ******************************/
22 /*! Defines the error number space used for the Secure Boot different modules. */
23 #define CC_SECUREBOOT_BASE_ERROR                 0xF0000000
24 
25 /*! Defines the secure boot's base layer's error number. */
26 #define CC_SECUREBOOT_LAYER_BASE_ERROR           0x01000000
27 
28 /*! Defines the Secure boot's verifier layer's error prefix number. */
29 #define CC_SB_VERIFIER_LAYER_PREFIX         1
30 /*! Defines the Secure boot's driver layer's error prefix number. */
31 #define CC_SB_DRV_LAYER_PREFIX          2
32 /*! Defines the Secure boot's revocation layer's error prefix number. */
33 #define CC_SB_SW_REVOCATION_LAYER_PREFIX    3
34 /*! Defines the Secure boot's HAL layer's error prefix number. */
35 #define CC_SB_HAL_LAYER_PREFIX                  6
36 /*! Defines the Secure boot's RSA layer's error prefix number. */
37 #define CC_SB_RSA_LAYER_PREFIX              7
38 /*! Defines the Secure boot's certificate verifier layer's error prefix number. */
39 #define CC_SB_VERIFIER_CERT_LAYER_PREFIX    8
40 /*! Defines the Secure boot's X509 certificate layer's error prefix number. */
41 #define CC_SB_X509_CERT_LAYER_PREFIX        9
42 
43 
44 /*! Defines the boot images verifier base error = 0xF1000000. */
45 #define CC_BOOT_IMG_VERIFIER_BASE_ERROR          (CC_SECUREBOOT_BASE_ERROR + CC_SB_VERIFIER_LAYER_PREFIX*CC_SECUREBOOT_LAYER_BASE_ERROR)
46 /*! Defines the NVM base error = 0xF4000000. */
47 #define CC_SB_HAL_BASE_ERROR                     (CC_SECUREBOOT_BASE_ERROR + CC_SB_HAL_LAYER_PREFIX*CC_SECUREBOOT_LAYER_BASE_ERROR)
48 /*! Defines the RSA's base error = 0xF7000000. */
49 #define CC_SB_RSA_BASE_ERROR                     (CC_SECUREBOOT_BASE_ERROR + CC_SB_RSA_LAYER_PREFIX*CC_SECUREBOOT_LAYER_BASE_ERROR)
50 
51 /*! Defines the boot images verifier certificates base error = 0xF8000000. */
52 #define CC_BOOT_IMG_VERIFIER_CERT_BASE_ERROR     (CC_SECUREBOOT_BASE_ERROR + CC_SB_VERIFIER_CERT_LAYER_PREFIX*CC_SECUREBOOT_LAYER_BASE_ERROR)
53 
54 /*! Defines the X.509's base error = 0xF9000000. */
55 #define CC_SB_X509_CERT_BASE_ERROR               (CC_SECUREBOOT_BASE_ERROR + CC_SB_X509_CERT_LAYER_PREFIX*CC_SECUREBOOT_LAYER_BASE_ERROR)
56 
57 /*! Defines the cryptographic driver base error = 0xF2000000. */
58 #define CC_SB_DRV_BASE_ERROR             (CC_SECUREBOOT_BASE_ERROR + CC_SB_DRV_LAYER_PREFIX*CC_SECUREBOOT_LAYER_BASE_ERROR)
59 
60 /*! Defines a HAL fatal error. */
61 #define CC_SB_HAL_FATAL_ERROR_ERR            (CC_SB_HAL_BASE_ERROR + 0x00000001)
62 /*! Illegal input error. */
63 #define CC_SB_DRV_ILLEGAL_INPUT_ERR      (CC_SB_DRV_BASE_ERROR + 0x00000001)
64 /*! Illegal key error. */
65 #define CC_SB_DRV_ILLEGAL_KEY_ERR        (CC_SB_DRV_BASE_ERROR + 0x00000002)
66 /*! Illegal size error. */
67 #define CC_SB_DRV_ILLEGAL_SIZE_ERR       (CC_SB_DRV_BASE_ERROR + 0x00000003)
68 
69 
70 #ifdef __cplusplus
71 }
72 #endif
73 
74 #endif
75 
76