Skip to content

Commit 2ad499c

Browse files
committed
testing/crypto: add key management test
Exercise the cryptodev key-id mechanism: with CRD_F_KEYID the key field of a session or kprocess request references an imported key in the swkey store instead of the key material. Every case runs a full key lifecycle (allocate, import, operate by key id, delete) - the delete also on the failure paths, so a failed run leaves nothing behind in the store: the lifecycle round trip itself, AES-CBC, HMAC, AES-CMAC (cipher and mac keys both by id), ECDSA (generate then sign/verify by id) and RSA-1024 (n/e/d as three key ids: encrypt/decrypt round trip and a raw private-key operation with type-2 padding, checked with the public key). Signed-off-by: makejian <makejian@xiaomi.com>
1 parent bce81d5 commit 2ad499c

4 files changed

Lines changed: 1182 additions & 0 deletions

File tree

‎testing/drivers/crypto/CMakeLists.txt‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -340,4 +340,18 @@ if(CONFIG_TESTING_CRYPTO)
340340
async.c)
341341
endif()
342342

343+
if(CONFIG_TESTING_CRYPTO_KEY_MANAGEMENT)
344+
nuttx_add_application(
345+
NAME
346+
keymanagement
347+
PRIORITY
348+
${CONFIG_TESTING_CRYPTO_PRIORITY}
349+
STACKSIZE
350+
${CONFIG_TESTING_CRYPTO_STACKSIZE}
351+
MODULE
352+
${CONFIG_TESTING_CRYPTO}
353+
SRCS
354+
keymanagement.c)
355+
endif()
356+
343357
endif()

‎testing/drivers/crypto/Kconfig‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,4 +172,8 @@ config TESTING_CRYPTO_ASYNC
172172
bool "async crypto test"
173173
default n
174174

175+
config TESTING_CRYPTO_KEY_MANAGEMENT
176+
bool "key management crypto test"
177+
default n
178+
175179
endif # TESTING_CRYPTO

‎testing/drivers/crypto/Makefile‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,11 @@ PROGNAME += async
133133
MAINSRC += async.c
134134
endif
135135

136+
ifeq ($(CONFIG_TESTING_CRYPTO_KEY_MANAGEMENT),y)
137+
PROGNAME += keymanagement
138+
MAINSRC += keymanagement.c
139+
endif
140+
136141
PRIORITY = $(CONFIG_TESTING_CRYPTO_PRIORITY)
137142
STACKSIZE = $(CONFIG_TESTING_CRYPTO_STACKSIZE)
138143
MODULE = $(CONFIG_TESTING_CRYPTO)

0 commit comments

Comments
 (0)