1 /* 2 * Copyright (c) 2022, Arm Limited. All rights reserved. 3 * 4 * SPDX-License-Identifier: BSD-3-Clause 5 * 6 */ 7 8 #ifndef __CONFIG_PARTITION_PS_H__ 9 #define __CONFIG_PARTITION_PS_H__ 10 11 #include "config_platform.h" 12 #include "config_tfm.h" 13 14 /* Create flash FS if it doesn't exist for Protected Storage partition */ 15 #ifndef PS_CREATE_FLASH_LAYOUT 16 #pragma message("PS_CREATE_FLASH_LAYOUT is defaulted to 1. Please check and set it explicitly.") 17 #define PS_CREATE_FLASH_LAYOUT 1 18 #endif 19 20 /* Enable emulated RAM FS for platforms that don't have flash for Protected Storage partition */ 21 #ifndef PS_RAM_FS 22 #pragma message("PS_RAM_FS is defaulted to 0. Please check and set it explicitly.") 23 #define PS_RAM_FS 0 24 #endif 25 26 /* Enable rollback protection for Protected Storage partition */ 27 #ifndef PS_ROLLBACK_PROTECTION 28 #pragma message("PS_ROLLBACK_PROTECTION is defaulted to 1. Please check and set it explicitly.") 29 #define PS_ROLLBACK_PROTECTION 1 30 #endif 31 32 /* Validate filesystem metadata every time it is read from flash */ 33 #ifndef PS_VALIDATE_METADATA_FROM_FLASH 34 #pragma message("PS_VALIDATE_METADATA_FROM_FLASH is defaulted to 1. Please check and set it explicitly.") 35 #define PS_VALIDATE_METADATA_FROM_FLASH 1 36 #endif 37 38 /* The maximum asset size to be stored in the Protected Storage */ 39 #ifndef PS_MAX_ASSET_SIZE 40 #pragma message("PS_MAX_ASSET_SIZE is defaulted to 2048. Please check and set it explicitly.") 41 #define PS_MAX_ASSET_SIZE 2048 42 #endif 43 44 /* The maximum number of assets to be stored in the Protected Storage */ 45 #ifndef PS_NUM_ASSETS 46 #pragma message("PS_NUM_ASSETS is defaulted to 10. Please check and set it explicitly.") 47 #define PS_NUM_ASSETS 10 48 #endif 49 50 /* The stack size of the Protected Storage Secure Partition */ 51 #ifndef PS_STACK_SIZE 52 #pragma message("PS_STACK_SIZE is defaulted to 0x700. Please check and set it explicitly.") 53 #define PS_STACK_SIZE 0x700 54 #endif 55 56 /* Check invalid configs. */ 57 #if PS_ROLLBACK_PROTECTION && PLATFORM_NV_COUNTER_MODULE_DISABLED 58 #error "Invalid config: PS_ROLLBACK_PROTECTION and PLATFORM_NV_COUNTER_MODULE_DISABLED!" 59 #endif 60 61 #if PS_ROLLBACK_PROTECTION && (!defined(PS_ENCRYPTION)) 62 #error "Invalid config: PS_ROLLBACK_PROTECTION and NOT PS_ENCRYPTION!" 63 #endif 64 65 #if (!PS_ROLLBACK_PROTECTION) && defined(PS_ENCRYPTION) && \ 66 (defined(PS_CRYPTO_AEAD_ALG_GCM) || defined(PS_CRYPTO_AEAD_ALG_CCM)) 67 #error "Invalid config: NOT PS_ROLLBACK_PROTECTION and PS_ENCRYPTION and PSA_ALG_GCM or PSA_ALG_CCM!" 68 #endif 69 70 #endif /* __CONFIG_PARTITION_PS_H__ */ 71