44 Commits

Author SHA1 Message Date
David Horstmann
7ba04a298c Bump version to 4.0.0
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2024-09-10 10:43:14 +02:00
Ronald Cron
8c95999b38
Merge pull request #9544 from eleuzi01/replace-224k1
Replace MBEDTLS_ECP_HAVE_SECP224K1 with PSA_WANT_ECC_SECP_K1_224
2024-09-06 15:15:35 +00:00
Elena Uziunaite
63cb13e494 Replace MBEDTLS_ECP_HAVE_SECP224K1 with PSA_WANT_ECC_SECP_K1_224
Signed-off-by: Elena Uziunaite <elena.uziunaite@arm.com>
2024-09-05 12:43:14 +01:00
Elena Uziunaite
9fc5be09cb Replace MBEDTLS_MD_CAN_SHA1 with PSA_WANT_ALG_SHA_1
Signed-off-by: Elena Uziunaite <elena.uziunaite@arm.com>
2024-09-04 18:12:59 +01:00
David Horstmann
36fe9188e2
Merge pull request #9252 from gabor-mezei-arm/9114_replace_MBEDTLS_MD_CAN_SHA512_with_PSA_WANT
Replace MBEDTLS_MD_CAN_SHA512 with its PSA_WANT counterpart
2024-09-03 14:07:05 +00:00
Manuel Pégourié-Gonnard
0b0f090b6e Merge remote-tracking branch 'restricted/development-restricted' into dev-mergeback
* restricted/development-restricted: (30 commits)
  Tiny fix in ChangeLog pt 2
  Tiny fix in ChangeLog
  Changelog entry for the RSA memory leak
  Edit ChangeLog entry
  Update ChangeLog
  Add test cases for extKeyUsage
  Rationalize extKeyUsage tests
  Use P_CLI when O_CLI's status is not reliable
  Rationalize keyUsage testing, round 2
  Always print detailed cert errors in test programs
  Fix 1.3 failure to update flags for (ext)KeyUsage
  Rationalize ssl-opt tests for keyUsage
  Test cert alert KEY_USAGE -> UNSUPPORTED_CERT
  Free allocated memory where methods were returning without freeing
  Force MBEDTLS_PSA_HMAC_DRBG_MD_TYPE based on CTR_DRBG
  Document that MBEDTLS_PSA_HMAC_DRBG_MD_TYPE does not force HMAC
  Clean up constant-flow memsan testing
  Improve description of who is affected
  More diversified sizes in tests
  Fix stack buffer overflow in ECDSA signature format conversions
  ...
2024-09-02 09:18:34 +02:00
Gabor Mezei
c15ef93aa5
Replace MBEDTLS_MD_CAN_SHA512 with PSA_WANT_ALG_SHA_512
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2024-08-28 18:20:25 +02:00
Gilles Peskine
ab0af45d11
Merge pull request #9464 from gilles-peskine-arm/psa-keystore-dynamic-development
dynamically sized key store
2024-08-26 10:47:00 +00:00
Gilles Peskine
0a2b6e2945 Merge remote-tracking branch 'development' into development-restricted 2024-08-23 11:14:11 +02:00
Waleed Elmelegy
d1562407c3 Fix possible issues in testing and implementation of psa_key_agreement()
Signed-off-by: Waleed Elmelegy <waleed.elmelegy@arm.com>
2024-08-16 14:37:46 +01:00
Waleed Elmelegy
bdf2c98a27 Add psa_key_agreement() API
Add psa_key_agreement() API and basic testing.

Signed-off-by: Waleed Elmelegy <waleed.elmelegy@arm.com>
2024-08-16 14:36:47 +01:00
Gilles Peskine
b8457fff9f
Merge pull request #9353 from eleuzi01/replace-ecp-have-secp384r1
Replace MBEDTLS_ECP_HAVE_SECP384R1 with PSA_WANT_ECC_SECP_R1_384
2024-08-12 14:37:10 +00:00
Gilles Peskine
0858fdca38
Merge pull request #9189 from misch7/fix-v3.6-issues-9186-and-9188
Fix build of v3.6 (issues #9186 and #9188)
2024-08-12 09:34:17 +00:00
Gilles Peskine
75071066f2 Dynamic key store: make full-key-store tests work effectively
Add a practical way to fill the dynamic key store by artificially limiting
the slice length through a test hook.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-08-09 15:41:11 +02:00
Gilles Peskine
5c81b9403d Dynamic key store: disable full-key-store tests
It's impractical to fill the key store when it can grow to accommodate
millions of keys.

A later commit will restore those tests in test configurations with the
dynamic key store.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-08-09 15:41:11 +02:00
Gilles Peskine
9e9e1f60e2 Dynamic key store: new compilation option
Create a new compilation option for a dynamically resized key store. The
implementation will follow in subsequent commits.

This option is off by default with custom configuration files, which is best
for typical deployments on highly constrained platforms. This option is on
by default with the provided configuration file, which is best for typical
deployments on relatively high-end platforms.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-08-09 15:41:10 +02:00
Michael Schuster
f828f04532 Fix Uncrustify errors in modified tests/suites to satisfy check_code_style test
Signed-off-by: Michael Schuster <michael@schuster.ms>
2024-08-09 10:29:59 +01:00
Michael Schuster
a3cc46382b Use correct test case conditionals for helper functions in tests/suites
Fix unused-function errors.

Signed-off-by: Michael Schuster <michael@schuster.ms>
2024-08-09 10:29:59 +01:00
Michael Schuster
bd89b791a4 Adjust spacing in tests/suites function sources
Signed-off-by: Michael Schuster <michael@schuster.ms>
2024-08-09 10:29:58 +01:00
Michael Schuster
54300d4a4e Fix missing-prototype errors in tests/suites
Signed-off-by: Michael Schuster <michael@schuster.ms>
2024-08-09 10:29:58 +01:00
Michael Schuster
87825ab1b2 Fix unused-function error for ecjpake_operation_setup in test_suite_psa_crypto.function
This function is not referenced anywhere in the whole codebase.

Signed-off-by: Michael Schuster <michael@schuster.ms>
2024-08-09 10:29:58 +01:00
Elena Uziunaite
6b4cd48d24 Replace MBEDTLS_ECP_HAVE_SECP384R1 with PSA_WANT_ECC_SECP_R1_384
Signed-off-by: Elena Uziunaite <elena.uziunaite@arm.com>
2024-08-09 09:49:03 +01:00
Gilles Peskine
aacbc622a4
Merge pull request #9453 from gilles-peskine-arm/psa-keystore-dynamic-prep-4.0
Prepare for dynamic key store
2024-08-09 08:00:06 +00:00
Gilles Peskine
c51fddbdad Improve documentation in some tests
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-08-08 15:58:38 +02:00
Minos Galanakis
123a625386 Resolved merge conflicts caused by file moved in #8226
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2024-08-08 14:11:53 +01:00
Gilles Peskine
9e54a4f5ba
Merge pull request #9369 from eleuzi01/replace-ecc-keys
Replace MBEDTLS_PK_HAVE_ECC_KEYS with PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY
2024-08-08 12:10:43 +00:00
Gilles Peskine
35f057330f Keep track of PSA keys used interally
When PSA uses CTR_DRBG for its random generator and CTR_DRBG uses PSA for
AES, as currently implemented, there is one volatile key in permanent use
for the CTR_DRBG instance. Account for that in tests that want to know
exactly how many volatile keys are in use, or how many volatile keys can be
created.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-08-07 12:39:05 +02:00
Gilles Peskine
faa909266a Fix spurious test case failure with accelerated AES
When the PSA RNG uses AES through a PSA driver, it consumes one volatile key
identifier. When MBEDTLS_PSA_KEY_SLOT_DYNAMIC is enabled, that identifier
happens to coincide with the key ID value that the test case assumes not to
exist. Use a different value that avoids this coincidence.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-08-07 12:39:05 +02:00
Gilles Peskine
c0bdb08f83 Improve full-key-store tests
Split the "many transient keys" test function in two: one that expects to
successfully create many keys, and one that expects to fill the key store.
This will make things easier when we add a dynamic key store where filling
the key store is not practical unless artificially limited.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-08-07 12:39:05 +02:00
Gilles Peskine
ab89fcf7f8 Update invalid key id in a test case
PSA_KEY_ID_VOLATILE_MIN-1 is now in the persistent key ID range, so it's no
longer an invalid key ID for registration.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-08-07 12:39:05 +02:00
Gilles Peskine
2ff81bf03b Add a test for the built-in key range
Restricting the built-in key range would be an API break since applications
can hard-code a built-in key value and expect that it won't clash with
anything else. Make it harder to accidentally break the API.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-08-07 12:39:05 +02:00
Gilles Peskine
b0b1b32914 Prevent mbedtls_psa_register_se_key with volatile keys
mbedtls_psa_register_se_key() is not usable with volatile keys, since there
is no way to return the implementation-chosen key identifier which would be
needed to use the key. Document this limitation. Reject an attempt to create
such an unusable key. Fixes #9253.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-08-07 12:39:05 +02:00
Elena Uziunaite
8dde3b3dec Replace MBEDTLS_PK_HAVE_ECC_KEYS with PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY
Signed-off-by: Elena Uziunaite <elena.uziunaite@arm.com>
2024-08-05 15:41:58 +01:00
Gilles Peskine
3077f2f9c6 Remove experimental, superseded function psa_generate_key_ext
Remove the experimental functions psa_generate_key_ext() and
psa_key_derivation_output_key_ext(), which require a flexible array member
and therefore break C++ code that includes Mbed TLS headers. They have been
replaced by psa_generate_key_custom() and
psa_key_derivation_output_key_custom().

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-08-05 15:52:37 +02:00
Gilles Peskine
ae1da9858c Remove some tests of psa_generate_key_ext
We know it's a thin wrapper around psa_generate_key_custom, so we just need
to check that it's passing the information through, we don't need coverage
of the parameter interpretation.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-08-05 15:49:22 +02:00
Gilles Peskine
f9408282e8 Implement psa_generate_key_custom
Implement `psa_generate_key_custom()` and
`psa_key_derivation_output_key_custom()`. These functions replace
`psa_generate_key_ext()` and `psa_key_derivation_output_key_ext()`.
They have the same functionality, but a slightly different interface:
the `ext` functions use a structure with a flexible array member to pass
variable-length data, while the `custom` functions use a separate parameter.

Keep the `ext` functions for backward compatibility with Mbed TLS 3.6.0.
But make them a thin wrapper around the new `custom` functions.

Duplicate the test code and data. The test cases have to be duplicated
anyway, and the test functions are individually more readable this way.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-08-05 15:49:22 +02:00
Gilles Peskine
4b9141ccf4
Merge pull request #9384 from eleuzi01/replace-util-have-ecdsa
Replace MBEDTLS_PSA_UTIL_HAVE_ECDSA with PSA_HAVE_ALG_SOME_ECDSA
2024-07-31 15:29:51 +00:00
Elena Uziunaite
87e0550890 Replace MBEDTLS_PSA_UTIL_HAVE_ECDSA with PSA_HAVE_ALG_SOME_ECDSA
Signed-off-by: Elena Uziunaite <elena.uziunaite@arm.com>
2024-07-29 12:15:22 +01:00
Elena Uziunaite
417d05f7c5 Replace MBEDTLS_ECP_HAVE_SECP256R1 with PSA_WANT_ECC_SECP_R1_256
Signed-off-by: Elena Uziunaite <elena.uziunaite@arm.com>
2024-07-29 11:31:20 +01:00
Ronald Cron
9a93073710 Add tf-psa-crypto test suites build
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2024-07-19 10:07:27 +02:00
Ronald Cron
50292a4c79 Duplicate tests CMake file
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2024-07-19 10:07:27 +02:00
Ronald Cron
476d51e1a7 Adapt .gitignore files
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2024-07-19 10:07:27 +02:00
Ronald Cron
83538c4673 Adapt path to framework data files
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2024-07-19 10:07:23 +02:00
Ronald Cron
701b88c54a Move crypto test suites
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2024-07-19 09:58:35 +02:00