Commit graph

26497 commits

Author SHA1 Message Date
Dave Rodgman
fb1b851797 Improve docs for mbedtls_mpi_core_cond_assign
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-07-31 12:27:05 +01:00
Janos Follath
2f04582d37 Move MBEDTLS_ECP_WITH_MPI_UINT to mbedtls_config.h
There is a precedent for having bigger and less mature options in
mbedtls_config.h (MBEDTLS_USE_PSA_CRYPTO) for an extended period.
Having this option in mbedtls_config.h is simpler and more robust.

Signed-off-by: Janos Follath <janos.follath@arm.com>
2023-07-31 10:57:16 +01:00
Valerio Setti
43c5bf4f88 crypto_sizes: use PSA_WANT_ALG for MAX signatures and key agreement sizes
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-07-31 11:35:48 +02:00
Valerio Setti
f5051efa81 test: properly size output buffer in key_agreement_fail()
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-07-31 11:35:48 +02:00
Valerio Setti
8b27decc6a Revert "crypto_sizes: check also if DH is enabled for PSA_SIGNATURE_MAX_SIZE"
This reverts commit 478c236938.

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-07-31 11:35:42 +02:00
Janos Follath
f3135af159 Use config.py in all new bignum tests
This previous test is correct, as it is using make. Switch to using
config.py for robustness and consistency.

Signed-off-by: Janos Follath <janos.follath@arm.com>
2023-07-31 10:07:57 +01:00
Janos Follath
82823b2fe8 Fix new bignum tests
These tests weren't working, because they use CMake and can't pass
options with CFLAGS directly. This could be mitigated by adding a CMake
option, but using config.py is less invasive and it is what we normally
use for setting build options anyway.

Signed-off-by: Janos Follath <janos.follath@arm.com>
2023-07-31 10:01:47 +01:00
Xiaokang Qian
59159abcce Fix fast quasi-reduction modulo value of p192K1 in comments
Signed-off-by: Xiaokang Qian <xiaokang.qian@arm.com>
2023-07-31 06:46:28 +00:00
Xiaokang Qian
d0657b0015 ecp_mod_p448 has been moved to ecp_mod_p_generic_raw, remove here
Signed-off-by: Xiaokang Qian <xiaokang.qian@arm.com>
2023-07-31 06:46:28 +00:00
Xiaokang Qian
796500e751 Fix the type cast(size_t to unsigned short) warning
Signed-off-by: Xiaokang Qian <xiaokang.qian@arm.com>
2023-07-31 06:46:28 +00:00
Xiaokang Qian
b903f4ecb6 Free P and N of the group cause they are dynamic allocated
Signed-off-by: Xiaokang Qian <xiaokang.qian@arm.com>
2023-07-31 06:46:28 +00:00
Xiaokang Qian
02a3e0318f Declare mbedtls_ecp_fix_negative() always static to fix check_name failures
Signed-off-by: Xiaokang Qian <xiaokang.qian@arm.com>
2023-07-31 06:46:28 +00:00
Xiaokang Qian
a8d30ac7e5 Use new ECP_LIGHT symbol in ecp_curves.c
Signed-off-by: Xiaokang Qian <xiaokang.qian@arm.com>
2023-07-31 06:46:28 +00:00
Xiaokang Qian
be4d6b62ab Fix use of sizeof without brackets in ecp_curves.c
Signed-off-by: Xiaokang Qian <xiaokang.qian@arm.com>
2023-07-31 06:46:28 +00:00
Xiaokang Qian
e25597dad7 Make ecp_mode_xxx functions depend on the new macro
Signed-off-by: Xiaokang Qian <xiaokang.qian@arm.com>
2023-07-31 06:46:28 +00:00
Xiaokang Qian
748a362fd0 Revert ecp_curves.c to commit 449bd83 to save code size
Signed-off-by: Xiaokang Qian <xiaokang.qian@arm.com>
2023-07-31 06:46:28 +00:00
Dave Rodgman
2b174abd86 code style
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-07-28 18:29:41 +01:00
Dave Rodgman
2d28c46055 Fix asm Memsan workaround
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-07-28 18:24:22 +01:00
Dave Rodgman
983448ea62 fix check for no-longer-used macro
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-07-28 17:30:52 +01:00
Gowtham Suresh Kumar
6f1977bf20 Use variables for selecting compilers
The latest and earliest clang/GCC compilers are now used through
variables instead of symlinks and also the all.sh script is updated
to support options for overriding the default values.

