Skip to content

Commit ca36c42

Browse files
Vge0rgerlubos
authored andcommitted
nrf_security: Move PSA_WANTS from drivers Kconfig
Move some PSA_WANTs from the drivers Kconfig in nrf_security to the Kconfig file which contains the rest of the PSA_WANT configurations. During the upmerge support for OFB and CFB modes of AES was removed so here we remove the relevant code in the drivers as well. Signed-off-by: Georgios Vasilakis <[email protected]>
1 parent 5fdc587 commit ca36c42

File tree

11 files changed

+8
-197
lines changed

11 files changed

+8
-197
lines changed

doc/nrf/libraries/security/nrf_security/doc/driver_config.rst

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -122,12 +122,8 @@ To enable cipher modes, set one or more of the Kconfig options in the following
122122
+-----------------------+------------------------------------------------------+
123123
| CBC PKCS#7 padding | :kconfig:option:`CONFIG_PSA_WANT_ALG_CBC_PKCS7` |
124124
+-----------------------+------------------------------------------------------+
125-
| CFB | :kconfig:option:`CONFIG_PSA_WANT_ALG_CFB` |
126-
+-----------------------+------------------------------------------------------+
127125
| CTR | :kconfig:option:`CONFIG_PSA_WANT_ALG_CTR` |
128126
+-----------------------+------------------------------------------------------+
129-
| OFB | :kconfig:option:`CONFIG_PSA_WANT_ALG_OFB` |
130-
+-----------------------+------------------------------------------------------+
131127
| CCM* no tag | :kconfig:option:`CONFIG_PSA_WANT_ALG_CCM_STAR_NO_TAG`|
132128
+-----------------------+------------------------------------------------------+
133129
| XTS | :kconfig:option:`CONFIG_PSA_WANT_ALG_XTS` |
@@ -149,12 +145,8 @@ The following table shows cipher algorithm support for each driver:
149145
+-----------------------+---------------------------+----------------------------+---------------------------+
150146
| CBC PKCS#7 padding | Supported | Supported | Supported |
151147
+-----------------------+---------------------------+----------------------------+---------------------------+
152-
| CFB | Not supported | Not supported | Not supported |
153-
+-----------------------+---------------------------+----------------------------+---------------------------+
154148
| CTR | Supported | Supported | Supported |
155149
+-----------------------+---------------------------+----------------------------+---------------------------+
156-
| OFB | Supported | Not supported | Supported |
157-
+-----------------------+---------------------------+----------------------------+---------------------------+
158150
| CCM* no tag | Not supported | Supported | Not supported |
159151
+-----------------------+---------------------------+----------------------------+---------------------------+
160152
| XTS | Not supported | Not supported | Not supported |

subsys/nrf_security/Kconfig

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,9 +193,7 @@ config MBEDTLS_CIPHER_ALL_ENABLED
193193
select PSA_WANT_ALG_ECB_NO_PADDING
194194
select PSA_WANT_ALG_CBC_NO_PADDING
195195
select PSA_WANT_ALG_CBC_PKCS7
196-
select PSA_WANT_ALG_CFB
197196
select PSA_WANT_ALG_CTR
198-
select PSA_WANT_ALG_OFB
199197
select PSA_WANT_ALG_CCM
200198
select PSA_WANT_ALG_GCM
201199
select PSA_WANT_KEY_TYPE_CHACHA20

subsys/nrf_security/Kconfig.psa.nordic

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,14 @@ config PSA_WANT_ECC_SECT_R2_163
296296
config PSA_WANT_ECC_FRP_V1_256
297297
bool "PSA ECC FRP256v1 support" if !PSA_PROMPTLESS
298298

299+
config PSA_WANT_ALG_CHACHA20
300+
bool "PSA CHACHA20 stream cipher support" if !PSA_PROMPTLESS
301+
default y if PSA_CRYPTO_ENABLE_ALL
302+
303+
config PSA_WANT_ALG_SHAKE256_512
304+
bool "PSA SHAKE256 512 bits support" if !PSA_PROMPTLESS
305+
default y if PSA_CRYPTO_ENABLE_ALL
306+
299307
comment "Nordic addded RNG configuration"
300308

301309
config PSA_WANT_GENERATE_RANDOM

