18298 Commits

Author SHA1 Message Date
David Horstmann
f15b7b6300 Improve positioning of GENERATE_XML option
It is clearer to have this option next to the GENERATE_LATEX option.

Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-03-27 15:39:11 +01:00
David Horstmann
e760c797e0 Remove Exhale from requirements and regenerate
Regenerate the requirements.txt with Exhale removed and also with Python
3.9 instead of 3.8, for parity with Read The Docs.

Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-03-27 15:36:39 +01:00
Paul Elliott
981743de6f
Merge pull request #1009 from paul-elliott-arm/mbedtls-2.28.3rc0-pr
Mbedtls 2.28.3rc0 pr - DO NOT MERGE
2023-03-24 15:54:53 +00:00
Yanray Wang
d82879edc6 tests/.gitignore: ignore *.o under tests/src/test_helpers
Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-03-24 18:21:48 +08:00
Dave Rodgman
e4f1aac0fd Bump version to 2.28.3
Command used: ./scripts/bump_version.sh --version 2.28.3

Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-03-23 18:06:54 +00:00
Paul Elliott
2454a16fdd Update BRANCHES.md
Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2023-03-23 11:27:21 +00:00
Paul Elliott
f18db1f631 Assemble changelog for 2.28.3 release
Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2023-03-23 11:26:53 +00:00
Paul Elliott
0e4a4c570e Fix changelog formatting
Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2023-03-23 11:21:38 +00:00
Paul Elliott
f10eb92751 Rename misnamed changelog entries
Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2023-03-23 11:18:17 +00:00
Tom Cosgrove
9bf344fddd Add security entry to ChangeLog for AES-NI
Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com>
2023-03-23 11:14:27 +00:00
Yanray Wang
74df2012a2 ssl_helpers.c: add mbedtls_test_ssl prefix for *_exchange_data
Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-03-23 18:02:53 +08:00
Yanray Wang
d02c3175e6 ssl_helpers.c: add mbedtls_test prefix for mbedtls_mock_socket_init
Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-03-23 17:58:10 +08:00
Yanray Wang
c4abee2b9c ssl_helpers.c: change prefix and move *queue_peek_info to static
Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-03-23 17:57:02 +08:00
Yanray Wang
cd23affffa ssl_helpers.c: change prefix and move *certificate_free to static
Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-03-23 17:56:12 +08:00
Yanray Wang
b4ef9a21b5 ssl_helpers.c: move some internal functions to static
Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-03-23 17:54:55 +08:00
Yanray Wang
e62e8a1a6f ssl_helpers.c: move #define Directive to header file
Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-03-23 17:35:33 +08:00
Paul Elliott
a183e1d53d Merge branch 'mbedtls-2.28-restricted' into mbedtls-2.28.3rc0-pr
Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2023-03-21 15:34:35 +00:00
Paul Elliott
18573354f7
Merge pull request #7276 from yanrayw/2.28-6173-split-TLS-connection-func-into-ssl_helpers
Backport 2.28: Move TLS connection helper code from test_suite_ssl.function to ssl_helpers.c
2023-03-21 10:54:06 +00:00
Paul Elliott
fc28ffa4c8
Merge pull request #7320 from tom-cosgrove-arm/static-assert-2.28
Backport 2.28: Implement and use MBEDTLS_STATIC_ASSERT()
2023-03-20 22:55:32 +00:00
Dave Rodgman
61495ba7cf
Merge pull request #1003 from tom-cosgrove-arm/aesni-intrinsics-2.28
Backport 2.28: Implement AESNI with intrinsics
2023-03-20 18:20:47 +00:00
Tom Cosgrove
410594c002 Have MBEDTLS_STATIC_ASSERT() match current development more closely
Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com>
2023-03-20 15:10:11 +00:00
Tom Cosgrove
bdd01a74ef Implement and use MBEDTLS_STATIC_ASSERT()
Fixes #3693

Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com>
2023-03-20 15:08:21 +00:00
Tom Cosgrove
b5eb831803 Add tests for unaligned AES contexts
Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com>
2023-03-20 10:57:42 +00:00
Tom Cosgrove
640b761e49 Print out AESNI mechanism used by GCM in self-test
Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com>
2023-03-19 15:07:06 +00:00
Tom Cosgrove
2c942a35ff Fix code style nit
Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com>
2023-03-19 14:04:04 +00:00
Tom Cosgrove
9149e12767 Stop selftest hanging when run on CI
Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com>
2023-03-18 14:49:07 +00:00
Tom Cosgrove
20458c0963 Have selftest print more information about the AESNI build
Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com>
2023-03-18 14:48:49 +00:00
Tom Cosgrove
e0c75342fc Fix another backport issue: it's VS2010/ not VS2013/
Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com>
2023-03-18 13:54:26 +00:00
Tom Cosgrove
3b53caed9f Remove references to MBEDTLS_AESCE_C and MBEDTLS_HAVE_ARM64
that aren't needed in this backport

Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com>
2023-03-17 18:25:36 +00:00
Tom Cosgrove
779199faac Document that MBEDTLS_AESNI_HAVE_INTRINSICS and MBEDTLS_AESNI_HAVE_CODE are internal
macros, despite appearing in a public header file.

Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com>
2023-03-17 17:16:53 +00:00
Tom Cosgrove
58550acba0 Fix merge errors in backporting
Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com>
2023-03-17 16:54:59 +00:00
Gilles Peskine
9494a99c2f Fix preprocessor conditional
This was intended as an if-else-if chain. Make it so.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-03-17 16:36:05 +00:00
Gilles Peskine
3efd3149f8 Finish sentence in comment
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-03-17 16:35:54 +00:00
Gilles Peskine
9a8bf9f85d Announce the expanded AESNI support
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-03-17 16:32:03 +00:00
Gilles Peskine
e5038c666e Document the new state of AESNI support
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-03-17 16:32:01 +00:00
Gilles Peskine
6dec541e68 AESNI: Overhaul implementation selection
Have clearly separated code to:
* determine whether the assembly-based implementation is available;
* determine whether the intrinsics-based implementation is available;
* select one of the available implementations if any.

