6448 Commits

Author SHA1 Message Date
Valerio Setti
e095a67bb2 pk: improve mbedtls_pk_copy_from_psa()
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-03-11 11:34:58 +01:00
Valerio Setti
6f5f9f5ce8 test_suite_pk: fix some comments
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-03-11 11:34:58 +01:00
Valerio Setti
ab7ddbc812 test_suite_pk: when ANY_HASH is used then pick any available MD alg in the build
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-03-11 11:34:58 +01:00
Valerio Setti
3433f832fb test_suite_pk: improve PSA alg selection in pk_copy_from_psa_success()
Use the same hashing algorithm as md_for_test.

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-03-11 11:34:58 +01:00
Valerio Setti
039bbbac33 test_suite_pk: destroy original xkey after pk_copy_from_psa() in pk_copy_from_psa_success()
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-03-11 11:34:58 +01:00
Valerio Setti
4114a54403 test_suite_pk: add description for psa_pub_key_from_priv()
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-03-11 11:34:58 +01:00
Valerio Setti
42a58a5249 test_suite_pk: minor fixes for test failures
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-03-11 11:34:58 +01:00
Valerio Setti
e700d8086e rsa: rsa_rsassa_pss_sign() to check MD alg both in parameters and RSA context
This helps fixing a disparity between the legacy and the USE_PSA
case for rsa_sign_wrap() in pk_wrap.c.

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-03-11 11:34:58 +01:00
Valerio Setti
f22eff99a6 test_suite_pk: add new test case for an algorithm only avaible in driver
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-03-11 11:34:58 +01:00
Valerio Setti
a657ae388a pk: pk_copy_from_psa() performs the conversion even if the algorithm doesn't match
This commit also:
- fixes existing tests and add new ones
- updates documentation.

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-03-11 11:34:58 +01:00
Valerio Setti
1015985d8a test_suite_pk: add more test cases for pk_copy_from_psa_success()
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-03-11 11:34:58 +01:00
Valerio Setti
d2ccc2f468 test_suite_pk: various minor fixes
- removed redundant info from data file (i.e. informations that
  can be extrapolated somehow)
- removed unecessary parameters in functions
- added some extra check on the generated PK contexts
- etc...

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-03-11 11:34:58 +01:00
Valerio Setti
61a47a46ea test_suite_pk: extend testing in pk_copy_from_psa()
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-03-11 11:34:58 +01:00
Valerio Setti
aeeefef64e pk_wrap: use correct PSA alg in rsa_encrypt_wrap() when USE_PSA
This bugfix was due in PR #8826, but we didn't catch that.
This commit also add proper testing in test_suite_pk that was not implemented
in #8826.

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-03-11 11:34:58 +01:00
Valerio Setti
88e2dac6d6 test_suite_pk: rename PK context variables
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-03-11 11:34:58 +01:00
Valerio Setti
e8fe3e76c4 test_suite_pk: add key pair check in pk_copy_from_psa_success()
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-03-11 11:34:58 +01:00
Valerio Setti
3a815cbd2f all.sh: keep RSA_C enabled in component_full_no_pkparse_pkwrite()
This is possible because after #8740 RSA_C no longer depends on
PK to parse and write private/public keys.

This commit also solves related issues that arose after this change
in "pk.c" and "test_suite_pk". In particular now we can use
rsa's module functions for parsing and writing keys without need
to rely on pk_parse and pk_write functions.

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-03-11 11:34:53 +01:00
Minos Galanakis
f9a6893b55 Changelog: Added entry for ssl_session accessors.
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2024-03-11 10:09:44 +00:00
Valerio Setti
61532e9a6b test_suite_pk: fix typos
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-03-11 09:48:40 +01:00
Valerio Setti
01ba66d56e pk: replace CRYPTO_CLIENT guards with CRYPTO_C
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-03-11 09:48:40 +01:00
Valerio Setti
452d2d2ccb test_suite_pk: add some initial testing for mbedtls_pk_copy_from_psa()
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-03-11 09:48:40 +01:00
Ronald Cron
61fd13c6a5 Merge remote-tracking branch 'mbedtls/development' into tls13-cli-max-early-data-size 2024-03-10 18:09:47 +01:00
Ronald Cron
7e1f9f290f
Merge pull request #8854 from ronald-cron-arm/tls13-srv-max-early-data-size
TLS 1.3: Enforce max_early_data_size on server
2024-03-09 00:16:07 +00:00
Ronald Cron
e1295fabaf tests: ssl: early data: Fix comments
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2024-03-08 17:05:27 +01:00
Ronald Cron
52472104a2 tests: suite: early data: Add comments
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2024-03-08 14:51:20 +01:00
Ronald Cron
4facb0a9cd tests: ssl: Improve early data test code
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2024-03-08 14:51:20 +01:00
Ronald Cron
1a13e2f43e tests: ssl: Improve test code for very small max_early_data_size
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2024-03-08 14:51:20 +01:00
Ronald Cron
139a4185b1
Merge pull request #8587 from yanrayw/issue/4911/ssl_setup-check-RNG-configuration
TLS: check RNG when calling mbedtls_ssl_setup()
2024-03-08 07:38:39 +00:00
tom-daubney-arm
d4c57c0ad2
Merge branch 'development-restricted' into key_agreement_buffer_protection
Signed-off-by: tom-daubney-arm <74920390+tom-daubney-arm@users.noreply.github.com>
2024-03-06 16:47:13 +00:00
Ryan
2066d0451f Add test cases for concurrently_generate_keys
For every generate_key test there is now a concurrently_generate_keys test.
8 threads per test, and 5 repetitions.

