Skip to content

Commit 7329722

Browse files
committed
testing/crypto: add async crypto test
Exercise the asynchronous path of /dev/crypto: submit CIOCCRYPT with COP_FLAG_CBIMM, block on poll(2) for completion and retrieve the result through CIOCCRYPTRET. Every result is checked against a known answer rather than only a self round trip, so a backend that is wrong in both directions still fails. The vectors are RFC 3602 (AES-CBC, one block and four blocks), FIPS 180-2 (SHA-256, one shot and four 64-byte updates), NIST SP 800-38B (AES-CMAC, update plus asynchronous final) and NIST SP 800-38D test case 4 (AES-GCM and GMAC, the tag comes from the asynchronous final request). Also cover cancellation: cancelling a submitted reqid drops its result whether the operation was still in flight or already queued, a later retrieval reports EAGAIN, and an unknown reqid reports ENOENT. A concurrent section runs three submitters with private descriptors, each doing ten asynchronous rounds against a known answer. Signed-off-by: makejian <makejian@xiaomi.com>
1 parent 6dce52b commit 7329722

4 files changed

Lines changed: 982 additions & 0 deletions

File tree

‎testing/drivers/crypto/CMakeLists.txt‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,4 +286,18 @@ if(CONFIG_TESTING_CRYPTO)
286286
clone.c)
287287
endif()
288288

289+
if(CONFIG_TESTING_CRYPTO_ASYNC)
290+
nuttx_add_application(
291+
NAME
292+
async
293+
PRIORITY
294+
${CONFIG_TESTING_CRYPTO_PRIORITY}
295+
STACKSIZE
296+
${CONFIG_TESTING_CRYPTO_STACKSIZE}
297+
MODULE
298+
${CONFIG_TESTING_CRYPTO}
299+
SRCS
300+
async.c)
301+
endif()
302+
289303
endif()

‎testing/drivers/crypto/Kconfig‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,4 +160,8 @@ config TESTING_CRYPTO_CLONE
160160
bool "session clone crypto test"
161161
default n
162162

163+
config TESTING_CRYPTO_ASYNC
164+
bool "async crypto test"
165+
default n
166+
163167
endif # TESTING_CRYPTO

‎testing/drivers/crypto/Makefile‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,11 @@ PROGNAME += clone
118118
MAINSRC += clone.c
119119
endif
120120

121+
ifeq ($(CONFIG_TESTING_CRYPTO_ASYNC),y)
122+
PROGNAME += async
123+
MAINSRC += async.c
124+
endif
125+
121126
PRIORITY = $(CONFIG_TESTING_CRYPTO_PRIORITY)
122127
STACKSIZE = $(CONFIG_TESTING_CRYPTO_STACKSIZE)
123128
MODULE = $(CONFIG_TESTING_CRYPTO)

0 commit comments

Comments
 (0)