1 /***************************************************************************//** 2 * @file 3 * @brief Silicon Labs SE Manager macros representing features. 4 ******************************************************************************* 5 * # License 6 * <b>Copyright 2023 Silicon Laboratories Inc. www.silabs.com</b> 7 ******************************************************************************* 8 * 9 * SPDX-License-Identifier: Zlib 10 * 11 * The licensor of this software is Silicon Laboratories Inc. 12 * 13 * This software is provided 'as-is', without any express or implied 14 * warranty. In no event will the authors be held liable for any damages 15 * arising from the use of this software. 16 * 17 * Permission is granted to anyone to use this software for any purpose, 18 * including commercial applications, and to alter it and redistribute it 19 * freely, subject to the following restrictions: 20 * 21 * 1. The origin of this software must not be misrepresented; you must not 22 * claim that you wrote the original software. If you use this software 23 * in a product, an acknowledgment in the product documentation would be 24 * appreciated but is not required. 25 * 2. Altered source versions must be plainly marked as such, and must not be 26 * misrepresented as being the original software. 27 * 3. This notice may not be removed or altered from any source distribution. 28 * 29 ******************************************************************************/ 30 31 #ifndef SLI_SE_MANAGER_FEATURES_H 32 #define SLI_SE_MANAGER_FEATURES_H 33 34 #if !defined(__linux__) 35 #include "em_device.h" 36 #endif // !__linux__ 37 38 #if defined(DOXYGEN) 39 40 #undef _SILICON_LABS_SECURITY_FEATURE // Allow doxygen to include the SVH only features 41 42 #define _SILICON_LABS_SECURITY_FEATURE _SILICON_LABS_SECURITY_FEATURE_VAULT 43 #define SLI_MAILBOX_COMMAND_SUPPORTED 44 #define SLI_VSE_MAILBOX_COMMAND_SUPPORTED 45 #define SL_SE_MANAGER_YIELD_WHILE_WAITING_FOR_COMMAND_COMPLETION 46 #define SLI_SE_COMMAND_STATUS_READ_RSTCAUSE_AVAILABLE 47 #define SLI_SE_COMMAND_READ_TAMPER_RESET_CAUSE_AVAILABLE 48 #define SLI_SE_COMMAND_DERIVE_KEY_PBKDF2_CMAC_AVAILABLE 49 50 #else // DOXYGEN 51 52 #if defined(__linux__) 53 // ---------------------------- HOST ---------------------------- // 54 55 // The header is being used on a host system with Linux running on it, 56 // assume that the endpoint attached to the host system is a SVH type. 57 58 #define SLI_SE_MANAGER_HOST_SYSTEM 59 #define SLI_MAILBOX_COMMAND_SUPPORTED 60 61 #define _SILICON_LABS_SECURITY_FEATURE_SE (0) 62 #define _SILICON_LABS_SECURITY_FEATURE_VAULT (1) 63 #define _SILICON_LABS_SECURITY_FEATURE_ROT (2) 64 #define _SILICON_LABS_SECURITY_FEATURE_BASE (3) 65 #define _SILICON_LABS_SECURITY_FEATURE _SILICON_LABS_SECURITY_FEATURE_VAULT 66 67 #define SLI_SE_COMMAND_READ_TAMPER_RESET_CAUSE_AVAILABLE 68 69 #if defined(SLI_SE_MAJOR_VERSION_ONE) 70 #define SLI_SE_COMMAND_STATUS_READ_RSTCAUSE_AVAILABLE 71 72 // EFR32xG23+ doesn't require padding of curve elements or other keys 73 #define SLI_SE_KEY_PADDING_REQUIRED 74 #define SLI_SE_P521_PADDING_BYTES (2u) 75 76 #define SLI_MINIMUM_REQUIRED_NUMBER_PARAMS (0u) 77 #elif defined(SLI_SE_MAJOR_VERSION_TWO) 78 #define SLI_SE_P521_PADDING_BYTES (0u) 79 // PBKDF2 with CMAC as the PRF was first supported on EFR32xG23. 80 #define SLI_SE_COMMAND_DERIVE_KEY_PBKDF2_CMAC_AVAILABLE 81 #define SLI_MINIMUM_REQUIRED_NUMBER_PARAMS (1u) 82 #endif 83 84 // Define the helper macros needed for the host system 85 #define __REV(num) (((num & 0xFF000000) >> 24) \ 86 | ((num & 0x00FF0000) >> 8) \ 87 | ((num & 0x0000FF00) << 8) \ 88 | ((num & 0x000000FF) << 24)) 89 90 #elif defined(SEMAILBOX_PRESENT) 91 // --------------------------------- HSE --------------------------------- // 92 93 #define SLI_MAILBOX_COMMAND_SUPPORTED 94 95 #if (defined(_SILICON_LABS_SECURITY_FEATURE) \ 96 && (_SILICON_LABS_SECURITY_FEATURE == _SILICON_LABS_SECURITY_FEATURE_VAULT) \ 97 && (defined(_SILICON_LABS_32B_SERIES_2_CONFIG) && _SILICON_LABS_32B_SERIES_2_CONFIG >= 3)) 98 // Reading the latest cached tamper reset cause requires SE version 2.2.1 or above. 99 #define SLI_SE_COMMAND_READ_TAMPER_RESET_CAUSE_AVAILABLE 100 // The option to keep the tamper alive during sleep is only configurable for SE with major version 2 101 #define SLI_SE_TAMPER_FLAG_KEEP_TAMPER_ALIVE_AVAILABLE 102 #endif 103 104 #if defined(_SILICON_LABS_32B_SERIES_2_CONFIG_1) 105 #define SLI_SE_MAJOR_VERSION_ONE 106 #else 107 #define SLI_SE_MAJOR_VERSION_TWO 108 #endif 109 110 #if defined(_SILICON_LABS_32B_SERIES_3) 111 #define SLI_SE_SUPPORTS_NVM3_INTERNAL_KEY 112 #endif 113 114 #if defined(SLI_SE_MAJOR_VERSION_ONE) 115 #define SLI_SE_COMMAND_STATUS_READ_RSTCAUSE_AVAILABLE 116 117 // EFR32xG23+ doesn't require padding of curve elements or other keys 118 #define SLI_SE_KEY_PADDING_REQUIRED 119 #define SLI_SE_P521_PADDING_BYTES (2u) 120 121 #define SLI_MINIMUM_REQUIRED_NUMBER_PARAMS (0u) 122 #elif defined(SLI_SE_MAJOR_VERSION_TWO) 123 #define SLI_SE_P521_PADDING_BYTES (0u) 124 // PBKDF2 with CMAC as the PRF was first supported on EFR32xG23. 125 #define SLI_SE_COMMAND_DERIVE_KEY_PBKDF2_CMAC_AVAILABLE 126 #define SLI_MINIMUM_REQUIRED_NUMBER_PARAMS (1u) 127 #endif 128 129 #elif defined(CRYPTOACC_PRESENT) 130 // --------------------------------- VSE --------------------------------- // 131 132 #define SLI_VSE_MAILBOX_COMMAND_SUPPORTED 133 134 #endif // __linux__ 135 136 #endif // DOXYGEN 137 138 #endif // SLI_SE_MANAGER_FEATURES_H 139