Skip to content

Commit 185ec2b

Browse files
valeriosetticarlescufi
authored andcommitted
mbedtls: add support for the P256M driver
Add support for the CortexM optimized implementation of secp256r1 code. It supports: - import & export - key agreement - sign & verify Signed-off-by: Valerio Setti <[email protected]>
1 parent 2871c87 commit 185ec2b

File tree

3 files changed

+20
-0
lines changed

3 files changed

+20
-0
lines changed

modules/mbedtls/CMakeLists.txt

+8
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,14 @@ zephyr_interface_library_named(mbedTLS)
134134
)
135135
endif()
136136

137+
if(CONFIG_MBEDTLS_PSA_P256M_DRIVER_ENABLED)
138+
list(APPEND crypto_source
139+
${ZEPHYR_CURRENT_MODULE_DIR}/3rdparty/p256-m/p256-m_driver_entrypoints.c
140+
${ZEPHYR_CURRENT_MODULE_DIR}/3rdparty/p256-m/p256-m/p256-m.c
141+
)
142+
zephyr_library_include_directories(${ZEPHYR_CURRENT_MODULE_DIR}/library)
143+
endif()
144+
137145
list(APPEND crypto_source
138146
${ZEPHYR_CURRENT_MODULE_DIR}/library/pem.c
139147
${ZEPHYR_CURRENT_MODULE_DIR}/library/pkcs12.c

modules/mbedtls/Kconfig.tls-generic

+8
Original file line numberDiff line numberDiff line change
@@ -502,6 +502,14 @@ config MBEDTLS_LMS
502502
depends on MBEDTLS_SHA256
503503
select PSA_WANT_ALG_SHA_256
504504

505+
config MBEDTLS_PSA_P256M_DRIVER_ENABLED
506+
bool "P256-M driver"
507+
depends on MBEDTLS_PSA_CRYPTO_C
508+
imply PSA_WANT_ALG_SHA_256
509+
help
510+
Enable support for the optimized sofware implementation of the secp256r1
511+
curve.
512+
505513
config MBEDTLS_SSL_DTLS_CONNECTION_ID
506514
bool "DTLS Connection ID extension"
507515
depends on MBEDTLS_DTLS

modules/mbedtls/configs/config-tls-generic.h

+4
Original file line numberDiff line numberDiff line change
@@ -457,6 +457,10 @@
457457
#define MBEDTLS_PSA_CRYPTO_C
458458
#define MBEDTLS_PSA_ASSUME_EXCLUSIVE_BUFFERS
459459

460+
#if defined(CONFIG_MBEDTLS_PSA_P256M_DRIVER_ENABLED)
461+
#define MBEDTLS_PSA_P256M_DRIVER_ENABLED
462+
#endif
463+
460464
#if defined(CONFIG_ARCH_POSIX) && !defined(CONFIG_PICOLIBC)
461465
#define MBEDTLS_PSA_KEY_SLOT_COUNT 64
462466
#define MBEDTLS_PSA_CRYPTO_STORAGE_C

0 commit comments

Comments
 (0)