32095 Commits

Author SHA1 Message Date
Bence Szépkúti
65e77c53d6 Initialize result caching variables
This prevents interference from identically named environment variables.

Signed-off-by: Bence Szépkúti <bence.szepkuti@arm.com>
2024-10-28 11:15:22 +01:00
Bence Szépkúti
924662bea3 Use true/false in place of integers
Signed-off-by: Bence Szépkúti <bence.szepkuti@arm.com>
2024-10-28 11:14:32 +01:00
Bence Szépkúti
31906327d3 Ignore missing temporary files during cleanup
Signed-off-by: Bence Szépkúti <bence.szepkuti@arm.com>
2024-10-28 11:13:53 +01:00
Bence Szépkúti
c12ebb0811 Fix copypasta in gcc_version
Signed-off-by: Bence Szépkúti <bence.szepkuti@arm.com>
2024-10-28 11:13:25 +01:00
Bence Szépkúti
d1d26139ff Add AArch64 default config test
Signed-off-by: Bence Szépkúti <bence.szepkuti@arm.com>
2024-10-28 11:12:25 +01:00
Bence Szépkúti
1524b9c3ad Add Arm eabi default config tests
Signed-off-by: Bence Szépkúti <bence.szepkuti@arm.com>
2024-10-28 11:10:15 +01:00
David Horstmann
f8d13d8fad
Merge pull request #9721 from paul-elliott-arm/fix_new_coverity_issues
Fix new coverity issues
2024-10-25 16:43:37 +00:00
Gilles Peskine
665df83d34
Merge pull request #9293 from gilles-peskine-arm/outcome-check-repeated-configurations-all.sh-preliminaries
Fix some all.sh components with sub-components
2024-10-25 14:59:15 +00:00
Ronald Cron
5f6e69dae5
Merge pull request #9693 from Harry-Ramsey/split-revert-error-development
Split error.h and move back error.c to mbedtls
2024-10-25 13:12:58 +00:00
Gilles Peskine
4e9d77e6e7
Merge pull request #9703 from valeriosetti/fix-9690-workarounds
Revert & fix #9690 workarounds
2024-10-25 11:47:44 +00:00
Paul Elliott
9a209b8251 Pair inits with declarations
Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2024-10-25 12:41:28 +01:00
Paul Elliott
a87a906a4c Move AES_PSA_INIT to after drbg init
Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2024-10-25 12:27:36 +01:00
Paul Elliott
da510d6390 Fix double free in case of test failure
Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2024-10-24 14:58:22 +01:00
Paul Elliott
65b276c613 Add missing check of return
Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2024-10-24 14:58:22 +01:00
Paul Elliott
a698976fdb Add const specifiers to pacify armclang
Functions designed for local scope only should be const

Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2024-10-24 14:58:22 +01:00
Paul Elliott
7c6686014b Fix tests where tests were done prior to init
Variables that are in any way destructed on exit should be initialised
prior to any tests that might jump to exit, to save potential
uninitialised memory accesses.

Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2024-10-24 14:58:14 +01:00
Gilles Peskine
202b69c2b6
Merge pull request #9302 from valeriosetti/psa-use-static-slots
PSA: use static key slots to store keys
2024-10-24 07:27:48 +00:00
Ronald Cron
ed230c4fb3
Merge pull request #9706 from ronald-cron-arm/pkg-install-doc-lcov
tf-psa-crypto: cmake: Add support for pkg install, doc, lcov
2024-10-24 06:39:58 +00:00
David Horstmann
f0abbb4f1a
Merge pull request #9711 from ThePassionate/mbedtls-1021
net/mbedtls_net_connect: Preventing double close problem
2024-10-22 16:49:25 +00:00
Valerio Setti
ec028d8451 analyze_outcomes.py: allow test with PSA_WANT_ALG_TLS12_PRF disabled
Do not assume that tests with !PSA_WANT_ALG_TLS12_PRF will not
be executed in AnalyzeCoverage task.

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-10-22 18:02:04 +02:00
Valerio Setti
12bccc7be8 changelog: fix typo
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-10-22 17:56:36 +02:00
Valerio Setti
bed5d1b1ea changelog: updated description
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-10-22 17:56:36 +02:00
Valerio Setti
2b52e769c6 changelog: updated description
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-10-22 17:56:36 +02:00
Valerio Setti
d47d98777e changelog: describe support for static key slot buffers
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-10-22 17:56:36 +02:00
Valerio Setti
83778d7aa9 Documentation: fix some nits
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-10-22 17:56:36 +02:00
Valerio Setti
4cfec6ffbe psa: move definition of MBEDTLS_PSA_KEY_BUFFER_MAX_SIZE
MBEDTLS_PSA_KEY_BUFFER_MAX_SIZE is only used in tests so it should
not be defined in a public header such as "crypto_extra.h".
"psa_crypto_helpers.h" is a better option.

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-10-22 17:56:36 +02:00
Valerio Setti
cac061f1d4 test_suite_psa_crypto.data: fix some depends_on
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-10-22 17:56:36 +02:00
Valerio Setti
3a0a8aee7e psa_crypto_helpers: add guard for MBEDTLS_TEST_STATIC_KEY_SLOTS_SUPPORT_RSA_xxx
PSA_KEY_EXPORT_RSA_KEY_PAIR_MAX_SIZE() is not defined when there
is no MBEDTLS_PSA_CRYPTO_CLIENT so we need this guard to
define MBEDTLS_TEST_STATIC_KEY_SLOTS_SUPPORT_RSA_[2048/4096].

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-10-22 17:56:36 +02:00
Valerio Setti
7213fbc2e2 components-basic-checks: add new exception for MBEDTLS_CTR_DRBG_MAX_REQUEST
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-10-22 17:56:36 +02:00
Valerio Setti
a35c8a0a7e test_suite_psa_crypto: use finer grained checks on the key slot buffer size
Instead of skipping some tests when !MBEDTLS_PSA_STATIC_KEY_SLOTS,
add a proper check in the depends_on to verify if
MBEDTLS_PSA_KEY_BUFFER_MAX_SIZE is actually large enough to contain
the key used in such test.

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-10-22 17:56:36 +02:00
Valerio Setti
175a494d01 psa_crypto_helpers: enhance definitions for static key slot related test symbols
- MBEDTLS_TEST_STATIC_KEY_SLOTS_SUPPORT_RSA_[2048/4096] are always
  defined because they are only used in test_suite_psa_crypto
  tests.

