Commit graph

47 commits

Author SHA1 Message Date
Gilles Peskine
ca1e605b9c Merge remote-tracking branch 'upstream-public/development' into development-restricted-merge-20230925
Conflicts:
* `include/mbedtls/build_info.h`: a new fragment to auto-enable
  `MBEDTLS_CIPHER_PADDING_PKCS7` was added in
  c9f4040f7f in `development-restricted`.
  In `development`, this section of the file has moved to
  `include/mbedtls/config_adjust_legacy_crypto.h`.
* `library/bignum.c`: function name change in `development-restricted` vs
  comment change in development. The comment change in `development` is not
  really relevant, so just take the line from `development-restricted`.
2023-09-25 16:16:26 +02:00
Dave Rodgman
c0633bc777 Add comment
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-09-22 10:54:43 +01:00
Dave Rodgman
fbe74a9e51 Add mbedtls_ct_error_if, with tests
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-09-22 09:58:25 +01:00
Dave Rodgman
a9d70125a3 Remove mbedtls_ct_int_if
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-09-21 21:53:54 +01:00
Dave Rodgman
530c3da698 Improve implementation of mbedtls_ct_int_if
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-09-21 21:06:48 +01:00
Dave Rodgman
f81b2a14f2 Generalise mbedtls_ct_error_if to mbedtls_ct_int_if
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-09-21 19:22:43 +01:00
Dave Rodgman
e50b537266 Add mbedtls_ct_error_if
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-09-21 11:29:58 +01:00
Dave Rodgman
143f5f7c68 Add mbedtls_ct_bool_if and mbedtls_ct_bool_if_else_0
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-09-19 21:52:13 +01:00
Dave Rodgman
1cfc43c77b Rename mbedtls_ct_bool_xor to mbedtls_ct_bool_ne
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-09-19 18:39:33 +01:00
Dave Rodgman
3f8e483eed Mark y as modified in x86 asm for mbedtls_ct_uint_lt
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-09-08 17:57:40 +01:00
Dave Rodgman
4a97e73661 Eliminate a redundant not from x86 asm
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-09-08 17:26:18 +01:00
Dave Rodgman
b6b8f6c68d Make variable name consistent in x86_64 asm
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-09-08 17:19:32 +01:00
Dave Rodgman
5f249852a5 Better register allocation for x86_64 asm
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-09-08 17:18:29 +01:00
Dave Rodgman
99f0cdc0e0 Remove not-needed mov in x86_64 asm
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-09-08 17:18:04 +01:00
Dave Rodgman
d44dd96132 Improve docs re duplicate declarations
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-08-29 09:42:14 +01:00
Dave Rodgman
0cf9dd1056 Whitespace - tidy up asm and make it more consistent
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-08-29 09:42:14 +01:00
Dave Rodgman
81673bba77 Add x86 const-time assembly
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-08-29 09:42:14 +01:00
Dave Rodgman
664fea481c Add x86-64 const-time assembly
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-08-29 09:42:14 +01:00
Dave Rodgman
d395590597
Merge pull request #7579 from daverodgman/safer-ct-asm
Arm assembly implementation of constant time primitives
2023-08-28 08:26:29 +00:00
Dave Rodgman
e20d688463
Fix missing operand modifier
Co-authored-by: Yanray Wang <yanray.wang@arm.com>
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-08-22 08:46:18 +01:00
Dave Rodgman
0c99a9083e Avoid signed right shift UB
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-08-21 17:06:24 +01:00
Dave Rodgman
0ce0fbc32a Simplify aarch64 asm for mbedtls_ct_uint_lt
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-08-21 07:58:50 +01:00
Dave Rodgman
3ab114e3da Move non-function-specific macro outside of function definition
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-08-21 07:54:11 +01:00
Agathiyan Bragadeesh
9ebfa7f64c Fix style
Signed-off-by: Agathiyan Bragadeesh <agathiyan.bragadeesh2@arm.com>
2023-08-17 10:00:45 +01:00
Agathiyan Bragadeesh
285f85f962 Remove unnecessary const type qualifiers in casts
Signed-off-by: Agathiyan Bragadeesh <agathiyan.bragadeesh2@arm.com>
2023-08-16 17:15:48 +01:00
Dave Rodgman
246210e3c4 Test CT asm under valgrind
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-08-11 08:47:38 +01:00
Dave Rodgman
822c9c7d4e Fix unified asm syntax issue
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-08-11 08:47:38 +01:00
Dave Rodgman
ef2527901e Add aarch32 const-time asm
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-08-11 08:47:38 +01:00
Dave Rodgman
c9ed5dee69 Add aarch64 const-time asm
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-08-11 08:47:38 +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
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
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
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
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
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
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
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
2894d007d3 Strengthen fall-back for mbedtls_ct_compiler_opaque
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-08 18:07:39 +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
fe76af20aa Improve use of compiler_opaque
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
1c4eaa121f Remove not-needed compiler_opaque in ct_if
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-05-26 12:42:48 +01:00
Dave Rodgman
74e18ebf77 Improve const-timeness of mbedtls_ct_bool_lt
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