Skip to content

Commit 48ea1cf

Browse files
degjorvarlubos
authored andcommitted
nrf_security: cracen: exclude unneeded curves
Only include ed448 and x448 when those curves are enabled This saves on flash in most use cases Signed-off-by: Dag Erik Gjørvad <dag.erik.gjorvad@nordicsemi.no>
1 parent a4bed26 commit 48ea1cf

File tree

1 file changed

+9
-4
lines changed
  • subsys/nrf_security/src/drivers/cracen/silexpk/target/hw/ba414

1 file changed

+9
-4
lines changed

subsys/nrf_security/src/drivers/cracen/silexpk/target/hw/ba414/ec_curves.c

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include "../../target/hw/ba414/regs_commands.h"
1010
#include <silexpk/core.h>
1111
#include <string.h>
12+
#include <zephyr/sys/util.h>
1213

1314
#define SX_MAX(p, q) ((p >= q) ? p : q)
1415

@@ -484,11 +485,15 @@ int sx_pk_count_curve_params(const struct sx_pk_ecurve *curve)
484485
if (curve->params == NULL) {
485486
return 0;
486487
}
487-
if (curve->params == params_x448) {
488-
return 2;
488+
if (IS_ENABLED(PSA_NEED_CRACEN_PURE_EDDSA_TWISTED_EDWARDS_448)) {
489+
if (curve->params == params_x448) {
490+
return 2;
491+
}
489492
}
490-
if (curve->params == (char *)params_ed448) {
491-
return 5;
493+
if (IS_ENABLED(PSA_NEED_CRACEN_KEY_TYPE_ECC_MONTGOMERY_448)) {
494+
if (curve->params == (char *)params_ed448) {
495+
return 5;
496+
}
492497
}
493498
return 6;
494499
}

0 commit comments

Comments
 (0)