Skip to content

testing/crypto: add the psa-arch-tests PAL layer - #4180

Open
ThePassionate wants to merge 1 commit into
apache:masterfrom
ThePassionate:crypto-psa-arch-tests
Open

ThePassionate wants to merge 1 commit into
apache:masterfrom
ThePassionate:crypto-psa-arch-tests

Conversation

@ThePassionate

Copy link
Copy Markdown
Contributor

Summary

Add the platform abstraction layer for the ARM PSA arch-tests (https://github.com/ARM-software/psa-arch-tests), ported from Vela. The suite itself is fetched at build time (13 MB, 529 test sources for the crypto and storage API compliance suites), so only the NuttX-side glue is in tree:

  • Kconfig: PSA_ARCH_TESTS with the crypto and its sub-suites, program name, priority and stack size
  • Makefile / CMakeLists.txt: fetch, unpack and build the suite; the two builds rename iv and plaintext to psa_iv and psa_plaintext because those identifiers clash with NuttX test globals when the suite links in FLAT mode
  • include/: PAL headers - pal_crypto_config.h configures the crypto tests against the fetched mbedtls tree, target_database.h and the two .inc files carry the suite test entry tables, pal_storage_config.h and pal_config.h configure the storage tests
  • src/pal_crypto.c: the PAL shim for PSA functions the suite calls that mbedtls does not implement (key agreement, PAKE - all return PSA_ERROR_NOT_SUPPORTED)

The PSA key management route through the NuttX cryptodev (PSA_KEY_LOCATION_LOCAL_CRYPTODEV, from #4133) is available to back the key storage the suite exercises.

Impact

No defconfig enables the suite. New CONFIG_PSA_ARCH_TESTS option (default n).

Testing

Build-tested on sim:nsh with CONFIG_CRYPTO_MBEDTLS + CONFIG_MBEDTLS_PSA_CRYPTO + PSA_ARCH_TESTS options; the suite fetches and compiles (the crypto compliance suite runs on hardware with a PSA implementation, which sim does not provide).

Add the platform abstraction layer for the ARM PSA arch-tests, ported
from Vela.  The suite itself is fetched from
https://github.com/ARM-software/psa-arch-tests (13 MB, 529 test
sources for the crypto and storage API compliance suites), so only the
NuttX-side glue is in tree:

- Kconfig: PSA_ARCH_TESTS with the crypto and its sub-suites,
  program name, priority and stack size
- Makefile / CMakeLists.txt: fetch, unpack and build the suite; the
  two builds rename iv and plaintext to psa_iv and psa_plaintext
  because those identifiers clash with NuttX test globals when the
  suite links in FLAT mode
- include/: PAL headers - pal_crypto_config.h configures the crypto
  tests against mbedtls, target_database.h and the two .inc files
  carry the suite's test entry tables, pal_storage_config.h and
  pal_config.h configure the storage tests and the platform includes
- src/pal_crypto.c: the PAL shim for PSA functions the suite calls
  that mbedtls does not implement (key agreement, PAKE, all return
  PSA_ERROR_NOT_SUPPORTED)

Not enabled in any defconfig.  The suite currently builds against the
mbedtls fetched tree with the PSA Crypto API; the SE driver route
(PSA_KEY_LOCATION_LOCAL_CRYPTODEV) is available to route key storage
through the NuttX cryptodev.

Signed-off-by: makejian <makejian@xiaomi.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants