Commit Graph

452 Commits

Author SHA1 Message Date
Waleed Elmelegy
b30233f6c3 Change key param to mbedtls_svc_key_id_t in psa_export_public_key_iop_setup()
Signed-off-by: Waleed Elmelegy <waleed.elmelegy@arm.com>
2024-11-27 16:08:01 +00:00
Janos Follath
f36693822f
Merge pull request #9778 from waleed-elmelegy-arm/add-iop-export-pub-key-headers
Add header and documentation for interruptible ECC export public-key
2024-11-21 13:54:29 +00:00
David Horstmann
531adafb0a Move some test helpers out of Mbed TLS
Everything not TLS-related and not ALT-interface-related has been moved
out of tests/src and tests/include and into the framework, except for
the PSA test wrappers.

Signed-off-by: David Horstmann <david.horstmann@arm.com>
2024-11-18 15:50:43 +00:00
Waleed Elmelegy
fad77f1ff4 Add iop export public-key generated test wrappers
Signed-off-by: Waleed Elmelegy <waleed.elmelegy@arm.com>
2024-11-15 17:27:36 +00:00
Paul Elliott
2c9d398553 Add new psa_key_agreement() to key exercises
Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2024-11-15 14:09:03 +00:00
Paul Elliott
d118cd21d6 Fix definition of psa_generate_key_iop_complete()
Incorrect usage of psa_key_id_t breaks ability to regenerate psa_sim
headers properly, should have been mbedtls_svc_key_id_t in the first
place, so replace with that.

Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2024-11-14 19:07:58 +00:00
Waleed Elmelegy
a2891a9ac9 Add PSA interuptable key agreement APIs
Signed-off-by: Waleed Elmelegy <waleed.elmelegy@arm.com>
2024-11-06 16:03:46 +00:00
Manuel Pégourié-Gonnard
69868299a8
Merge pull request #9430 from davidhorstmann-arm/align-development-3.6-test-helpers
Align development test helpers with 3.6
2024-10-30 09:09:34 +00:00
David Horstmann
fd38fdf501 Disentangle 3.6/4.0 *_PSA_INIT/DONE variants
Since PSA is always on in 4.x, *_PSA_INIT() and *_PSA_DONE() can be
simply aliased to PSA_INIT() and PSA_DONE() until such a time as we
remove them.

Simplify the login of these PSA_INIT/DONE variants by aliasing them in
4.x and keeping the more complex 3.6 logic entirely separate.

Signed-off-by: David Horstmann <david.horstmann@arm.com>
2024-10-25 15:13:00 +01:00
David Horstmann
c46f8fb92f Harmonise names of MBEDTLS_TEST_HAVE_ macros
ACCEL is better than ALT as the ALT interfaces are going away.

Signed-off-by: David Horstmann <david.horstmann@arm.com>
2024-10-23 16:58:21 +01:00
David Horstmann
08ccf6ac9b Tidy up header guards
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2024-10-23 16:55:53 +01: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
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
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
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
David Horstmann
19bc246afa Re-add special case for 3.6
Take into account the fact that TLS 1.3 auto-calls psa_crypto_init()

Signed-off-by: David Horstmann <david.horstmann@arm.com>
2024-10-21 14:07:25 +01:00
David Horstmann
34d79ce73d Only guard with CRYPTO_CLIENT when version >= 4
In 4.x the semantics of MBEDTLS_PSA_CRYPTO_C and
MBEDTLS_PSA_CRYPTO_CLIENT are different compared with 3.6.

Where this is a problem, make guards more version-specific so that we
are guarding with MBEDTLS_PSA_CRYPTO_C for 3.6 and
MBEDTLS_PSA_CRYPTO_CLIENT for 4.x, keeping each branch the same as it
was formerly.

Signed-off-by: David Horstmann <david.horstmann@arm.com>
2024-10-21 14:06:26 +01:00
David Horstmann
0d8287c062 Align tests/src and include/src with 3.6 version
Allow tests/src and include/src to be Mbed TLS version-agnostic by:
* Sometimes accepting both an MBEDTLS_ and a PSA_ config option
* Sometimes using the version number to gate alternatives

Signed-off-by: David Horstmann <david.horstmann@arm.com>
2024-10-21 14:06:03 +01:00
Manuel Pégourié-Gonnard
49645f6490 Misc improvements to comments
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2024-09-05 10:47:45 +02:00
Manuel Pégourié-Gonnard
3106013e17 Fix code style (for real this time, hopefully)
For some reason I didn't think about other files in the previous commit.

Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2024-09-05 10:47:44 +02:00
Janos Follath
21445c580f Prepare codepath tests for early termination
Signed-off-by: Janos Follath <janos.follath@arm.com>
2024-09-05 10:47:42 +02:00
Janos Follath
514e62c833 Move bignum code path testing out of the library
Without this, it's not at all obvious that turning on MBEDTLS_TEST_HOOKS
doesn't change the functional behavior of the code.

