1 /* 2 * Copyright (c) 2001-2019, Arm Limited and Contributors. All rights reserved. 3 * 4 * SPDX-License-Identifier: BSD-3-Clause 5 */ 6 7 #ifndef _CC_CRYPTO_BOOT_DEFS_H 8 #define _CC_CRYPTO_BOOT_DEFS_H 9 10 /*! @file 11 @brief This file contains Secure Boot And Secure Debug definitions. 12 */ 13 #include "cc_pal_types.h" 14 /*! Maximal size of secure boot's nonce. */ 15 #define CC_SB_MAX_SIZE_NONCE_BYTES (2*sizeof(uint32_t)) 16 17 /*! HASH boot key definition. */ 18 typedef enum { 19 CC_SB_HASH_BOOT_KEY_0_128B = 0, /*!< 128-bit truncated SHA256 digest of public key 0. */ 20 CC_SB_HASH_BOOT_KEY_1_128B = 1, /*!< 128-bit truncated SHA256 digest of public key 1. */ 21 CC_SB_HASH_BOOT_KEY_256B = 2, /*!< 256-bit SHA256 digest of public key. */ 22 CC_SB_HASH_BOOT_NOT_USED = 0xF, 23 CC_SB_HASH_MAX_NUM = 0x7FFFFFFF, /*!\internal use external 128-bit truncated SHA256 digest */ 24 }CCSbPubKeyIndexType_t; 25 26 27 /*! SW image code encryption type definition. */ 28 typedef enum { 29 CC_SB_NO_IMAGE_ENCRYPTION = 0, /*!< Plain SW image. */ 30 CC_SB_ICV_CODE_ENCRYPTION = 1, /*!< use Kceicv for cipher SW image. */ 31 CC_SB_OEM_CODE_ENCRYPTION = 2, /*!< use Kce for cipher SW image. */ 32 CC_SB_CODE_ENCRYPTION_MAX_NUM = 0x7FFFFFFF, /*!\internal NA */ 33 }CCswCodeEncType_t; 34 35 /*! SW image load and verify scheme. */ 36 typedef enum { 37 CC_SB_LOAD_AND_VERIFY = 0, /*!< Load & Verify from flash to memory. */ 38 CC_SB_VERIFY_ONLY_IN_FLASH = 1, /*!< Verify only in flash. */ 39 CC_SB_VERIFY_ONLY_IN_MEM = 2, /*!< Verify only in memory. */ 40 CC_SB_LOAD_ONLY = 3, /*!< Load only from flash to memory. */ 41 CC_SB_LOAD_VERIFY_MAX_NUM = 0x7FFFFFFF, /*!\internal NA */ 42 }CCswLoadVerifyScheme_t; 43 44 /*! SW image cryptographic type. */ 45 typedef enum { 46 CC_SB_HASH_ON_DECRYPTED_IMAGE = 0, /*!< AES to HASH. */ 47 CC_SB_HASH_ON_ENCRYPTED_IMAGE = 1, /*!< AES and HASH. */ 48 CC_SB_CRYPTO_TYPE_MAX_NUM = 0x7FFFFFFF, /*!\internal NA */ 49 }CCswCryptoType_t; 50 51 /*! Table nonce used in composing IV for SW-component decryption. */ 52 typedef uint8_t CCSbNonce_t[CC_SB_MAX_SIZE_NONCE_BYTES]; 53 54 /*! SW components data.*/ 55 typedef struct { 56 /*! Num of SW components. */ 57 uint32_t numOfSwComps; 58 59 /*! SW image code encryption type. */ 60 CCswCodeEncType_t swCodeEncType; 61 62 /*! SW image load & verify scheme. */ 63 CCswLoadVerifyScheme_t swLoadVerifyScheme; 64 65 /*! SW image crypto type. */ 66 CCswCryptoType_t swCryptoType; 67 68 /*! Nonce. */ 69 CCSbNonce_t nonce; 70 71 /*! Pointer to start of sw components data. */ 72 uint8_t *pSwCompsData; 73 74 }CCSbCertParserSwCompsInfo_t; 75 76 /*! SW version */ 77 typedef struct { 78 CCSbPubKeyIndexType_t keyIndex; /*!< Enumeration defining the key hash to retrieve: 128-bit HBK0, 128-bit HBK1, or 256-bit HBK. */ 79 uint32_t swVersion; /*!< Sw version.*/ 80 }CCSbSwVersion_t; 81 82 #endif 83