Now MBEDTLS_AESNI_HAVE_CODE can be the single interface for aes.c and
aesni.c to determine which AESNI is built.

Change the implementation selection: now, if both implementations are
available, always prefer assembly. Before, the intrinsics were used if
available. This preference is to minimize disruption, and will likely
be revised in a later minor release.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-03-17 16:31:59 +00:00
Gilles Peskine
b71d40228d Clean up AES context alignment code
Use a single auxiliary function to determine rk_offset, covering both
setkey_enc and setkey_dec, covering both AESNI and PADLOCK. For AESNI, only
build this when using the intrinsics-based implementation, since the
assembly implementation supports unaligned access.

Simplify "do we need to realign?" to "is the desired offset now equal to
the current offset?".

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-03-17 16:31:58 +00:00
Gilles Peskine
3ba81d3217 Remove the dependency of MBEDTLS_AESNI_C on MBEDTLS_HAVE_ASM
AESNI can now be implemented with intrinsics.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-03-17 16:31:55 +00:00
Gilles Peskine
30c356c540 Use consistent guards for padlock code
The padlock feature is enabled if
```
defined(MBEDTLS_PADLOCK_C) && defined(MBEDTLS_HAVE_X86)
```
with the second macro coming from `padlock.h`. The availability of the
macro `MBEDTLS_PADLOCK_ALIGN16` is coincidentally equivalent to
`MBEDTLS_HAVE_X86` but this is not meaningful.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-03-17 16:31:38 +00:00
Gilles Peskine
6978e73939 Fix unaligned access if the context is moved during operation
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-03-17 16:31:34 +00:00
Gilles Peskine
5f1677f582 Fix typo in comment
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-03-17 16:31:31 +00:00
Gilles Peskine
de34578353 Fix code style
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-03-17 16:31:28 +00:00
Gilles Peskine
563c492bf6 Travis: run selftest on Windows
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-03-17 16:31:26 +00:00
Gilles Peskine
2e8d8d1fd6 Fix MSVC portability
MSVC doesn't have _mm_storeu_si64. Fortunately it isn't really needed here.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-03-17 16:31:23 +00:00
Gilles Peskine
d4a239310b Improve variable names
To some extent anyway.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-03-17 16:31:21 +00:00
Tom Cosgrove
790756d439 Get aesni.c compiling with Visual Studio
Clang is nice enough to support bitwise operators on __m128i, but MSVC
isn't.

Also, __cpuid() in MSVC comes from <intrin.h> (which is included via
<emmintrin.h>), not <cpuid.h>.

Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com>
2023-03-17 16:31:18 +00:00
Gilles Peskine
e7dc21fabb AESNI: add implementation with intrinsics
As of this commit, to use the intrinsics for MBEDTLS_AESNI_C:

* With MSVC, this should be the default.
* With Clang, build with `clang -maes -mpclmul` or equivalent.
* With GCC, build with `gcc -mpclmul -msse2` or equivalent.

In particular, for now, with a GCC-like compiler, when building specifically
for a target that supports both the AES and GCM instructions, the old
implementation using assembly is selected.

This method for platform selection will likely be improved in the future.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-03-17 16:31:16 +00:00
Gilles Peskine
2c8ad9400b AES, GCM selftest: indicate which implementation is used
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-03-17 16:31:14 +00:00
Gilles Peskine
5511a34566 New preprocessor symbol indicating that AESNI support is present
The configuration symbol MBEDTLS_AESNI_C requests AESNI support, but it is
ignored if the platform doesn't have AESNI. This allows keeping
MBEDTLS_AESNI_C enabled (as it is in the default build) when building for
platforms other than x86_64, or when MBEDTLS_HAVE_ASM is disabled.

To facilitate maintenance, always use the symbol MBEDTLS_AESNI_HAVE_CODE to
answer the question "can I call mbedtls_aesni_xxx functions?", rather than
repeating the check `defined(MBEDTLS_AESNI_C) && ...`.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-03-17 16:31:12 +00:00
Gilles Peskine
2808a6047c Improve the presentation of assembly blocks
Uncrustify indents
```
    asm("foo"
        HELLO "bar"
              "wibble");
```
but we would like
```
    asm("foo"
        HELLO "bar"
        "wibble");
```
Make "bar" an argument of the macro HELLO, which makes the indentation from
uncrustify match the semantics (everything should be aligned to the same
column).

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-03-17 16:31:10 +00:00