Janos Follath
c25567af23
Move variant test to ecp_curves
...
We would like to de-duplicate ecp.c, but ecp_curves.c remains duplicated
and we still want to test for the active variant.
Signed-off-by: Janos Follath <janos.follath@arm.com>
2023-08-02 10:32:21 +01:00
Bence Szépkúti
9661f8ab0d
Merge pull request #7968 from gowthamsk-arm/use_earliest_latest_compilers
...
Use earliest latest compilers
2023-08-02 05:58:02 +00:00
Chien Wong
e2caf4161b
Fix a few unchecked value issue
...
Signed-off-by: Chien Wong <m@xv97.com>
2023-08-01 22:41:17 +08:00
Dave Rodgman
205295c576
Tidy-up: move GCC warning fix to constant_time_impl.h
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-08-01 14:10:56 +01:00
Gilles Peskine
d55e451b3e
Merge pull request #7997 from yanesca/fix_new_bignum_tests
...
Fix new bignum tests
2023-08-01 12:09:39 +00:00
Dave Rodgman
1f39f037bf
Improve variable name in mbedtls_mpi_lt_mpi_ct
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-08-01 09:19:16 +01:00
Tom Cosgrove
52f7e18042
Use mbedtls_zeroize_and_free() in psa_remove_key_data_from_memory()
...
Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com>
2023-08-01 09:08:48 +01:00
Manuel Pégourié-Gonnard
de8f56e936
Merge pull request #7884 from valeriosetti/issue7612
...
TLS: Clean up (EC)DH dependencies
2023-08-01 07:13:36 +00:00
Dave Rodgman
3d574da6fc
Revert to not enabling asm under Memsan
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-07-31 17:22:58 +01:00
Dave Rodgman
378280e57f
Revert "Move constant_flow.h into the main library"
...
This reverts commit fd78c34e23
.
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-07-31 17:22:55 +01:00
Dave Rodgman
3d1bb9be06
Revert "Fix doxygen error"
...
This reverts commit d175d52433
.
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-07-31 17:22:49 +01:00
Dave Rodgman
d175d52433
Fix doxygen error
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-07-31 14:03:08 +01:00
Dave Rodgman
fd78c34e23
Move constant_flow.h into the main library
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-07-31 12:48:33 +01:00
Dave Rodgman
1714a9b0eb
Revert to old design for mbedtls_ct_memmove_left
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-07-31 12:48:33 +01:00
Dave Rodgman
9ee0e1f6fe
Remove GCC redundant-decls workaround for mbedtls_ct_memcmp
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-07-31 12:43:23 +01:00
Dave Rodgman
0172de8b3d
Fix docs grammar
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-07-31 12:43:23 +01:00
Dave Rodgman
741d423ef8
Clarify docs for mbedtls_ct_memcpy_if
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-07-31 12:43:23 +01:00
Dave Rodgman
93cec45af3
Improve docs for mbedtls_ct_compiler_opaque
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-07-31 12:43:23 +01:00
Dave Rodgman
32d726033b
Improve comments in mbedtls_mpi_lt_mpi_ct
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-07-31 12:43:23 +01:00
Dave Rodgman
07f853713d
Clarify comments in mbedtls_ct_memcpy_if
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-07-31 12:27:49 +01:00
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
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
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
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
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
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
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
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
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
Kusumit Ghoderao
f3e696dc1b
Add ifdef for hmac and cmac set password
...
Signed-off-by: Kusumit Ghoderao <Kusumit.Ghoderao@silabs.com>
2023-07-28 13:30:50 +05:30
Kusumit Ghoderao
5f3345ae44
Add issue link instead of issue number
...
Signed-off-by: Kusumit Ghoderao <Kusumit.Ghoderao@silabs.com>
2023-07-27 21:21:38 +05:30
Kusumit Ghoderao
0bca4c5fc4
Add ifdef for hmac and cmac specific functions
...
Signed-off-by: Kusumit Ghoderao <Kusumit.Ghoderao@silabs.com>
2023-07-27 21:20:14 +05:30
Kusumit Ghoderao
a12e2d53bd
Replace AES_CMAC_128_PRF_OUTPUT_SIZE with PSA_MAC_LENGTH()
...
Signed-off-by: Kusumit Ghoderao <Kusumit.Ghoderao@silabs.com>
2023-07-27 21:18:30 +05:30
Kusumit Ghoderao
9ab03c3d72
Define PSA_ALG_IS_PBKDF2
...
Signed-off-by: Kusumit Ghoderao <Kusumit.Ghoderao@silabs.com>
2023-07-27 21:14:05 +05:30
Kusumit Ghoderao
2addf35855
Replace MBEDTLS_PSA_BUILTIN_PBKDF2_XXX with PSA_HAVE_SOFT_PBKDF2
...
Signed-off-by: Kusumit Ghoderao <Kusumit.Ghoderao@silabs.com>
2023-07-27 21:11:09 +05:30
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
Dave Rodgman
f2e3eb8bd9
Add OID for HMAC-RIPEMD160
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-07-27 15:46:05 +01:00
Dave Rodgman
5cc67a3ee2
Add OIDs for HMAC-SHA3
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-07-27 14:44:35 +01:00
Dave Rodgman
a2cdc840de
Fix pre-existing missing closing #endif comment
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-07-27 14:44:13 +01: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
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
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
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
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
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
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
Dave Rodgman
cad28ae77a
Merge remote-tracking branch 'origin/development' into psa-sha3
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-07-24 15:51:13 +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
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
Manuel Pégourié-Gonnard
c844c1a771
Merge pull request #7546 from mpg/align-psa-md-identifiers
...
Align psa md identifiers
2023-07-20 11:34:28 +02:00
Dave Rodgman
7fa27a1a18
Merge pull request #7960 from daverodgman/expect-fix
2023-07-19 19:48:15 +01:00
Dave Rodgman
e9fcffd089
Robustness fix to MBEDTLS_LIKELY
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-07-19 15:43:07 +01:00
Dave Rodgman
8e8e6b9be3
Merge pull request #7934 from AgathiyanB/move-declarations-to-top
...
Move declarations to top of functions
2023-07-19 15:25:27 +01:00
Dave Rodgman
6dd40642e8
Merge pull request #7932 from AgathiyanB/add-mpi-uint-size-macro
...
Use compile-time determination of which __builtin_clz() to use, with new MBEDTLS_MPI_UINT_SIZE macro
2023-07-19 14:57:39 +01:00
Dave Rodgman
9e8104cdd9
Merge pull request #7949 from AgathiyanB/IAR-asm-keyword
...
Use correct asm keyword for IAR compilers
2023-07-19 10:03:30 +01:00
Dave Rodgman
131a22ef27
Merge pull request #7950 from AgathiyanB/fix-IAR-using-memset-s
...
Fix IAR trying to use memset_s in platform_util
2023-07-19 10:01:58 +01:00
Dave Rodgman
5f65acb02b
Merge pull request #7859 from gilles-peskine-arm/mbedtls_mpi-smaller
...
Reduce the size of mbedtls_mpi
2023-07-18 16:48:37 +01:00
Tom Cosgrove
46259f670f
Internal function mbedtls_mpi_zeroize() can be mbedtls_mpi_zeroize_and_free()
...
Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com>
2023-07-18 16:44:14 +01:00
Tom Cosgrove
3a11bb8213
Better wording around passing NULL to mbedtls_zeroize_and_free()
...
Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com>
2023-07-18 16:26:29 +01:00
Agathiyan Bragadeesh
789e50e5a0
Use correct asm keyword for IAR compilers
...
Signed-off-by: Agathiyan Bragadeesh <agathiyan.bragadeesh2@arm.com>
2023-07-18 16:12:24 +01:00
Dave Rodgman
b8f18850c6
Align ECP_MPI_INIT parameter order with mbedtls_mpi struct order
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-07-18 13:53:07 +02:00
Manuel Pégourié-Gonnard
828b3acd6b
Merge pull request #7848 from valeriosetti/issue7749
...
driver-only ECC: EPCf.TLS testing
2023-07-18 10:33:21 +02:00
Agathiyan Bragadeesh
74852038ee
Fix IAR trying to use memset_s in platform_util
...
Signed-off-by: Agathiyan Bragadeesh <agathiyan.bragadeesh2@arm.com>
2023-07-17 18:35:30 +01:00
Agathiyan Bragadeesh
387bfa5b84
Add cast in psa_crypto
...
Signed-off-by: Agathiyan Bragadeesh <agathiyan.bragadeesh2@arm.com>
2023-07-17 17:01:33 +01:00
Agathiyan Bragadeesh
4d47cea8f9
Move declarations in psa_crypto to top
...
Signed-off-by: Agathiyan Bragadeesh <agathiyan.bragadeesh2@arm.com>
2023-07-17 16:58:44 +01:00
Tom Cosgrove
08b04b11ff
Merge pull request #7923 from gabor-mezei-arm/7598_fix_clone_of_ecp_module
...
[Bignum] Fixes for the ecp module cloning
2023-07-17 15:28:18 +01:00
Agathiyan Bragadeesh
5058a5b5ad
Remove trailing whitespace bignum_core
...
Signed-off-by: Agathiyan Bragadeesh <agathiyan.bragadeesh2@arm.com>
2023-07-17 15:23:52 +01:00
Tom Cosgrove
ca8c61b815
Provide and use internal function mbedtls_zeroize_and_free()
...
Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com>
2023-07-17 15:17:40 +01:00
Agathiyan Bragadeesh
10b6775aeb
Add enum type casts in lmots.c and lms.c
...
The IAR compiler throws an error when trying to assign an int to an enum
so these casts have been added.
Signed-off-by: Agathiyan Bragadeesh <agathiyan.bragadeesh2@arm.com>
2023-07-17 15:14:42 +01:00
Agathiyan Bragadeesh
01ed84a1f3
Add type casts in rsa.c
...
Signed-off-by: Agathiyan Bragadeesh <agathiyan.bragadeesh2@arm.com>
2023-07-17 15:14:42 +01:00
Agathiyan Bragadeesh
8b52b88b6d
Add type casts in ssl library
...
Signed-off-by: Agathiyan Bragadeesh <agathiyan.bragadeesh2@arm.com>
2023-07-17 15:14:42 +01:00
Agathiyan Bragadeesh
e55a1e1cf4
Refactor preprocessing for arm none
...
Signed-off-by: Agathiyan Bragadeesh <agathiyan.bragadeesh2@arm.com>
2023-07-17 15:00:19 +01:00
Agathiyan Bragadeesh
ec4c91ecc1
Move declaration in ecp_mod_koblitz to top
...
Signed-off-by: Agathiyan Bragadeesh <agathiyan.bragadeesh2@arm.com>
2023-07-17 12:21:06 +01:00
Agathiyan Bragadeesh
c99840ae1f
Move declarations in mbedtls_mpi_add_abs to top
...
Signed-off-by: Agathiyan Bragadeesh <agathiyan.bragadeesh2@arm.com>
2023-07-17 12:21:06 +01:00
Agathiyan Bragadeesh
271a95331e
Remove tautology in mbedtls_mpi_core_clz
...
Signed-off-by: Agathiyan Bragadeesh <agathiyan.bragadeesh2@arm.com>
2023-07-14 14:07:18 +01:00
Dave Rodgman
fba559822f
Ensure constant values not known to compiler
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-07-14 13:44:22 +01:00
Dave Rodgman
a02b36886c
Fix gcc warnings when -Wredundant-decls set
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-07-14 13:43:39 +01:00
Gabor Mezei
66bbecb7ff
Fix comment
...
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2023-07-14 14:43:27 +02:00
Dave Rodgman
8f6094ce47
Merge pull request #7792 from robUx4/win32_winnt
2023-07-13 19:34:24 +01:00
Dave Rodgman
63a21f4cda
Merge pull request #7920 from daverodgman/gcm-size
2023-07-13 19:32:07 +01:00
Dave Rodgman
5ff02450ee
Reduce size of static data in gcm
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-07-13 15:57:20 +01:00
Steve Lhomme
551b3bf4bb
Don't force the _WIN32_WINT version
...
If the user has set a value in the build environment, it will be used.
Otherwise, if SDK has a default value, it will be picked.
If either of these values are lower than 0x0501 (XP) we should not force
some calls that will not work on the minimum target OS. We should use
dynamic loading of these API's to support them in higher versions of the
OS.
winsock2.h needs to be included before windows.h and will pick the
default _WIN32_WINNT from the SDK or use the one from the user, by
setting _WIN32_WINNT in the CFLAGS.
Signed-off-by: Steve Lhomme <robux4@ycbcr.xyz>
2023-07-13 16:11:34 +02:00
Steve Lhomme
4000b6ec0e
Don't force the default windows version down
...
The _WIN32_WINNT value will pick the default value for the SDK when
including windows.h. Depending on its value some calls will be possible or not.
Signed-off-by: Steve Lhomme <robux4@ycbcr.xyz>
2023-07-13 16:11:34 +02:00
Steve Lhomme
369d7c7148
Don't use FindFirstFileW() before Windows XP
...
On runtime it will attempt to get FindFirstFileW() from kernel32.dll
but it's not there and the DLL/program containing mbedtls will not load.
Signed-off-by: Steve Lhomme <robux4@ycbcr.xyz>
2023-07-13 16:11:34 +02:00
Jerry Yu
893be8d10f
Replace cpu modifier flags
...
`crypto` should be replace with `aes`.
See https://arm-software.github.io/acle/main/acle.html#cryptographic-extensions
Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
2023-07-13 17:32:11 +08:00
Jerry Yu
b1d06bb29e
Add error message for old armclang
...
when armclang<6.10, cpu modifiers MUST be
specified on command line.
Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
2023-07-13 10:40:29 +08:00
Jerry Yu
8e96e78dbe
update document and error message
...
Chang the spell of armclang
Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
2023-07-13 10:40:28 +08:00
Jerry Yu
6b00f5a135
Add guards for arm_neon.h
...
See: https://arm-software.github.io/acle/main/acle.html#arm_neonh
Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
2023-07-13 10:40:28 +08:00
Jerry Yu
22a4d3e2b4
fix armclang build fail for sha512.
...
`sha3` support is start from armclang6.10
Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
2023-07-13 10:40:28 +08:00
Jerry Yu
580e06fb07
fix armclang compile fail
...
`__ARM_FEATURE_AES` is not defined with `armclang < 6.10`.
And it raise error on `target("crypto,aes")
Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
2023-07-13 10:40:27 +08:00
Jerry Yu
08933d3dbb
fix compile fail for armclang
...
when target flags are not set at command line, armclang
will reports required feature not set error.
This is found and verified at 6.20.1. And it does not work
for 6.6
Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
2023-07-13 10:40:08 +08:00
Paul Elliott
3c22366695
Merge pull request #7863 from valeriosetti/issue7790
...
PK: parse: fix disparity with private Montgomery keys
2023-07-11 18:02:12 +01:00
Dave Rodgman
a824e40749
Merge pull request #7500 from tom-cosgrove-arm/fix-armclang-bswap32
...
Fix MBEDTLS_BSWAP32 on armcc 5
2023-07-11 16:48:42 +01:00
Dave Rodgman
84eaefa43e
Use designated initializers for mbedtls_mpi
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-07-11 16:02:46 +01:00
Valerio Setti
7e6aaa1ea5
psa: fix missed LEGACY symbols caused by the rebase
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-07-11 16:59:21 +02:00
Paul Elliott
88f34e3348
Merge pull request #7703 from gabor-mezei-arm/7598_clone_the_eco_module
...
[Bignum] Clone the ECP module
2023-07-11 15:00:01 +01:00
Tom Cosgrove
f2b5a13d02
Fix MBEDTLS_BSWAP32 on armcc 5
...
Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com>
2023-07-11 14:06:37 +01:00
Valerio Setti
76df8c1900
psa: remove redundant GENPRIME when RSA_KEY_PAIR_GENERATE is defined
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-07-11 14:11:28 +02:00
Valerio Setti
b2bcedbf9a
library: replace MBEDTLS_PSA_BUILTIN_KEY_TYPE_RSA_KEY_PAIR_LEGACY
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-07-11 14:06:00 +02:00
Valerio Setti
f6d4dfb745
library: replace PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_LEGACY symbols with proper ones
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-07-11 14:06:00 +02:00
Dave Rodgman
4999f15d98
Merge pull request #7878 from beni-sandu/development
...
aesce: use correct target attribute when building with clang
2023-07-11 10:54:14 +01:00
Yanray Wang
ffc3c48e4e
Remove getter functions of PAKE if no PAKE algorithms are required
...
Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-07-11 17:33:22 +08:00
Valerio Setti
41b0818bcb
ecp: rearrange code in ecp_read_key()
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-07-11 11:28:22 +02:00
Valerio Setti
21d42417f9
pkparse: always check all private keys on import
...
This allows to remove explicit calls to mbedtls_ecp_check_privkey()
in pkparse.c.
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-07-11 11:28:22 +02:00
Valerio Setti
6b062eeed0
pkparse: parse also Weierstrass private keys using ecp_read_key()
...
This is to hanlde more uniformly Weierstrass and Montgomery curves.
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-07-11 11:28:22 +02:00
Valerio Setti
805e4a0378
pkparse: use ecp_read_key() for parsing private key of Montgomery curves
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-07-11 11:28:22 +02:00
Gilles Peskine
6aca2c9613
Merge pull request #7716 from mpg/psa-util-internal
...
Split psa_util.h between internal and public
2023-07-10 18:33:23 +02:00
Valerio Setti
da403b749e
tls: use already existing symbols to size the buffer for XXDḦ peer key
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-07-10 16:19:05 +02:00
Manuel Pégourié-Gonnard
5c41ae867b
Merge pull request #7887 from ronald-cron-arm/fix-hrr-in-psk-kem
...
tls13: server: Fix spurious HRR
2023-07-10 09:58:13 +02:00
Valerio Setti
54e23792c8
tls: replace numeric values with proper TLS IANA symbols
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-07-10 09:13:57 +02:00
Valerio Setti
6f0441d11e
tls: replace occurencies of ECP_LIGHT with PK_HAVE_ECC_KEYS
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-07-10 09:13:57 +02:00
Valerio Setti
acd32c005f
programs: add helper functions for supported EC curves
...
- get full list, or
- get TLS ID from name
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-07-10 09:13:57 +02:00
Valerio Setti
49e6907b5b
tls: replace ECP_LIGHT occurrencies with PK_HAVE_ECC_KEYS
...
Up to this point "make test" runs successfully. "ssl-opt" has
not been tested yet.
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-07-10 09:10:20 +02:00
Valerio Setti
6eb005435c
tls: fix guards for legacy ECDH contexts
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-07-07 19:02:23 +02:00
Valerio Setti
3d237b5ff1
ssl_misc: fix guards for PSA data used in XXDH key exchanges
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-07-07 19:02:16 +02:00
Paul Elliott
2dfe7993af
Merge pull request #6914 from davidhorstmann-arm/cmake-pass-through-config-defines
...
Pass `MBEDTLS_CONFIG_FILE` defines through cmake
2023-07-07 17:01:57 +01:00
Tom Cosgrove
c5f41bfeb8
Merge pull request #7212 from sergio-nsk/patch-4
...
Fix error: comparison of integers of different signs: 'SOCKET' and 'int'
2023-07-07 16:45:55 +01:00
Valerio Setti
b302efc8d9
debug: replace ECDH_C symbol with key exchange one
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-07-07 17:23:53 +02:00
Valerio Setti
c2232eadfb
tls: replace PK_CAN_ECDH guards with new helpers
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-07-07 17:23:53 +02:00
Valerio Setti
7aeec54094
tls: replace ECDH_C guards with new helpers
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-07-07 17:23:53 +02:00
Dave Rodgman
602a0919f3
Merge pull request #7464 from yuhaoth/pr/Change-clock-source-to-bootime-for-ms-time
...
Replace CLOCK_MONOTONIC with CLOCK_BOOTTIME for `mbedtls_ms_time` on linux
2023-07-07 15:42:17 +01:00
Manuel Pégourié-Gonnard
461d59b2f8
Merge pull request #7858 from mprse/ffdh_tls13_v2_f
...
Make use of FFDH keys in TLS 1.3 - follow-up
2023-07-07 16:19:35 +02:00
Ronald Cron
8a74f07c2a
tls13: server: Fix spurious HRR
...
If the server during a TLS 1.3 handshake selects
the PSK key exchange mode, it does not matter
if it did not find in the key share extension
a key share for a group it supports. Such a
key share is used and necessary only in the
case of the ephemeral or PSK ephemeral key
exchange mode. This is a possible scenario in
the case of a server that supports only the PSK
key exchange mode and a client that also
supports a key exchange mode with ephemeral keys.
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2023-07-07 15:53:12 +02:00
Andrzej Kurek
c508dc29f6
Unify csr and crt san writing functions
...
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2023-07-07 09:05:30 -04:00
Gabor Mezei
f05ca737da
Update comment
...
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2023-07-07 12:59:22 +02:00
Andrzej Kurek
1c8ecbef64
Add support for x509 SAN RCF822 and DirectoryName for csr generation
...
Unify the code with the x509 crt counterpart.
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2023-07-07 05:12:52 -04:00
Manuel Pégourié-Gonnard
9967f11066
Merge pull request #7810 from valeriosetti/issue7771
...
Define PSA_WANT_xxx_KEY_PAIR_yyy step 2/ECC
2023-07-07 10:22:47 +02:00
Przemek Stekiel
46b2d2b643
Fix code style
...
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com>
2023-07-07 09:34:17 +02:00
Agathiyan Bragadeesh
77b0d645f5
Add gitignore anchors to denote generated files
...
These anchors encapsulate gitignore patterns which typically ignore
files generated, so that scripts can be used to comment and uncomment
these patterns for releases when we need the generated files in the
repository.
Signed-off-by: Agathiyan Bragadeesh <agabra02@e127300.arm.com>
2023-07-06 17:58:18 +01:00
Manuel Pégourié-Gonnard
d55d66f5ec
Fix missing includes
...
Some files relied on psa_util.h to provide the includes they need.
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2023-07-06 12:47:28 +02:00
Manuel Pégourié-Gonnard
abfe640864
Rationalize includes in psa_util
...
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2023-07-06 12:47:27 +02:00
Manuel Pégourié-Gonnard
b7e8939198
Move error functions to internal header
...
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2023-07-06 12:47:26 +02:00
Manuel Pégourié-Gonnard
a5a8f29d7e
Move ECC and FFDH macros to internal header
...
ECC macros used in the following files:
library/pk.c
library/pk_wrap.c
library/pkparse.c
library/pkwrite.c
library/ssl_misc.h
library/ssl_tls12_client.c
FFDH macro use only in library/ssl_misc.h so could possibly be moved
there, but it seems cleaner to keep it close to the ECC macros are they
are very similar in nature.
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2023-07-06 12:45:54 +02:00
Manuel Pégourié-Gonnard
5c731b0afb
Use consistent guards for deprecated feature
...
Fixes an "unused static function" warning in builds with
DEPRECATED_REMOVED.
While at it, remove an include that's now useless.
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2023-07-06 12:42:33 +02:00
Manuel Pégourié-Gonnard
57fa72fdf8
Remove unused function in cipher.c
...
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2023-07-06 12:42:33 +02:00
Manuel Pégourié-Gonnard
efcc1f21c8
Make cipher functions static in cipher.c
...
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2023-07-06 12:42:33 +02:00
Manuel Pégourié-Gonnard
2be8c63af7
Create psa_util_internal.h
...
Most functions in psa_util.h are going to end up there (except those
that can be static in one file), but I wanted to have separate commits
for file creation and moving code around, so for now the new file's
pretty empty but that will change in the next few commits.
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2023-07-06 12:42:33 +02:00
Przemek Stekiel
408569f91a
Adapt function name: mbedtls_ssl_tls13_generate_and_write_dh_key_exchange
...
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com>
2023-07-06 12:16:44 +02:00
Przemek Stekiel
615cbcdbdf
Provide additional comments for claryfication
...
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com>
2023-07-06 12:16:39 +02:00
Yanray Wang
5adfdbdaed
AES: fix mismatch comment in #endif
...
Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-07-06 17:10:44 +08:00
Gabor Mezei
c97a407dba
Remove value assignment for enum entries
...
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2023-07-06 10:54:41 +02:00
Gabor Mezei
2a7bcaf8af
Use only MBEDTLS_ECP_WITH_MPI_UINT
to switch between the ecp variants
...
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2023-07-06 10:37:51 +02:00
Tom Cosgrove
836aed7cf8
Merge pull request #6003 from gstrauss/x509_time
...
mbedtls_x509_time performance and reduce memory use
2023-07-06 09:28:14 +01:00
Dave Rodgman
852b6c30b7
Support MBEDTLS_MD_SHA3_xxx_VIA_PSA
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-07-05 19:47:08 +01:00
Dave Rodgman
3a498a6ccb
Add SHA-3 cases in mbedtls_md_type_from_psa_alg, mbedtls_md_psa_alg_from_type
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-07-05 18:58:04 +01:00
Dave Rodgman
527f48f14d
Add OID definitions for SHA3
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-07-05 18:57:30 +01:00
Dave Rodgman
3d0c8255aa
Merge pull request #7825 from daverodgman/cipher_wrap_size
...
Cipher wrap size improvement
2023-07-05 15:45:48 +01:00
Gabor Mezei
1a729dcece
Fix comment
...
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2023-07-05 16:13:46 +02:00
Gabor Mezei
d6789f1e2e
Used preferred macro definition check
...
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2023-07-05 16:13:45 +02:00
David Horstmann
0f1dd57214
Use emptiness-checks rather than DEFINED checks
...
For the MBEDTLS_CONFIG_FILE and MBEDTLS_USER_CONFIG_FILE variables,
check that they are non-empty and defined. This means they can be
unconditionally created in the cache, simplifying the CMakeLists.txt
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-07-05 14:12:13 +01:00
David Horstmann
ae33ab85a5
Pass config file options to mbedtls_test(_helpers)
...
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-07-05 14:11:51 +01:00
David Horstmann
82f11ff6ac
Pass MBEDTLS_CONFIG_FILE defines through cmake
...
When -DMBEDTLS_CONFIG_FILE or -DMBEDTLS_USER_CONFIG_FILE are passed to
cmake, pass them through as compile definitions. This allows different
mbedtls configs to be passed at configure time without modifying any
cmake files.
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-07-05 14:09:58 +01:00
David Horstmann
3ae1c4c0f7
Fix formatting of explanatory commented code
...
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-07-05 11:15:08 +01:00
David Horstmann
b1d27bcd69
Improve comment formatting
...
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-07-05 10:00:31 +01:00
David Horstmann
cdf5283dad
Rename variables to more descriptive names
...
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-07-05 09:58:03 +01:00
Przemek Stekiel
e80bbf4dbf
Fix function name after rebase
...
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com>
2023-07-05 10:34:40 +02:00
Manuel Pégourié-Gonnard
db084d16ea
Merge pull request #7862 from ronald-cron-arm/improve-write-supported-group-ext
...
Improve write supported group ext
2023-07-05 09:55:33 +02:00
Przemek Stekiel
7ac93bea8c
Adapt names: dh -> xxdh
...
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com>
2023-07-05 09:26:26 +02:00
Przemek Stekiel
d5f79e7297
Adapt functions names for ffdh
...
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com>
2023-07-05 09:26:26 +02:00
Przemek Stekiel
6f199859b6
Adapt handshake fields to ffdh
...
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com>
2023-07-05 09:25:00 +02:00
Przemek Stekiel
e03ddbb497
Use valid size of peerkey buffer (EC vs FF)
...
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com>
2023-07-05 09:25:00 +02:00
Beniamin Sandu
aa4f621901
aesce: use correct target attribute when building with clang
...
Seems clang has its own issues when it comes to crypto extensions,
and right now the best way to avoid them is to accurately enable
the needed instructions instead of the broad crypto feature.
E.g.: https://github.com/llvm/llvm-project/issues/61645
Signed-off-by: Beniamin Sandu <beniaminsandu@gmail.com>
2023-07-04 21:15:52 +03:00
Dave Rodgman
c8d81ad54d
Merge pull request #7784 from daverodgman/aesce-unroll
2023-07-04 18:41:13 +01:00
Tom Cosgrove
e939464eb7
Merge pull request #7829 from mpg/deduplicate-tls-hashing
...
De-duplicate TLS hashing functions
2023-07-04 16:06:00 +01:00
Tom Cosgrove
b7af7eac05
Merge pull request #7834 from beni-sandu/development
...
aesce: do not specify an arch version when enabling crypto instructions
2023-07-04 13:32:04 +01:00
Ronald Cron
1ffa450882
tls: client: Improve writing of supported_groups ext
...
Align the TLS 1.3 specific and TLS 1.2 specific
tests done before to call
ssl_write_supported_groups_ext() and inside
thsi function.
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2023-07-04 12:16:25 +02:00
Kusumit Ghoderao
3fde8feaa9
FIx name of macro
...
Signed-off-by: Kusumit Ghoderao <Kusumit.Ghoderao@silabs.com>
2023-07-04 15:17:02 +05:30
Kusumit Ghoderao
4536bb6f2b
Change mac_size parameter in driver_mac_compute to output length
...
See #7801 for reference
Signed-off-by: Kusumit Ghoderao <Kusumit.Ghoderao@silabs.com>
2023-07-04 15:17:01 +05:30
Kusumit Ghoderao
a2520a5b7e
Add pbkdf2 cmac to key derivation output_bytes
...
Signed-off-by: Kusumit Ghoderao <Kusumit.Ghoderao@silabs.com>
2023-07-04 15:17:00 +05:30
Kusumit Ghoderao
3d5edb8eef
Add input password function for pbkdf2 cmac
...
Signed-off-by: Kusumit Ghoderao <Kusumit.Ghoderao@silabs.com>
2023-07-04 15:17:00 +05:30
Kusumit Ghoderao
2cd649684a
Add pbkdf2_cmac to key derivation setup
...
Signed-off-by: Kusumit Ghoderao <Kusumit.Ghoderao@silabs.com>
2023-07-04 15:17:00 +05:30
Kusumit Ghoderao
3ab146f99e
Add builtin pbkdf2 cmac guard for all the pbkdf2 functions
...
Signed-off-by: Kusumit Ghoderao <Kusumit.Ghoderao@silabs.com>
2023-07-04 15:16:59 +05:30
Manuel Pégourié-Gonnard
aaad2b6bfc
Rename some local variables
...
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2023-07-04 11:35:16 +02:00
Manuel Pégourié-Gonnard
443589ac53
Merge pull request #7870 from valeriosetti/fix-tls13-guards
...
tls13: fix guards for PSA error translating function
2023-07-04 11:21:14 +02:00
Tom Cosgrove
9b20c6fcc1
Merge pull request #7840 from yanrayw/7381_aes_gen_table
...
AES: use uint8_t for array of pow and log to save RAM usage
2023-07-04 08:34:12 +01:00
Valerio Setti
dbd01cb677
tls13: fix guards for PSA error translating function
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-07-04 09:18:52 +02:00
Dave Rodgman
9cf17dad9d
Merge pull request #7851 from daverodgman/fix-unused-aes
...
Fix AES dependencies - build TF-M config cleanly
2023-07-03 16:49:00 +01:00
Manuel Pégourié-Gonnard
56b159a12a
Merge pull request #7627 from mprse/ffdh_tls13_v2
...
Make use of FFDH keys in TLS 1.3 v.2
2023-07-03 10:12:33 +02:00