Signed-off-by: Ryan Everett <ryan.everett@arm.com>
2024-03-06 16:46:00 +00:00
Ryan
3a1b786d5d Add a concurrent key generation test function
Split into n threads, each thread will repeatedly generate,
exercise and destroy a key.
Then join the threads, and ensure using PSA_DONE that no keys still exist.

Signed-off-by: Ryan Everett <ryan.everett@arm.com>
2024-03-06 16:45:36 +00:00
Thomas Daubney
a4866945b8 Fix issue with large allocation in tests
In test_suite_psa_crypto_op_fail.generated.function
the function key_agreement_fail was setting the
public_key_length variable to SIZE_MAX which meant that
a huge allocation was being attempted.

Signed-off-by: Thomas Daubney <thomas.daubney@arm.com>
2024-03-06 16:32:25 +00:00
Minos Galanakis
411cb6c30f test_suite_ssl: Added ssl_session_id_accessors_check.
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2024-03-06 13:52:03 +00:00
David Horstmann
a5175634b0
Merge branch 'development-restricted' into copying-pake
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2024-03-06 11:18:28 +00:00
Gilles Peskine
71cc260563
Merge pull request #8728 from minosgalanakis/features/add_mbedtls_x509_crt_get_ca_istrue_accesor_6151
[MBEDTLS_PRIVATE] Add mbedtls_x509_crt_get_ca_istrue() accesor
2024-03-05 18:04:06 +00:00
Dave Rodgman
3c4166aef3
Merge pull request #8863 from minosgalanakis/feature/add_ecdh_context_5016
[MBEDTLS_PRIVATE] Add a getter for the ECDH context->grp.id member.
2024-03-05 16:58:13 +00:00
Minos Galanakis
581e63637a test_suite_x509parse: Added test-case for legacy certificate
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2024-03-05 14:39:23 +00:00
Gilles Peskine
8462146d01
Merge pull request #8867 from gilles-peskine-arm/psa_key_attributes-remove_core
Merge psa_core_key_attributes_t back into psa_key_attributes_t
2024-03-05 09:59:24 +00:00
Gilles Peskine
fad79fcdd9 Merge remote-tracking branch 'development' into ecp-write-ext-3.6
Conflicts:
* library/pk.c: mbedtls_pk_wrap_as_opaque() changed in the feature branch
  and was removed in the target branch.
2024-03-04 08:52:08 +01:00
Minos Galanakis
a83ada4eba tests: Added test for mbedtls_x509_crt_get_ca_istrue()
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2024-03-04 02:22:01 +00:00
Ronald Cron
e93cd1b580 tests: ssl: Free write/read test buffers
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2024-03-01 19:30:00 +01:00
Ronald Cron
7c07aab72e tests: write early data: Improve tls13_cli_max_early_data_size
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2024-03-01 19:07:40 +01:00
Ronald Cron
ae6f9a58a9 tests: write early data: Allocate buffer to write/read
Allocate the buffer to write/read early data. That
way in ASan builds. buffer overwrite/overread can
be detected.

Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2024-03-01 19:07:34 +01:00
Ronald Cron
aab4a546bf tests: Set the default conf then customize
Set the default conf then customize, not the
other way around.

Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2024-03-01 17:09:22 +01:00
Ronald Cron
10b040fa6f tests: ssl_helpers: Rename rng_get to mbedtls_test_random
mbedtls_test_ as the prefix for test APIs
_random like in mbedtls_ctr/hmac_drbg_random

Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2024-03-01 17:00:38 +01:00
Manuel Pégourié-Gonnard
e33b349c90
Merge pull request #8864 from valeriosetti/issue8848
Deprecate or remove mbedtls_pk_wrap_as_opaque
2024-03-01 15:54:32 +00:00
Ronald Cron
de9b03dcba tls13: Rename early_data_count to total_early_data_size
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2024-03-01 15:14:17 +01:00
Ronald Cron
aad8523764 tests: ssl: Test enforcement of maximum early data size
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2024-03-01 15:10:22 +01:00
Ronald Cron
fcbf776d06 tests: ssl: Restore write_early_data test function
For negative testing of early data (tests
related to max_early_data_size in this PR), restore
the test function to write early data that was
first introduced to be able to test the reading
of early data with the writing part and was
removed (as not used anymore) by the PR 8760.

Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2024-03-01 10:00:47 +01:00
Ronald Cron
25ad10a920 tests: ssl: Improve tls13_srv_max_early_data_size()
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2024-03-01 09:29:16 +01:00