Commit graph

26111 commits

Author SHA1 Message Date
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
Gowtham Suresh Kumar
a12baf8c5f Update test scripts to use latest/earliest compilers
The Ubuntu 16.04 and 22.04 docker images have been updated with
earliest and latest versions of gcc and clang respectively.
This patch adds the necessary component and support functions
required for the CI to run these compilers.

For FreeBSD we invoke the function by name so a condition is added
to disable the existing test_clang_opt function for linux.

Signed-off-by: Gowtham Suresh Kumar <gowtham.sureshkumar@arm.com>
2023-07-26 16:51:45 +01: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
Agathiyan Bragadeesh
eed55c6c94 Use defined macros for MBEDTLS_MPI_UINT_MAX
Signed-off-by: Agathiyan Bragadeesh <agathiyan.bragadeesh2@arm.com>
2023-07-19 11:08:02 +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
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
Gilles Peskine
24a305ec22 Explain why we check 65535 (not USHORT_MAX)
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-07-18 13:53:07 +02: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
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
Agathiyan Bragadeesh
197565062a Make consistent suffix MBEDTLS_MPI_UINT_MAX
Signed-off-by: Agathiyan Bragadeesh <agathiyan.bragadeesh2@arm.com>
2023-07-17 16:43:19 +01:00
Agathiyan Bragadeesh
900e20d3a2
Change MBEDTLS_MPI_UINT_MAX suffix
Co-authored-by: Gilles Peskine <gilles.peskine@arm.com>
Signed-off-by: Agathiyan Bragadeesh <48658345+AgathiyanB@users.noreply.github.com>
2023-07-17 16:27:21 +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
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
932126525a Move declarations to top in ssl_helpers.c
Signed-off-by: Agathiyan Bragadeesh <agathiyan.bragadeesh2@arm.com>
2023-07-17 12:21:06 +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
Gilles Peskine
b366fe955d
Merge pull request #7478 from yuhaoth/pr/add-script-for-generating-cert-macros
Add script for generating cert macros
2023-07-17 11:13:07 +02:00
Gilles Peskine
d8c4549246
Merge pull request #7432 from oberon-microsystems/fix-test-ecjpake-to-pms-dependency
Fix derive_ecjpake_to_pms dependency in PSA crypto test
2023-07-17 11:05:40 +02:00
Dave Rodgman
91d9daf2b3
Merge pull request #7925 from hasheddan/dtls-server-order
Fix order of steps in DTLS server example program
2023-07-17 09:41:43 +01:00
Daniel Mangum
af2f7a6fcb Fix order of steps in DTLS server example program
Fixes the numbered order of steps in the DTLS server example program.

Signed-off-by: Daniel Mangum <georgedanielmangum@gmail.com>
2023-07-14 12:00:33 -04: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
Agathiyan Bragadeesh
09a455e21a Add macros for mpi uint max sizes
Signed-off-by: Agathiyan Bragadeesh <agathiyan.bragadeesh2@arm.com>
2023-07-14 14:07:18 +01:00
Gabor Mezei
66bbecb7ff
Fix comment
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2023-07-14 14:43:27 +02:00
Gabor Mezei
f0021d495a
Update test function dependencies
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2023-07-14 14:43:27 +02:00
Gabor Mezei
92ce4c2cbf
Fix ecp variant check
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2023-07-14 14:43:22 +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
Dave Rodgman
15f350424b
Merge pull request #7507 from yuhaoth/pr/fix-armclang-without-cmd-target-flags-fail
Fix armclang without cmd target flags fail
2023-07-13 14:40:41 +01: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
8bfa24b021 Update compiler versions requirement
For time being, we haven't verified MSVC
for sha256 and 512. So we do not add msvc
information.

Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
2023-07-13 10:40:29 +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
c37e260dc5 Add armclang version requirement for sha512
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