Skip to content

ARM_MUSCA_A1: psa-crypto_init test failed #10771

Closed
@ccli8

Description

@ccli8

Description

Environment

Target
ARM_MUSCA_A1

Toolchain
Arm Compiler 6.10

mbed-os
fbc489e (HEAD -> master, origin/master, origin/HEAD) Merge pull request #10733 from pan-/fix-nrf52-memory-pools

Steps to reproduce

  1. Re-build secure code with:
    $ mbed compile -t ARMC6 -m ARM_MUSCA_A1_S --app-config mbed-os/tools/psa/tfm/mbed_app.json --profile release
  2. Test mbed-os-tests-psa-crypto_init and failed
    $ mbed test -m ARM_MUSCA_A1_NS -t ARMC6 -n mbed-os-tests-psa-crypto_init

The issue is first found on my NUMAKER_PFM_M2351 TFM port, and can reproduce on ARM_MUSCA_A1. Per my look, in mbed-os/features/mbedtls/platform/inc/platform_mbed.h:

/* Automatically enable the Mbed Crypto entropy injection API if
 * MBEDTLS_ENTROPY_NV_SEED is enabled. WARNING: the current implementation of
 * the Mbed Crypto entropy injection API is incompatible with other entropy
 * sources. When MBEDTLS_ENTROPY_NV_SEED is used on PSA target, the NV Seed is
 * the sole source of entropy and all other entropy sources are ignored. */
#define MBEDTLS_NO_DEFAULT_ENTROPY_SOURCES
#define MBEDTLS_PSA_INJECT_ENTROPY

All entropy sources except NV seed are ignored. But in mbed-os/features/mbedtls/mbed-crypto\src/entropy.c > mbedtls_entropy_init:

#if defined(MBEDTLS_ENTROPY_NV_SEED)
    mbedtls_entropy_add_source( ctx, mbedtls_nv_seed_poll, NULL,
                                MBEDTLS_ENTROPY_BLOCK_SIZE,
                                MBEDTLS_ENTROPY_SOURCE_STRONG );
    ctx->initial_entropy_run = 0;
#endif
#endif /* MBEDTLS_NO_DEFAULT_ENTROPY_SOURCES */

NV seed entropy source is also ignored due to within the ambit of MBEDTLS_NO_DEFAULT_ENTROPY_SOURCES. If I move the NV seed entropy source out of the MBEDTLS_NO_DEFAULT_ENTROPY_SOURCES ambit, the mbed-os-tests-psa-crypto_init passes. Besides the mbed-os-tests-psa-crypto_init test, many other PSA tests are also failed with it.

Issue request type

[ ] Question
[ ] Enhancement
[X] Bug

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions