Commit graph

79 commits

Author SHA1 Message Date
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
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
c8d81ad54d
Merge pull request #7784 from daverodgman/aesce-unroll 2023-07-04 18:41:13 +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
28e2ca51a9 Docs improvement
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-27 15:25:38 +01:00
Dave Rodgman
e6c9996d04 Work around updating pointers from ILP32
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-21 21:16:23 +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
9bb7e6f4ce Rename MBEDTLS_OPTIMIZE_ALWAYS
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-16 09:41:21 +01:00
Dave Rodgman
2dd15b3ab5 code style
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-15 20:27:53 +01:00
Dave Rodgman
03bb526c24 Add a non-NEON variant of mbedtls_xor
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-15 18:43:24 +01:00
Dave Rodgman
b055f75c3d Introduce MBEDTLS_OPTIMIZE_ALWAYS
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-15 18:42:59 +01:00
Dave Rodgman
7fdfd70b19 Introduce MBEDTLS_COMPILER_IS_GCC
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-15 18:42:25 +01:00
Andrzej Kurek
b22b9778c7 Move the ARRAY_LENGTH definition to common.h
Reuse it in the library and tests.
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2023-06-13 05:46:47 -04:00
Dave Rodgman
5c394ff203 Use a single fast-path in mbedtls_xor, gains around 1% in benchmarks
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-09 20:10:36 +01:00
Dave Rodgman
159dc099fd Code style
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-09 19:46:07 +01:00
Dave Rodgman
360e04f379 Fix AES-XTS perf regression
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-09 17:23:15 +01:00
Dave Rodgman
f32176c0e3 Remove unnecessary cast
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-09 16:25:49 +01:00
Dave Rodgman
2070c2074e Avoid possible NEON alignment issue
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-07 16:38:26 +01:00
Dave Rodgman
3f47b3f7a3 Extend NEON use to 32-bit Arm
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-06-07 16:38:26 +01:00
Dave Rodgman
7613b3d6b8 Fix xor fail for large block size
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-05-23 08:16:01 +01:00
Dave Rodgman
6f40f8bf01 Add NEON to mbedtls_xor
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-05-22 18:22:07 +01:00
Dave Rodgman
0805ad10b2 XOR perf improvements
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-05-19 11:48:10 +01:00
Tom Cosgrove
57f04b81a0 Have MBEDTLS_STATIC_ASSERT() match current development more closely
Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com>
2023-03-14 12:03:47 +00:00
Tom Cosgrove
6ef9bb3d74 Implement and use MBEDTLS_STATIC_ASSERT()
Fixes #3693

Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com>
2023-03-08 14:19:51 +00:00
Dave Rodgman
fa96026a0e Move definition of asm out of public header
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
Gilles Peskine
449bd8303e Switch to the new code style
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-01-11 14:50:10 +01:00
Dave Rodgman
a616afeae4 Remove redundant inline workarounds
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2022-11-25 17:11:45 +00:00
Dave Rodgman
5a1d00f03d Merge remote-tracking branch 'origin/development' into fast_xor
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2022-11-25 17:10:25 +00:00
Gilles Peskine
7d23778178 Explain why p + n isn't good enough
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2022-11-25 13:34:59 +01:00
Dave Rodgman
7a910a8be0 Minor formatting tweaks
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2022-11-24 21:17:40 +00:00
Dave Rodgman
c58858865b Fix off-by-one error
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2022-11-24 20:35:04 +00:00
Dave Rodgman
4b910c1ed1 Fix whitespace
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2022-11-24 19:44:52 +00:00
Dave Rodgman
96d61d14d8 Use memcpy for unaligned accesses
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2022-11-24 19:33:22 +00:00
Dave Rodgman
fbc23225d6 Tidy up alignment-related code into separate header
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2022-11-24 18:07:37 +00:00
Dave Rodgman
358c7d6eb0 Fix naming inconsistency
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2022-11-23 20:29:03 +00:00
Dave Rodgman
dd3103e9e7 Tidy up UNALIGNED_UINT32_T macro
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2022-11-23 19:42:13 +00:00
Dave Rodgman
e7cd137606 Define UNALIGNED_UINT32_PTR for unaligned access
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2022-11-23 19:14:26 +00:00
Dave Rodgman
a6778013b4 Tidy up UBSan detection
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2022-11-23 17:17:30 +00:00
Dave Rodgman
468df317bf Fix MSVC support for inline keyword
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2022-11-23 16:56:35 +00:00
Dave Rodgman
1bab27f983 Prevent unaligned access under ASan builds
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2022-11-23 16:51:59 +00:00
Dave Rodgman
3c8eb7e990 Provide external definition of mbedtls_xor
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2022-11-23 14:50:03 +00:00
Dave Rodgman
63d114305f Whitespace cleanup
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2022-11-23 14:03:30 +00:00
Dave Rodgman
f9a1c37bc8 Whitespace cleanup
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2022-11-23 14:02:00 +00:00
Gilles Peskine
42649d9270 Fix NULL+0 undefined behavior in ECB encryption and decryption
psa_cipher_encrypt() and psa_cipher_decrypt() sometimes add a zero offset to
a null pointer when the cipher does not use an IV. This is undefined
behavior, although it works as naively expected on most platforms. This
can cause a crash with modern Clang+ASan (depending on compiler optimizations).

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2022-11-23 14:16:52 +01:00
Dave Rodgman
fdd967ebdc Detect support for unaligned memory access
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2022-11-22 18:55:17 +00:00
Dave Rodgman
c3d8041fe7 Introduce mbedtls_xor
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2022-11-22 15:01:39 +00:00
Jerry Yu
29287a46d2 fix wrong para name in doxygen comments
Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
2021-10-28 10:26:13 +08:00
Jerry Yu
f3f5c210cb fix comments issue
Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
2021-10-27 17:05:49 +08:00