TTornblom
e4f6d79bbe
BUILD: Update For IAR support
...
Applied the same change as in mbed-crypto for using this as a sub
project with the IAR toolchain. Use __asm generic ,and avoid empty
enum. Avoid declaration of array with null size. This is a porting
of the original patch contributed to trusted-firmware-m.
Signed-off-by: TTornblom <thomas.tornblom@iar.com>
Signed-off-by: Michel Jaouen <michel.jaouen@st.com>
Signed-off-by: Antonio de Angelis <antonio.deangelis@arm.com>
2023-08-16 12:36:21 +01:00
David Horstmann
ba44e918b8
Remove unnecessary include from constant_time.c
...
This was added in order to use TEST_CF_XYZ macros which have since been
removed.
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-08-15 15:17:22 +01:00
Dave Rodgman
98ddc01a7c
Rename ...if0 to ...else_0
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-08-10 12:11:31 +01:00
Dave Rodgman
b7825ceb3e
Rename uint->bool operators to reflect input types
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-08-10 11:58:18 +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
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
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
d684d7342b
code style
...
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
Dave Rodgman
9fbb0cf08e
Merge remote-tracking branch 'origin/development' into safer-ct5
2023-06-28 18:52:02 +01:00
Tom Cosgrove
db041cc82f
Merge pull request #7665 from AndrzejKurek/optimize-error-translation-code-size
...
Optimize error translation code size
2023-06-28 08:09:00 +01:00
Dave Rodgman
5b5dd011d1
code style
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-21 16:36:47 +01:00
Dave Rodgman
b5b6939fc2
Remove redundant checks in constant_time.c
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-21 16:36:42 +01:00
Dave Rodgman
0400ae2f9b
Fix pointer constraint in bn_mul.h
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-21 16:31:52 +01:00
Dave Rodgman
c54f25e26c
code style
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-21 13:39:30 +01:00
Dave Rodgman
63e89b46f8
Use UINTPTR_MAX not SIZE_MAX
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-21 11:58:54 +01:00
Dave Rodgman
85842b8edb
Be strict about pointer size in mbedtls_get_unaligned_volatile_uint32
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-21 11:22:09 +01:00
Dave Rodgman
b67db9140e
Separate ILP32 and normal-aarch64 code paths
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-21 09:15:27 +01:00
Dave Rodgman
04cb9ac59e
Fix for arm64_32 (aka ILP32) on Clang (attempt 2)
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-21 07:32:22 +01:00
Dave Rodgman
b19f584f2c
Fix for arm64_32 (aka ILP32) on Clang
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-20 23:01:43 +01:00
Andrzej Kurek
1e4a030b00
Fix wrong array size calculation in error translation code
...
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2023-06-13 05:46:47 -04:00
Andrzej Kurek
1c7a99856f
Add missing ifdefs
...
Make sure that the error translating functions
are only defined when they're used.
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2023-06-13 05:46:47 -04:00
Andrzej Kurek
0064484a70
Optimize error translation code size
...
Introducing an intermediate function
saves code size that's otherwise taken by excessive,
repeated arguments in each place that
was translating errors.
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2023-06-13 05:46:46 -04:00
Dave Rodgman
1ab0b48ac3
Code style
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-12 18:22:18 +01:00
Dave Rodgman
58c80f4d92
Make mbedtls_ct_zero non-static
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-12 18:19:46 +01:00
Dave Rodgman
1947088f91
Remove references to rsa.h and ssl_misc.h from constant_time.c
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-05-26 12:42:48 +01:00
Dave Rodgman
585f7f776d
Whitespace etc
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-05-26 12:42:48 +01:00
Dave Rodgman
8f5e5c18d8
Make memmove_left more efficient
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-05-26 12:42:48 +01:00
Dave Rodgman
2b4486a014
Rename mbedtls_ct_uint_if_new to mbedtls_ct_uint_if
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-05-26 12:42:48 +01:00
Dave Rodgman
2243137715
Remove old interface
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-05-26 12:42:48 +01:00
Dave Rodgman
199a2c5d39
Use new CT interface in mbedtls_ct_memcpy_offset
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-05-26 12:42:48 +01:00
Dave Rodgman
231a516682
Remove not-needed mbedtls_ct_mpi_uint_cond_assign
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-05-26 12:42:48 +01:00
Dave Rodgman
7fe6e6fb2b
Add impl of mbedtls_ct_memcpy_if
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-05-26 12:42:48 +01:00
Dave Rodgman
15c142b58d
Use new interface in mbedtls_ct_memmove_left
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-05-26 12:42:48 +01:00
Dave Rodgman
6cee26db16
Remove old interface for mem_move_to_left
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-05-26 12:42:48 +01:00
Dave Rodgman
debf8679e0
Add impl of mbedtls_ct_zeroize_if
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-05-26 12:42:48 +01:00
Dave Rodgman
40a41d0461
Introduce new CT interface (retain old interface)
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-05-26 12:42:48 +01:00
Dave Rodgman
7d4f019810
Move some bignum functions out of constant_time module
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-05-26 12:42:48 +01:00
Dave Rodgman
19e8cd06fe
Move mbedtls_ct_rsaes_pkcs1_v15_unpadding into rsa.c
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-05-26 12:42:48 +01:00
Dave Rodgman
0afe001871
Expose mbedtls_ct_size_gt and mbedtls_ct_mem_move_to_left in ct interface
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-05-26 12:42:48 +01:00
Dave Rodgman
2801f7fa8d
Move mbedtls_ct_hmac into ssl_msg.c
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-05-26 12:42:48 +01:00
Dave Rodgman
0ee9683987
Move mbedtls_ct_base64_(enc|dec)_char into base64.c
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-05-26 12:42:40 +01:00
Tom Cosgrove
e22413c8df
Use mbedtls_ct_uint_if() rather than mbedtls_ct_cond_select_sign()
...
Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com>
2023-05-03 09:44:01 +01:00
Andrzej Kurek
8a045ce5e6
Unify PSA to Mbed TLS error translation
...
Move all error translation utilities to psa_util.c.
Introduce macros and functions to avoid having
a local copy of the error translating function in
each place.
Identify overlapping errors and introduce a
generic function.
Provide a single macro for all error translations
(unless one file needs a couple of different ones).
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2023-03-03 05:23:44 -05:00
Dave Rodgman
4610d4b7a6
Inhibit compiler from optimising out const-time asm
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-01-30 09:26:48 +00:00
Dave Rodgman
7658b63390
Remove volatile from diff; add explanatory comment
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-01-20 14:04:48 +00:00
Dave Rodgman
b9cd19bc8c
Prevent perf regressions in mbedtls_xor
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-01-20 14:04:48 +00:00
Dave Rodgman
051225d07a
Address potential perf regression
...
Ensure platforms that don't have an assembly implementation for
mbedtls_get_unaligned_volatile_uint32() don't experience a performance
regression.
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-01-20 14:04:48 +00:00
Dave Rodgman
36dfc5a237
Improve efficiency of some constant time functions
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-01-20 14:04:48 +00:00