BSB Developer Docs
Loading...
Searching...
No Matches
psa_crypto_config.h
1#ifndef PSA_CRYPTO_CONFIG_H
2#define PSA_CRYPTO_CONFIG_H
3
4// -----------------------------------------------------------------------------
5// User exposed config options
6
7// <<< Use Configuration Wizard in Context Menu >>>
8
9// <h> Key management configuration
10
11// <o SL_PSA_KEY_USER_SLOT_COUNT> PSA User Maximum Open Keys Count <0-128>
12// <i> Maximum amount of keys that the user application will have open
13// <i> simultaneously. In context of PSA Crypto, an open key means any key
14// <i> either stored in RAM (lifetime set to PSA_KEY_LIFETIME_VOLATILE), or
15// <i> used as part of a cryptographic operation.
16// <i> When using a key for a multi-part (setup/update/finish) operation, a key
17// <i> is considered to be open from the moment the operation is successfully
18// <i> setup, until it finishes or aborts.
19// <i> When an application tries to open more keys than this value accounts for,
20// <i> the PSA API may return PSA_ERROR_INSUFFICIENT_MEMORY. Keep in mind that
21// <i> other software included in the application (e.g. wireless protocol stacks)
22// <i> also can have a need to have open keys in PSA Crypto. This could lead to
23// <i> a race condition when the application key slot count is set too low for
24// <i> the actual usage of the application, as a software stack may not fail
25// <i> gracefully in case an application opens more than its declared amount of
26// <i> keys, thereby precluding the stack from functioning.
27// <i> Default: 4
28#define SL_PSA_KEY_USER_SLOT_COUNT (4)
29
30// <o SL_PSA_ITS_USER_MAX_FILES> PSA Maximum User Persistent Keys Count <0-1024>
31// <i> Maximum amount of keys (or other files) that can be stored persistently
32// <i> by the application through the PSA interface, when persistent storage
33// <i> support for PSA Crypto is included in the project.
34// <i> Due to caching logic, this setting does have an impact on static RAM usage.
35// <i> Note that this number is added to the potential requirements from other
36// <i> software components in the project, such that the total amount of keys
37// <i> which can be stored through the ITS backend can be higher than what is
38// <i> configured here.
39// <i>
40// <i> WARNING: When changing this setting on an application that is already
41// <i> deployed, and thus will get the change through an application upgrade,
42// <i> care should be taken to ensure that the setting is only ever increased,
43// <i> and never decreased. Decreasing this setting might cause previously
44// <i> stored keys/files to become inaccessible.
45// <i>
46// <i> It is not possible to change this setting when using V3 ITS Driver.
47// <i> The file-storage indexing is dependent on the maximum number of files,
48// <i> and if SL_PSA_ITS_USER_MAX_FILES is changed, ITS should be cleared and
49// <i> all files need to be stored again.
50// <i> Default: 128
51#define SL_PSA_ITS_USER_MAX_FILES (128)
52
53// <o SL_PSA_ITS_SUPPORT_V1_DRIVER> Enable V1 Format Support For ITS Files <0-1>
54// <i> Devices that used PSA ITS together with gecko_sdk_3.1.x or earlier
55// <i> might have keys (or other files) stored in V1 format.
56// <i> If no v1 files are used, its support can be disabled for space
57// <i> optimization.
58// <i> Default: 0
59#define SL_PSA_ITS_SUPPORT_V1_DRIVER 0
60
61// <o SL_PSA_ITS_SUPPORT_V2_DRIVER> Enable V2 ITS Driver Support <0-1>
62// <i> Devices that have used GSDK 4.1.x and earlier, and used ITS have the keys
63// <i> (or other files) stored using different address range. Enabling this
64// <i> config option adds upgrade code which converts V2 (and V1 if
65// <i> supported) format ITS keys/files to the latest V3 format. Update is
66// <i> fully automatic, needs to be run once and require extra flash space of
67// <i> approximately the size of the largest key.
68// <i> V1 ITS driver support can be disabled if the device has never used ITS
69// <i> driver before in GSDK 4.1.x and earlier, or the keys has been already
70// <i> migrated.
71// <i> Default: 0
72#define SL_PSA_ITS_SUPPORT_V2_DRIVER 0
73
74// <o SL_PSA_ITS_SUPPORT_V3_DRIVER> Enable support for V3 ITS Driver <0-1>
75// <i> Devices that have used GSDK 4.1.x and earlier, and used ITS have the keys
76// <i> (or other files) stored using different address range. In rare case
77// <i> that those devices have full nvm3 and not enough space for the
78// <i> upgrade, (that requires an extra space to store largest key in memory
79// <i> twice), this config option can disable v3 driver and use v2 one.
80// <i> To upgrade the device, make space for the upgrade, and enable v3 driver again.
81// <i>
82// <i> WARNING: When using V3 driver, it is not possible to increase or decrease
83// <i> the value of SL_PSA_ITS_USER_MAX_FILES. If the change of
84// <i> SL_PSA_ITS_USER_MAX_FILES is required, ITS should be cleared and
85// <i> all files need to be stored again.
86// <i> Default: 1
87#define SL_PSA_ITS_SUPPORT_V3_DRIVER 1
88
89// <o SL_SE_BUILTIN_KEY_AES128_ALG_CONFIG> Built-in AES Key Mode of Operation
90// <PSA_ALG_CTR=> CTR Mode
91// <PSA_ALG_CFB=> CFB Mode
92// <PSA_ALG_OFB=> OFB Mode
93// <PSA_ALG_ECB_NO_PADDING=> ECB Mode
94// <PSA_ALG_CBC_NO_PADDING=> CBC Mode (no padding)
95// <PSA_ALG_CBC_PKCS7=> CBC Mode (PKCS#7 padding)
96// <i> PSA Crypto only allows one specific usage algorithm per built-in key ID.
97// <i> Default: PSA_ALG_CTR
98#define SL_SE_BUILTIN_KEY_AES128_ALG_CONFIG (PSA_ALG_CTR)
99
100#ifndef SL_CRYPTOACC_BUILTIN_KEY_PUF_ALG
101// <o SL_CRYPTOACC_BUILTIN_KEY_PUF_ALG> Built-in PUF Key Algorithm
102// <PSA_ALG_PBKDF2_AES_CMAC_PRF_128=> PBKDF2 (CMAC-AES-128-PRF)
103// <PSA_ALG_CMAC=> CMAC
104// <i> PSA Crypto only allows one specific usage algorithm per built-in key ID.
105// <i> It is recommended to only use the PUF key for deriving further key
106// <i> material.
107// <i> Default: PSA_ALG_PBKDF2_AES_CMAC_PRF_128
108#define SL_CRYPTOACC_BUILTIN_KEY_PUF_ALG (PSA_ALG_PBKDF2_AES_CMAC_PRF_128)
109#endif // SL_CRYPTOACC_BUILTIN_KEY_PUF_ALG
110
111// </h>
112
113// <h> Power optimization configuration
114
115// <e SL_VSE_BUFFER_TRNG_DATA_DURING_SLEEP> Store already-generated random bytes before putting the device to sleep
116// <i> Using the hardware TRNG (for example through psa_generate_random()) will
117// <i> consume a non-negligible amount of power. A start-up routine must pass
118// <i> and a relatively large minimum amount of random bytes will be generated.
119// <i> Use cases where the device is frequently entering EM2/EM3 and thereafter
120// <i> consumes a small amount of data from the TRNG may benefit from buffering
121// <i> the existing random bytes before putting the device to sleep. These
122// <i> buffered bytes are then consumed until exhaustion before the TRNG needs
123// <i> to be initialized and used again.
124// <i>
125// <i> NOTE: this configuration option is only applicable for devices with a
126// <i> Virtual Secure Engine (VSE), and requires the 'Power Manager' component
127// <i> to be included in the project.
128// <i>
129// <i> Default: 0
130#define SL_VSE_BUFFER_TRNG_DATA_DURING_SLEEP (0)
131
132// <o SL_VSE_MAX_TRNG_WORDS_BUFFERED_DURING_SLEEP> Number of random words to buffer before putting the device to sleep <1-63>
133// <i> This option can be used to decrease the amount of random words that
134// <i> (if enabled) are buffered before the device enters EM2/EM3. Lowering this
135// <i> number will result in less static RAM usage, but also means that the TRNG
136// <i> potentially has to be initialized more times--leading to increased power
137// <i> consumption. By default this option in configured to buffer as much TRNG
138// <i> data as possible (limited by the depth of the TRNG FIFO).
139// <i>
140// <i> NOTE: this configuration option is only applicable when
141// <i> SL_VSE_BUFFER_TRNG_DATA_DURING_SLEEP is enabled.
142// <i>
143// <i> Default: 63
144#define SL_VSE_MAX_TRNG_WORDS_BUFFERED_DURING_SLEEP (63)
145// </e>
146
147// </h>
148
149// <<< end of configuration section >>>
150
151// -----------------------------------------------------------------------------
152// Sub-files
153
154#if defined(SLI_PSA_CONFIG_AUTOGEN_OVERRIDE_FILE)
155 #include SLI_PSA_CONFIG_AUTOGEN_OVERRIDE_FILE
156#else
157 #include "sli_psa_config_autogen.h"
158#endif
159
160#if defined(TFM_CONFIG_SL_SECURE_LIBRARY)
161 #include "sli_psa_tfm_translation.h"
162#endif
163
164#if SL_MBEDTLS_DRIVERS_ENABLED
165 #include "sli_psa_acceleration.h"
166#endif
167
168#include "sli_psa_builtin_config_autogen.h"
169
170#endif // PSA_CRYPTO_CONFIG_H