- MBEDTLS_TEST_ALLOW_RSA_4096 was renamed as
  MBEDTLS_TEST_PK_ALLOW_RSA_KEY_PAIR_4096 because this is only used in
  PK related test suites.

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-10-22 17:56:36 +02:00
Valerio Setti
69d19e7bdd psa_crypto_helpers: add MBEDTLS_TEST_ prefix to newly created symbols
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-10-22 17:56:36 +02:00
Valerio Setti
f9face436a psa: move default definition of MBEDTLS_PSA_STATIC_KEY_SLOT_BUFFER_SIZE
Move the default definition of MBEDTLS_PSA_STATIC_KEY_SLOT_BUFFER_SIZE
from psa_crypto_core.h to the public header crypto_extra.h in order
to solve documentation build issues.

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-10-22 17:56:36 +02:00
Valerio Setti
8bc8172c4a test: disable dynamic key store in test_crypto_with_static_key_slots
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-10-22 17:56:36 +02:00
Valerio Setti
a006b8f6c1 check_config: prevent fully dynamic and static key stores to be enabled simultaneously
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-10-22 17:56:36 +02:00
Valerio Setti
7310130333 psa: zeroize static key buffer content when key slot is freed
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-10-22 17:56:36 +02:00
Valerio Setti
2b9d180f8e test_suite_psa_crypto_storage_format: improve input bit length specification for static key buffer
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-10-22 17:56:36 +02:00
Valerio Setti
4d9a8219ac test: properly select MBEDTLS_PSA_STATIC_KEY_SLOT_BUFFER_SIZE value
This value should be:
- OK for all EC/FFDH key pairs/public keys;
- OK for all supported public RSA keys;
- OK for RSA key pairs up to 2048 bits;
- FAIL for RSA key pairs above 2048 bits.

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-10-22 17:56:36 +02:00
Valerio Setti
c2a6e8b3a9 mbedtls_config: fix/improve descriptions of PSA_STATIC_KEY_SLOT symbols
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-10-22 17:56:36 +02:00
Valerio Setti
d813e6dd3c psa: fix some macro definition
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-10-22 17:56:36 +02:00
Valerio Setti
c975d5e602 test: add test with persitent key whose length is larger than MBEDTLS_PSA_STATIC_KEY_SLOT_BUFFER_SIZE
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-10-22 17:56:36 +02:00
Valerio Setti
2a3c9b347c test: extend component_test_crypto_with_static_key_slots
Intentionally set MBEDTLS_PSA_STATIC_KEY_SLOT_BUFFER_SIZE slightly
smaller than the maximum RSA key pair size for an RSA key of 4096
bits. Also add a test in test_suite_psa_crypto to verify this
condition.

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-10-22 17:56:36 +02:00
Valerio Setti
8321ac7bc1 psa-core: remove unnecessary element in psa_key_slot_t
Instead of checking for "in_use" to be true/false or "key.data"
to be not NULL, simply check that "key.bytes" is 0/not-0.
psa_allocate_buffer_to_slot() will update this value whenever
a new slot is allocated (for the fully static case "allocated"
actually mean "taken").

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-10-22 17:56:36 +02:00
Valerio Setti
7d7867fb44 psa_crypto_core: take also cipher's key length into account when sizing static key buffer
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-10-22 17:56:36 +02:00
Valerio Setti
5278ebd186 test: revert fixes for PSA entropy
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-10-22 17:56:36 +02:00
Valerio Setti
31cca13779 test_suite_psa_crypto_driver_wrappers: revert changes and fix validate_key()
Use only volatile keys in order to remove dependency on storage.

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-10-22 17:56:36 +02:00
Valerio Setti
261baa8e9f psa-core: properly set PSA_CRYPTO_MAX_STORAGE_SIZE
If MBEDTLS_PSA_STATIC_KEY_SLOTS is set then limit PSA_CRYPTO_MAX_STORAGE_SIZE
to MBEDTLS_PSA_STATIC_KEY_SLOT_BUFFER_SIZE, otherwise keep the previous
PSA_BITS_TO_BYTES(PSA_MAX_KEY_BITS) size.

This commit also removes changes to test_suite_psa_crypto_persistent_key.data
done previously since MBEDTLS_PSA_STATIC_KEY_SLOTS is always up to date
with key buffer size.

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-10-22 17:56:36 +02:00
Valerio Setti
35b0b02e4a test: disable all legacy symbols in test_psa_crypto_without_heap
Disable all MBEDTLS_xxx symbols (keeping only the relevant ones enabled)
when building the main library.

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-10-22 17:56:36 +02:00
Valerio Setti
13aadd7981 test: minor fixes to test_psa_crypto_without_heap and test_crypto_with_static_key_slots
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-10-22 17:56:36 +02:00
Valerio Setti
933b7693f4 mbedtls_config: fix descriptions for PSA static key slots
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-10-22 17:56:36 +02:00