Commit graph

26514 commits

Author SHA1 Message Date
Tom Cosgrove
0540fe74e3 Fix code style
Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com>
2023-07-27 14:17:27 +01:00
Gilles Peskine
25b4e72d6e MBEDTLS_PSA_CRYPTO_CONFIG is ready for production
It's ok if people use MBEDTLS_PSA_CRYPTO_CONFIG: it's not unstable or
unpredictable. But we still reserve the right to make minor changes
(e.g. https://github.com/Mbed-TLS/mbedtls/issues/7439).

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-07-27 15:09:24 +02:00
Janos Follath
e0fa7ec4db
Merge pull request #7988 from gabor-mezei-arm/7598_add_32bit_test_component
Add 32bit test component for ecp with new bignum interface
2023-07-27 13:00:04 +00:00
Agathiyan Bragadeesh
763b353f2f Replace TEST_ASSERT("message" == 0) with TEST_FAIL
Signed-off-by: Agathiyan Bragadeesh <agathiyan.bragadeesh2@arm.com>
2023-07-27 13:52:31 +01:00
Waleed Elmelegy
3d158f0c28 Adapt tests to work on all possible minimum RSA key sizes
Signed-off-by: Waleed Elmelegy <waleed.elmelegy@arm.com>
2023-07-27 11:03:35 +00:00
Waleed Elmelegy
ab5707185a Add a minimum rsa key size config to psa config
Signed-off-by: Waleed Elmelegy <waleed.elmelegy@arm.com>
2023-07-27 11:00:03 +00:00
Waleed Elmelegy
76336c3e4d Enforce minimum key size when generating RSA key size
Add configuration to enforce minimum size when
generating a RSA key, it's default value is 1024
bits since this the minimum secure value currently
but it can be any value greater than or equal 128
bits. Tests were modifed to accommodate for this
change.

Signed-off-by: Waleed Elmelegy <waleed.elmelegy@arm.com>
2023-07-27 10:58:25 +00:00
Manuel Pégourié-Gonnard
0fda0d2e5c Fix overly specific description in public doc
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2023-07-27 12:22:52 +02:00
Sarvesh Bodakhe
430a4f3968 rsa_signature: Use heap memory to allocate DER encoded RSA private key
'mbedtls_pk_psa_rsa_sign_ext' function allocates a buffer of maximum
size 5679 bytes (MBEDTLS_PK_RSA_PRV_DER_MAX_BYTES) on the stack to store
DER encoded private key. This increased stack usage significantly for
RSA signature operations when MBEDTLS_PSA_CRYPTO_C is defined.

This issue was discovered when adding support for EAP-TLS 1.3 (rfc9190).

Signed-off-by: Sarvesh Bodakhe <sarvesh.bodakhe@espressif.com>
2023-07-27 14:51:25 +05:30
Valerio Setti
9c5c2a4b71 crypto_legacy: fix initial comment
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-07-27 11:11:19 +02:00
Valerio Setti
3a96227706 generate_psa_tests: remove checks for DH's LEGACY symbols
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-07-27 11:01:33 +02:00
Valerio Setti
dfed278218 changelog: fix errors/typos
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-07-27 10:57:55 +02:00
Gilles Peskine
7ef14bf8a2
Merge pull request #7835 from gilles-peskine-arm/ssl_premaster_secret-empty-3.4
Fix empty union when TLS is disabled
2023-07-27 08:28:21 +00:00
Valerio Setti
4b36c59d42 ChangeLog: improving descriptions of KEY_PAIR changes
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-07-27 09:15:34 +02:00
Valerio Setti
27602c32a2 test: accelerate all KEY_PAIR symbols in accel FFDH component
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-07-27 09:15:34 +02:00
Valerio Setti
a55f042636 psa: replace DH_KEY_PAIR_LEGACY with new symbols
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-07-27 09:15:34 +02:00
Gilles Peskine
51ed3139d1
Merge pull request #7909 from mpg/dh-generate-psa-tests
Enable DH in generate_psa_tests.py
2023-07-26 17:46:09 +00:00
Gowtham Suresh Kumar
186731b22a Fix warnings from clang-16
Running clang-16 on mbedtls reports warnings of type "-Wstrict-prototypes".
This patch fixes these warnings by adding void to functions with no
arguments. The generate_test_code.py is modified to insert void into test
functions with no arguments in *.function files.

Signed-off-by: Gowtham Suresh Kumar <gowtham.sureshkumar@arm.com>
2023-07-26 17:11:51 +01:00
Gowtham Suresh Kumar
a12baf8c5f Update test scripts to use latest/earliest compilers
The Ubuntu 16.04 and 22.04 docker images have been updated with
earliest and latest versions of gcc and clang respectively.
This patch adds the necessary component and support functions
required for the CI to run these compilers.

For FreeBSD we invoke the function by name so a condition is added
to disable the existing test_clang_opt function for linux.

Signed-off-by: Gowtham Suresh Kumar <gowtham.sureshkumar@arm.com>
2023-07-26 16:51:45 +01:00
Gabor Mezei
e256cc1552
Add 32bit test component for ecp with new bignum interface
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2023-07-26 17:35:44 +02:00
Janos Follath
b52f9cf5eb
Merge pull request #7758 from xkqian/bignum_clone_ecp_curves
[Bignum] Bignum clone ecp curves
2023-07-26 13:33:56 +01:00
Gilles Peskine
bb07377458
Merge pull request #7935 from AgathiyanB/add-enum-casts
Add type casts for integer and enum types
2023-07-26 11:27:27 +02:00
Manuel Pégourié-Gonnard
1c739ec277
Merge pull request #7900 from mpg/doc-driver-only
ECPf wrap-up
2023-07-26 10:25:54 +02:00
Manuel Pégourié-Gonnard
182eb1514e Fix KeyType.can_do() for DH+FFDH
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2023-07-26 09:34:30 +02:00
Manuel Pégourié-Gonnard
c154a043bb Fix dependencies for DH (and RSA) key pairs
- RSA was missing the MBEDTLS_ prefix.
- DH needs the same temporary fix (prefix + suffix) for now.
- hack_dependencies_not_implemented() needs to ignore MBEDTLS_PSA_WANT
dependencies.

While at it, make the code currently used for ECC more generic, so that
it's ready to be used for RSA and DH in the near future.

Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2023-07-26 09:34:30 +02:00
Manuel Pégourié-Gonnard
636d85724a Shorten DH_FAMILY just like ECC_FAMILY
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2023-07-26 09:32:42 +02:00
Manuel Pégourié-Gonnard
afe4b79114 Enable DH in generate_psa_tests.py
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2023-07-26 09:32:42 +02:00
Paul Elliott
f1c032adba
Merge pull request #7902 from valeriosetti/issue7772
Define PSA_WANT_xxx_KEY_PAIR_yyy step 2/RSA
2023-07-25 17:13:43 +01:00
Tom Cosgrove
bc345e8685 Protect macro parameter expansion with parentheses
Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com>
2023-07-25 15:17:39 +01:00
Tom Cosgrove
350226f636 Use a macro for mbedtls_mpi_zeroize_and_free()
Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com>
2023-07-25 15:10:14 +01:00
Agathiyan Bragadeesh
93a859341b Remove remaining redundant casts
Signed-off-by: Agathiyan Bragadeesh <agathiyan.bragadeesh2@arm.com>
2023-07-25 12:28:59 +01:00
Agathiyan Bragadeesh
d298b76421 Remove redundant casts
Signed-off-by: Agathiyan Bragadeesh <agathiyan.bragadeesh2@arm.com>
2023-07-25 11:33:00 +01:00
Valerio Setti
19fec5487d test: remove GENPRIME dependency when RSA_KEY_PAIR_GENERATE
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-07-25 12:31:50 +02:00
Valerio Setti
fe478909f0 psa_crypto_rsa: fix guards for importing the key
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-07-25 12:27:19 +02:00
Valerio Setti
46520ea52d tls12: check buffer size before memcpy-ing data into it
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-07-25 11:41:28 +02:00
Valerio Setti
c9ae862225 tls: use TLS 1.3 guards in ssl_tls13 modules
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-07-25 11:23:50 +02:00
Valerio Setti
ea59c43499 tls: fix a comment a rename a variable/symbol
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-07-25 11:14:03 +02:00
Valerio Setti
d0371b0a08 debug: keep ECDH_C guard for debug printf accessing ecdh_context's items
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-07-25 10:57:01 +02:00
Valerio Setti
60d3b91eba tls: use TLS 1.2 macros in ssl_tls12_server.c
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-07-25 10:43:53 +02:00
Tom Cosgrove
17526a0d16
Merge pull request #7906 from yanrayw/add-pake_guards_psa_crypto
PSA: add guards for PAKE getter functions
2023-07-24 15:59:28 +01:00
Agathiyan Bragadeesh
3dd3ae219e Remove trailing backslash
Signed-off-by: Agathiyan Bragadeesh <agathiyan.bragadeesh2@arm.com>
2023-07-21 17:07:00 +01:00
Gilles Peskine
5647d06be8
Merge pull request #7518 from gilles-peskine-arm/psa_inject_entropy-file-stability
Fix and test MBEDTLS_PSA_INJECT_ENTROPY
2023-07-21 17:37:15 +02:00
Tom Cosgrove
e4e9e7da58 For tests, rename TEST_BUFFERS_EQUAL() to TEST_MEMORY_COMPARE()
Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com>
2023-07-21 11:45:25 +01:00
Tom Cosgrove
a45d902822 Rename the length argument to TEST_CALLOC() to be the more accurate item_count
Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com>
2023-07-21 11:36:11 +01:00
Tom Cosgrove
05b2a87ea0 For tests, rename TEST_CALLOC_OR_FAIL() to just TEST_CALLOC()
Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com>
2023-07-21 11:32:25 +01:00
Ronald Cron
87f62850f3
Merge pull request #7893 from ronald-cron-arm/misc-from-psa-crypto
Miscellaneous fixes resulting from the work on PSA-Crypto
2023-07-21 10:54:41 +02:00
Xiaokang Qian
c495845e7a Align ECP_MPI_INIT with mbedtls_mpi struct order in ecp_new.c
Signed-off-by: Xiaokang Qian <xiaokang.qian@arm.com>
2023-07-21 08:22:13 +00:00
Xiaokang Qian
73d98405b8 Rework the clone of ecp_curves.c
Change macro guard
rebase ecp_curves_new.c to the latest ecp_curves.c

Signed-off-by: Xiaokang Qian <xiaokang.qian@arm.com>
2023-07-21 08:22:12 +00:00
Xiaokang Qian
4d71051145 Enable build of ecp_curves_new.c
Signed-off-by: Xiaokang Qian <xiaokang.qian@arm.com>
2023-07-21 08:22:12 +00:00
Xiaokang Qian
dc2ea2705b Clone the ecp_curve.c file as ecp_curve_new.c
Use macro guard MBEDTLS_ECP_WITH_MPI_UINT/STRUCT to enable
either c file

Signed-off-by: Xiaokang Qian <xiaokang.qian@arm.com>
2023-07-21 08:22:11 +00:00