Skip to content

Commit 9be2fd4

Browse files
committed
nrf_security: cracen: Fix usage of nrfx error codes
Since nrfx 4, driver APIs return errno values. Comparing against NRFX_SUCCESS is therefore wrong. Unfortunately such cases cannot be found by enabling compiler warnings. Signed-off-by: Rubin Gerritsen <[email protected]>
1 parent 2590ab6 commit 9be2fd4

File tree

1 file changed

+4
-4
lines changed
  • subsys/nrf_security/src/drivers/nrf_oberon/cracen_trng

1 file changed

+4
-4
lines changed

subsys/nrf_security/src/drivers/nrf_oberon/cracen_trng/cracen_trng.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@
1313

1414
static psa_status_t cracen_trng_init(void)
1515
{
16-
nrfx_err_t nrfx_error;
16+
int nrfx_error;
1717

1818
/* This is TRNG even though the naming states otherwise.
1919
* On devices that don't support hardware crypto it will default to trng
2020
*/
2121
nrfx_error = nrfx_cracen_ctr_drbg_init();
22-
if (nrfx_error != NRFX_SUCCESS) {
22+
if (nrfx_error != 0) {
2323
return PSA_ERROR_HARDWARE_FAILURE;
2424
}
2525

@@ -31,7 +31,7 @@ psa_status_t cracen_trng_get_entropy(uint32_t flags, size_t *estimate_bits,
3131
{
3232
uint16_t request_len = MIN(UINT16_MAX, output_size);
3333
psa_status_t status;
34-
nrfx_err_t nrfx_error;
34+
int nrfx_error;
3535

3636
/* Ignore flags as CRACEN TRNG doesn't support entropy generation flags */
3737
(void)flags;
@@ -49,7 +49,7 @@ psa_status_t cracen_trng_get_entropy(uint32_t flags, size_t *estimate_bits,
4949
* On devices that don't support hardware crypto it will default to trng
5050
*/
5151
nrfx_error = nrfx_cracen_ctr_drbg_random_get(output, request_len);
52-
if (nrfx_error != NRFX_SUCCESS) {
52+
if (nrfx_error != 0) {
5353
return PSA_ERROR_HARDWARE_FAILURE;
5454
}
5555

0 commit comments

Comments
 (0)