Signed-off-by: Janos Follath <janos.follath@arm.com>
2024-09-05 10:47:40 +02: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
Paul Elliott
2dc5fa3a19 Add generated files for new iop key generation funcs
Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2024-08-15 13:51:05 +01:00
Janos Follath
1176e6f90e
Merge pull request #9410 from paul-elliott-arm/add_docs_iop_key_agreement
Add IOP Key agreement Documentation
2024-08-13 13:25:22 +00:00
Bence Szépkúti
88f3dd9f78
Merge pull request #9402 from tom-daubney-arm/remove_function_level_alt_interface
Remove function level alt interface
2024-08-09 17:59:51 +00: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
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
0e3704f0a0 Reorder blocks to avoid double negations
Convert `#if !... A #else B #endif` to `#if ... B #else A`. No semantic change.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-08-07 12:39:05 +02:00
Gilles Peskine
bdd16d4cb1 Make it possible to enable CTR_DRBG/PSA without a PSA AES driver
Make it possible, but not officially supported, to switch the CTR_DRBG
module to PSA mode even if MBEDTLS_AES_C is defined. This is not really
useful in practice, but is convenient to test the PSA mode without setting
up drivers.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-08-07 12:39:05 +02:00
Manuel Pégourié-Gonnard
821b908456
Merge pull request #9364 from eleuzi01/replace-ccm
Replace MBEDTLS_SSL_HAVE_CCM with PSA_WANT_ALG_CCM
2024-08-07 08:18:52 +00:00
Thomas Daubney
742a2e3619 Remove MBEDTLS_AES_SETKEY_ENC_ALT
Signed-off-by: Thomas Daubney <thomas.daubney@arm.com>
2024-08-06 15:09:16 +01:00
Elena Uziunaite
c256172b30 Replace MBEDTLS_SSL_HAVE_CCM with PSA_WANT_ALG_CCM
Signed-off-by: Elena Uziunaite <elena.uziunaite@arm.com>
2024-08-05 15:40:00 +01:00
Gilles Peskine
7db1bcdb34 Update generated PSA wrappers
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-08-05 15:52:37 +02:00
Gilles Peskine
b45af2f507 Update PSA wrappers
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-08-05 15:49:22 +02:00
Gilles Peskine
be6a47140b
Merge pull request #9365 from eleuzi01/replace-gcm
Replace MBEDTLS_SSL_HAVE_GCM with PSA_WANT_ALG_GCM
2024-08-05 09:43:23 +00:00
Gilles Peskine
9c9a3df3bf
Merge pull request #9366 from eleuzi01/replace-chachapoly
Replace MBEDTLS_SSL_HAVE_CHACHAPOLY with PSA_WANT_ALG_CHACHA20_POLY1305
2024-08-02 14:26:27 +00:00
Elena Uziunaite
83a0d9deec Replace MBEDTLS_SSL_HAVE_GCM with PSA_WANT_ALG_GCM
Signed-off-by: Elena Uziunaite <elena.uziunaite@arm.com>
2024-08-02 09:52:20 +01:00
Elena Uziunaite
5c70c30655 Replace MBEDTLS_SSL_HAVE_CHACHAPOLY with PSA_WANT_ALG_CHACHA20_POLY1305
Signed-off-by: Elena Uziunaite <elena.uziunaite@arm.com>
2024-07-31 16:31:00 +01:00
Elena Uziunaite
74342c7c2b Replace MBEDTLS_SSL_HAVE_CBC with PSA_WANT_ALG_CBC_NO_PADDING
Signed-off-by: Elena Uziunaite <elena.uziunaite@arm.com>
2024-07-31 16:19:15 +01:00
Elena Uziunaite
6121a344dd Replace MBEDTLS_SSL_HAVE_AES with PSA_WANT_KEY_TYPE_AES
Signed-off-by: Elena Uziunaite <elena.uziunaite@arm.com>
2024-07-30 18:42:19 +01:00
Ronald Cron
b16b8c2c0c Updated auto-generated psa_test_wrappers.
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2024-07-23 18:19:57 +02:00
Paul Elliott
c884b29b95 Add generated files for new iop key agreement funcs
Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2024-07-19 18:28:11 +01:00
Thomas Daubney
356309f462 Restore config option
Restore previously removed option but with a more
relevant name.

Signed-off-by: Thomas Daubney <thomas.daubney@arm.com>
2024-07-12 16:15:55 +01:00
Thomas Daubney
ebeef1508a Remove MBEDTLS_TEST_HAVE_ALT_GCM
Signed-off-by: Thomas Daubney <thomas.daubney@arm.com>
2024-07-12 16:15:55 +01:00
Thomas Daubney
c7cb810c22 Remove MBEDTLS_GCM_ALT
Signed-off-by: Thomas Daubney <thomas.daubney@arm.com>
2024-07-12 16:15:07 +01:00
Thomas Daubney
4137609776 Remove MBEDTLS_AES_ALT
Signed-off-by: Thomas Daubney <thomas.daubney@arm.com>
2024-07-12 16:13:37 +01:00
Elena Uziunaite
0916cd702f Replace MBEDTLS_MD_CAN_SHA256 with PSA_WANT_ALG_SHA_256
Signed-off-by: Elena Uziunaite <elena.uziunaite@arm.com>
2024-07-11 11:13:35 +03:00