1 /** 2 ****************************************************************************** 3 * @file se_psa_id.h 4 * @author MCD Application Team 5 * @version V1.0.0 6 * @brief SE_PSA ID include file. 7 ****************************************************************************** 8 * @attention 9 * 10 * Copyright (c) 2021 STMicroelectronics. 11 * All rights reserved. 12 * 13 * This software is licensed under terms that can be found in the LICENSE file 14 * in the root directory of this software component. 15 * If no LICENSE file comes with this software, it is provided AS-IS. 16 * 17 ****************************************************************************** 18 */ 19 20 #ifndef __SE_PSA_ID_H__ 21 #define __SE_PSA_ID_H__ 22 23 #ifdef __cplusplus 24 extern "C" { 25 #endif /* __cplusplus */ 26 27 #ifndef PSA_KEY_LIFETIME_FROM_PERSISTENCE_AND_LOCATION 28 #include "psa/crypto.h" 29 #endif 30 31 /* PSA LOCATION ID for primary Secure Element */ 32 33 #define PSA_SE_ST_LOCATION (1) 34 35 /* SE PSA internal ID */ 36 #define SE_ST_SERIAL_NUMBER 3 /* SE Unique Serial Number */ 37 38 /* SE PSA default lifetime for read only persistent data */ 39 /* #define PSA_SE_ST_LIFETIME_READ_ONLY PSA_KEY_LIFETIME_FROM_PERSISTENCE_AND_LOCATION(\ 40 PSA_KEY_PERSISTENCE_READ_ONLY,PSA_SE_ST_LOCATION) 41 */ 42 43 #define PSA_SE_ST_LIFETIME_READ_ONLY PSA_KEY_LIFETIME_FROM_PERSISTENCE_AND_LOCATION(\ 44 PSA_KEY_PERSISTENCE_DEFAULT,PSA_SE_ST_LOCATION) 45 46 /* SE PSA default lifetime for default persistent data */ 47 #define PSA_SE_ST_LIFETIME_DEFAULT PSA_KEY_LIFETIME_FROM_PERSISTENCE_AND_LOCATION(\ 48 PSA_KEY_PERSISTENCE_DEFAULT,PSA_SE_ST_LOCATION) 49 50 #define PSA_SE_ST_LIFETIME_VOLATILE PSA_KEY_LIFETIME_FROM_PERSISTENCE_AND_LOCATION(\ 51 PSA_KEY_PERSISTENCE_VOLATILE,PSA_SE_ST_LOCATION) 52 53 #define PSA_SE_ST_MIN_KEY_ID (PSA_KEY_ID_USER_MAX - 50) 54 55 /* convert PSA ID to SE ST ID */ 56 #define PSA_ID_TO_SE_ST_ID(__i__) (__i__ - PSA_SE_ST_MIN_KEY_ID) 57 /* convert SE ST ID to PSA ID */ 58 #define SE_ST_ID_TO_PSA_ID(__i__) (PSA_SE_ST_MIN_KEY_ID + __i__) 59 60 #ifdef __cplusplus 61 } 62 #endif /* __cplusplus */ 63 64 #endif /* __SE_PSA_ID_H__ */ 65 66