Signed-off-by: Gowtham Suresh Kumar <gowtham.sureshkumar@arm.com>
2023-07-28 17:04:47 +01:00
Gowtham Suresh Kumar
1e829a403f Use compgen to gather components in all.sh
Signed-off-by: Gowtham Suresh Kumar <gowtham.sureshkumar@arm.com>
2023-07-28 16:41:21 +01:00
Dave Rodgman
d684d7342b code style
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-07-28 16:39:38 +01:00
Dave Rodgman
08691679b5 Enable testing of asm under Memsan
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-07-28 16:39:38 +01:00
Gowtham Suresh Kumar
8d45ec8b97 Remove test_clang_opt check
The component functions in all.sh will be listed using
compgen instead of sed so this check is not needed.

Signed-off-by: Gowtham Suresh Kumar <gowtham.sureshkumar@arm.com>
2023-07-28 16:36:25 +01:00
Valerio Setti
1eacae865e test: check exported length against proper MAX_SIZE
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-07-28 17:29:48 +02:00
Dave Rodgman
fa5a4bbb02 Improve mbedtls_ct_memmove_left w.r.t. const-flow tests
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-07-28 16:13:52 +01:00
Valerio Setti
9cd8011978 tls: fix definition of symbol KEY_EXCHANGE_SOME_XXDH_PSA_ANY
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-07-28 16:46:55 +02:00
Dave Rodgman
8de3482507 Fix false-positive non-const-time errors in test
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-07-28 15:10:00 +01:00
Valerio Setti
478c236938 crypto_sizes: check also if DH is enabled for PSA_SIGNATURE_MAX_SIZE
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-07-28 16:05:53 +02:00
Valerio Setti
c1319f4a26 debug: improve debug_print_psa_ec() as not to depend on bignum
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-07-28 13:44:51 +02:00
Valerio Setti
797e396fd9 debug: use proper guard for PK_DEBUG_MPI items
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-07-28 13:44:26 +02:00
Dave Rodgman
cec82e41e0
Merge pull request #8003 from daverodgman/code_style_since
Make code_style.py --since more precise
2023-07-28 10:56:58 +01:00
Manuel Pégourié-Gonnard
43cef57e51
Merge pull request #7811 from mpg/md-info
Optimize strings in MD
2023-07-28 08:34:09 +00:00
Valerio Setti
c012a2de7c crypto_sizes: change initial MAX_SIZE value to 1
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-07-28 09:34:44 +02:00
Valerio Setti
644e01d767 crypto_sizes: fix typo
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-07-28 09:31:51 +02:00
Dave Rodgman
fccc5f8b9d whitespace fix
Signed-off-by: Dave Rodgman <dave.rodgman@gmail.com>
2023-07-27 20:00:41 +01:00
Dave Rodgman
82d174a6a8 pylint tidy-up
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-07-27 18:51:06 +01:00
Dave Rodgman
eaf2761ae1 Make code_style.py -s default to -s=development
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-07-27 17:43:55 +01:00
Dave Rodgman
05b60f40ac Make code_style.py -s more precise
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-07-27 17:43:48 +01:00
Valerio Setti
a83d9bf0db crypto_sizes: size PSA max symbols according to actual support
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-07-27 18:15:20 +02:00
Waleed Elmelegy
d7bdbbeb0a Improve naming of mimimum RSA key size generation configurations
Signed-off-by: Waleed Elmelegy <waleed.elmelegy@arm.com>
2023-07-27 14:50:09 +00:00
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
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