subsys/nrf_security/src/drivers/Kconfig

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -59,18 +59,6 @@ config PSA_USE_HMAC_DRBG_DRIVER
5959

6060
endmenu
6161

62-
config PSA_WANT_ALG_CFB
63-
bool "PSA stream cipher using CFB block cipher mode support"
64-
65-
config PSA_WANT_ALG_OFB
66-
bool "PSA stream cipher using OFB block cipher mode support"
67-
68-
config PSA_WANT_ALG_CHACHA20
69-
bool "PSA stream cipher using CHACHA20 support"
70-
71-
config PSA_WANT_ALG_SHAKE256_512
72-
bool "PSA SHAKE256 512 bits support"
73-
7462
menu "CryptoCell PSA Driver Configuration"
7563
if PSA_CRYPTO_DRIVER_CC3XX
7664

subsys/nrf_security/src/drivers/cracen/cracenpsa/src/blkcipher.c

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -228,10 +228,6 @@ static bool is_alg_supported(psa_algorithm_t alg, const psa_key_attributes_t *at
228228
IF_ENABLED(PSA_NEED_CRACEN_ECB_NO_PADDING_AES,
229229
(is_supported = psa_get_key_type(attributes) == PSA_KEY_TYPE_AES));
230230
break;
231-
case PSA_ALG_OFB:
232-
IF_ENABLED(PSA_NEED_CRACEN_OFB_AES,
233-
(is_supported = psa_get_key_type(attributes) == PSA_KEY_TYPE_AES));
234-
break;
235231
default:
236232
is_supported = false;
237233
break;
@@ -267,17 +263,6 @@ static psa_status_t initialize_cipher(cracen_cipher_operation_t *operation)
267263
operation->iv);
268264
}
269265
break;
270-
case PSA_ALG_OFB:
271-
if (IS_ENABLED(PSA_NEED_CRACEN_OFB_AES)) {
272-
sx_status = operation->dir == CRACEN_DECRYPT
273-
? sx_blkcipher_create_aesofb_dec(&operation->cipher,
274-
&operation->keyref,
275-
operation->iv)
276-
: sx_blkcipher_create_aesofb_enc(&operation->cipher,
277-
&operation->keyref,
278-
operation->iv);
279-
}
280-
break;
281266
case PSA_ALG_CTR:
282267
if (IS_ENABLED(PSA_NEED_CRACEN_CTR_AES)) {
283268
sx_status = operation->dir == CRACEN_DECRYPT

subsys/nrf_security/src/drivers/cracen/psa_driver.Kconfig

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -89,17 +89,6 @@ config PSA_NEED_CRACEN_ECB_NO_PADDING_AES
8989
depends on PSA_WANT_KEY_TYPE_AES
9090
depends on PSA_USE_CRACEN_CIPHER_DRIVER
9191

92-
config PSA_NEED_CRACEN_OFB_AES
93-
bool
94-
default y
95-
select PSA_ACCEL_OFB_AES_128
96-
select PSA_ACCEL_OFB_AES_192
97-
select PSA_ACCEL_OFB_AES_256
98-
depends on PSA_WANT_AES_KEY_SIZE_128 || PSA_WANT_AES_KEY_SIZE_192 || PSA_WANT_AES_KEY_SIZE_256
99-
depends on PSA_WANT_ALG_OFB
100-
depends on PSA_WANT_KEY_TYPE_AES
101-
depends on PSA_USE_CRACEN_CIPHER_DRIVER
102-
10392
config PSA_NEED_CRACEN_STREAM_CIPHER_CHACHA20
10493
bool
10594
default y
@@ -116,7 +105,6 @@ config PSA_NEED_CRACEN_CIPHER_DRIVER
116105
PSA_NEED_CRACEN_CBC_PKCS7_AES || \
117106
PSA_NEED_CRACEN_CBC_NO_PADDING_AES || \
118107
PSA_NEED_CRACEN_ECB_NO_PADDING_AES || \
119-
PSA_NEED_CRACEN_OFB_AES || \
120108
PSA_NEED_CRACEN_STREAM_CIPHER_CHACHA20
121109

122110
# CRACEN Key Agreement Driver

subsys/nrf_security/src/drivers/cracen/sxsymcrypt/include/sxsymcrypt/aes.h

Lines changed: 0 additions & 100 deletions
Original file line numberDiff line numberDiff line change
@@ -232,106 +232,6 @@ int sx_blkcipher_create_aescbc_enc(struct sxblkcipher *c, const struct sxkeyref
232232
int sx_blkcipher_create_aescbc_dec(struct sxblkcipher *c, const struct sxkeyref *key,
233233
const char *iv);
234234

235-
/** Prepares an AES CFB block cipher encryption.
236-
*
237-
* This function initializes the user allocated object \p c with a new block
238-
* cipher operation context needed to run the AES CFB encryption and reserves
239-
* the HW resource.
240-
*
241-
* After successful execution of this function, the context \p c can be passed
242-
* to any of the block cipher functions.
243-
*
244-
* @param[out] c block cipher operation context
245-
* @param[in] key key used for the block cipher operation, expected size
246-
* 16, 24 or 32 bytes
247-
* @param[in] iv initialization vector, size must be 16 bytes
248-
* @return ::SX_OK
249-
* @return ::SX_ERR_INVALID_KEYREF
250-
* @return ::SX_ERR_INVALID_KEY_SZ
251-
* @return ::SX_ERR_INCOMPATIBLE_HW
252-
* @return ::SX_ERR_RETRY
253-
*
254-
* @pre - key reference provided by \p key must be initialized using
255-
* sx_keyref_load_material() or sx_keyref_load_by_id()
256-
*/
257-
int sx_blkcipher_create_aescfb_enc(struct sxblkcipher *c, const struct sxkeyref *key,
258-
const char *iv);
259-
260-
/** Prepares an AES CFB block cipher decryption
261-
*
262-
* This function initializes the user allocated object \p c with a new block
263-
* cipher operation context needed to run the AES CFB decryption and reserves
264-
* the HW resource.
265-
*
266-
* After successful execution of this function, the context \p c can be passed
267-
* to any of the block cipher functions.
268-
*
269-
* @param[out] c block cipher operation context
270-
* @param[in] key key used for the block cipher operation, expected size
271-
* 16, 24 or 32 bytes
272-
* @param[in] iv initialization vector, size must be 16 bytes
273-
* @return ::SX_OK
274-
* @return ::SX_ERR_INVALID_KEYREF
275-
* @return ::SX_ERR_INVALID_KEY_SZ
276-
* @return ::SX_ERR_INCOMPATIBLE_HW
277-
* @return ::SX_ERR_RETRY
278-
*
279-
* @pre - key reference provided by \p key must be initialized using
280-
* sx_keyref_load_material() or sx_keyref_load_by_id()
281-
*/
282-
int sx_blkcipher_create_aescfb_dec(struct sxblkcipher *c, const struct sxkeyref *key,
283-
const char *iv);
284-
285-
/** Prepares an AES OFB block cipher encryption.
286-
*
287-
* This function initializes the user allocated object \p c with a new block
288-
* cipher operation context needed to run the AES OFB encryption and reserves
289-
* the HW resource.
290-
*
291-
* After successful execution of this function, the context \p c can be passed
292-
* to any of the block cipher functions.
293-
*
294-
* @param[out] c block cipher operation context
295-
* @param[in] key key used for the block cipher operation, expected size
296-
* 16, 24 or 32 bytes
297-
* @param[in] iv initialization vector, size must be 16 bytes
298-
* @return ::SX_OK
299-
* @return ::SX_ERR_INVALID_KEYREF
300-
* @return ::SX_ERR_INVALID_KEY_SZ
301-
* @return ::SX_ERR_INCOMPATIBLE_HW
302-
* @return ::SX_ERR_RETRY
303-
*
304-
* @pre - key reference provided by \p key must be initialized using
305-
* sx_keyref_load_material() or sx_keyref_load_by_id()
306-
*/
307-
int sx_blkcipher_create_aesofb_enc(struct sxblkcipher *c, const struct sxkeyref *key,
308-
const char *iv);
309-
310-
/** Prepares an AES OFB block cipher decryption
311-
*
312-
* This function initializes the user allocated object \p c with a new block
313-
* cipher operation context needed to run the AES OFB decryption and reserves
314-
* the HW resource.
315-
*
316-
* After successful execution of this function, the context \p c can be passed
317-
* to any of the block cipher functions.
318-
*
319-
* @param[out] c block cipher operation context
320-
* @param[in] key key used for the block cipher operation, expected size
321-
* 16, 24 or 32 bytes
322-
* @param[in] iv initialization vector, size must be 16 bytes
323-
* @return ::SX_OK
324-
* @return ::SX_ERR_INVALID_KEYREF
325-
* @return ::SX_ERR_INVALID_KEY_SZ
326-
* @return ::SX_ERR_INCOMPATIBLE_HW
327-
* @return ::SX_ERR_RETRY
328-
*
329-
* @pre - key reference provided by \p key must be initialized using
330-
* sx_keyref_load_material() or sx_keyref_load_by_id()
331-
*/
332-
int sx_blkcipher_create_aesofb_dec(struct sxblkcipher *c, const struct sxkeyref *key,
333-
const char *iv);
334-
335235
/** Prepares an AES GCM AEAD encryption operation.
336236
*
337237
* This function initializes the user allocated object \p c with a new AEAD

subsys/nrf_security/src/drivers/cracen/sxsymcrypt/include/sxsymcrypt/blkcipher.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,6 @@ struct sxblkcipher;
8181
* --------: | :----------: | :-----------
8282
* ECB | N * 16 bytes | N > 0
8383
* CBC | N * 16 bytes | N > 0
84-
* CFB | N * 16 bytes | N > 0
85-
* OFB | N * 16 bytes | N > 0
8684
* XTS | >= 16 bytes | none
8785
* CTR | > 0 bytes | none
8886
*

subsys/nrf_security/src/drivers/cracen/sxsymcrypt/src/blkcipher.c

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -252,38 +252,6 @@ int sx_blkcipher_create_aescbc_dec(struct sxblkcipher *c, const struct sxkeyref
252252
return sx_blkcipher_create_aes_ba411(c, key, iv, BLKCIPHER_MODEID_CBC, ba411cfg.decr);
253253
}
254254

255-
int sx_blkcipher_create_aescfb_enc(struct sxblkcipher *c, const struct sxkeyref *key,
256-
const char *iv)
257-
{
258-
c->inminsz = 16;
259-
c->granularity = 16;
260-
return sx_blkcipher_create_aes_ba411(c, key, iv, BLKCIPHER_MODEID_CFB, ba411cfg.encr);
261-
}
262-
263-
int sx_blkcipher_create_aescfb_dec(struct sxblkcipher *c, const struct sxkeyref *key,
264-
const char *iv)
265-
{
266-
c->inminsz = 16;
267-
c->granularity = 16;
268-
return sx_blkcipher_create_aes_ba411(c, key, iv, BLKCIPHER_MODEID_CFB, ba411cfg.decr);
269-
}
270-
271-
int sx_blkcipher_create_aesofb_enc(struct sxblkcipher *c, const struct sxkeyref *key,
272-
const char *iv)
273-
{
274-
c->inminsz = 1;
275-
c->granularity = 1;
276-
return sx_blkcipher_create_aes_ba411(c, key, iv, BLKCIPHER_MODEID_OFB, ba411cfg.encr);
277-
}
278-
279-
int sx_blkcipher_create_aesofb_dec(struct sxblkcipher *c, const struct sxkeyref *key,
280-
const char *iv)
281-
{
282-
c->inminsz = 1;
283-
c->granularity = 1;
284-
return sx_blkcipher_create_aes_ba411(c, key, iv, BLKCIPHER_MODEID_OFB, ba411cfg.decr);
285-
}
286-
287255
int sx_blkcipher_crypt(struct sxblkcipher *c, const char *datain, size_t sz, char *dataout)
288256
{
289257
if (!c->dma.hw_acquired) {

subsys/nrf_security/src/drivers/cracen/sxsymcrypt/src/blkcipherdefs.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@
1414
#define BLKCIPHER_MODEID_ECB 0
1515
#define BLKCIPHER_MODEID_CBC 1
1616
#define BLKCIPHER_MODEID_CTR 2
17-
#define BLKCIPHER_MODEID_CFB 3
18-
#define BLKCIPHER_MODEID_OFB 4
1917
#define BLKCIPHER_MODEID_XTS 7
2018
#define BLKCIPHER_MODEID_CHACH20 8
2119

0 commit comments

Comments
 (0)