17518 Commits

Author SHA1 Message Date
hanno-becker
75ab076971 Fix X.509 SAN parsing
Fixes #2838. See the issue description for more information.
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2023-02-08 08:46:42 -05:00
Gilles Peskine
bfe79030a9
Merge pull request #7021 from lpy4105/issue/backport-do-not-run-x86-tests-on-arm64
Backport 2.28: all.sh: test_m32_xx is not supported on arm64 host
2023-02-07 10:26:16 +01:00
Gilles Peskine
d6bb16a5b8
Merge pull request #6976 from davidhorstmann-arm/2.28-c-build-helper-improvements
[Backport 2.28] Minor improvements to `c_build_helper.py`
2023-02-07 10:26:03 +01:00
Jan Bruckner
6d47550723 Fix typos
Signed-off-by: Jan Bruckner <jan@janbruckner.de>
2023-02-07 07:27:49 +01:00
Manuel Pégourié-Gonnard
54faadce7a Fix style in test_suite_md.function
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2023-02-06 13:15:56 +01:00
Manuel Pégourié-Gonnard
67565d0f22 Use TEST_EQUAL when applicable in test_suite_md
Backporting note: contextual differences because we don't have
info_from_ctx in 2.28.

Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2023-02-06 13:15:29 +01:00
Manuel Pégourié-Gonnard
96108b611a Avoid unnecessary copy in test_suite_md
Also avoids buffer with an arbitrary size while at it.

Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2023-02-06 13:13:44 +01:00
Manuel Pégourié-Gonnard
2a5e213f2d Use MBEDTLS_MD_MAX_SIZE in test_suite_md
Not only was the size of 100 arbitrary, it's also not great for testing:
using MBEDTLS_MD_MAX_SIZE will get us an ASan error if it ever is too
small.

Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2023-02-06 13:13:44 +01:00
Manuel Pégourié-Gonnard
a876bd2a8a Use MD type not string to in MD test data
For all test that want to use a hash, identify it by its numerical type
rather than a string. The motivation is that when we isolate the
MD-light subset from the larger MD, it won't have support for string
identifiers. Do the change for all tests, not just those that will
exercise functions in MD-light, for the sake of uniformity and because
numerical identifiers just feel better.

Note: mbedtls_md_info_from_string is still tested in md_info().

Note: for 2.28 the motivation of upcoming work on MD-light doesn't
apply, but the change is still backported in order keep the two branches
closer to each other (especially the .function file).

Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2023-02-06 13:12:51 +01:00
Dave Rodgman
b028531a3b
Merge pull request #7013 from gilles-peskine-arm/build-without-certs-2.28.2
2.28 only: Fix the build without MBEDTLS_CERTS_C
2023-02-06 11:39:01 +00:00
Dave Rodgman
9f63cb72d3
Merge pull request #7026 from aditya-deshpande-arm/backport-fix-example-programs-usage
[Backport 2.28] Fix incorrect dispatch to USAGE in example programs, which causes uninitialized memory to be used
2023-02-06 09:53:57 +00:00
Aditya Deshpande
56d90038fd Fix more argc checks
Signed-off-by: Aditya Deshpande <aditya.deshpande@arm.com>
2023-02-05 15:47:45 +00:00
Gilles Peskine
c87dc5f015
Merge pull request #7023 from daverodgman/3DES-warning-2.28
Backport 2.28: Improve warnings for DES/3DES
2023-02-03 16:41:41 +01:00
Gilles Peskine
a4f91485a6
Merge pull request #6983 from aditya-deshpande-arm/backport-check-files-characters
[Backport 2.28] check_files.py: Allow specific Box Drawings characters to be used
2023-02-03 11:46:03 +01:00
Manuel Pégourié-Gonnard
fc9cb1359f
Merge pull request #7030 from daverodgman/sizeof-brackets-2.28
Backport 2.28 - Sizeof brackets
2023-02-03 10:29:48 +01:00
Dave Rodgman
ecb44208d1 Address missed instances of sizeof
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-02-02 15:34:23 +00:00
Dave Rodgman
b6c5d046c4 Additional warnings in cipher.h
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-02-02 13:42:38 +00:00
Dave Rodgman
4ff023147c Update warnings in cipher.h
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-02-02 13:25:39 +00:00
Dave Rodgman
1868870fba Fix use of sizeof without brackets
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-02-02 12:46:39 +00:00
Aditya Deshpande
e87ed421be Amend changelog entry
Signed-off-by: Aditya Deshpande <aditya.deshpande@arm.com>
2023-02-02 12:07:07 +00:00
Aditya Deshpande
a7d879185e Add changelog entry
Signed-off-by: Aditya Deshpande <aditya.deshpande@arm.com>
2023-02-02 12:07:06 +00:00
Aditya Deshpande
0504ac2387 Fix bugs in example programs: change argc == 0 to argc < 2
Signed-off-by: Aditya Deshpande <aditya.deshpande@arm.com>
2023-02-02 12:07:06 +00:00
Dave Rodgman
b43d5e7aa7 Improve warnings for DES/3DES
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-02-02 10:49:17 +00:00
Pengyu Lv
a89b36757c all.sh: test_m32_xx is not supported on arm64 host
test_m32_xxx tests are x86 specific, but the support
function only identifies a 64-bit system. So the tests
will be run on arm64 host and cause a test failure.
This change restricts those tests to amd64/x86_64
only.

Signed-off-by: Pengyu Lv <pengyu.lv@arm.com>
2023-02-02 17:28:10 +08:00
Gilles Peskine
50bc9750df Fix indentation
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-02-02 00:08:16 +01:00
Gilles Peskine
5619443bf1 Test without MBEDTLS_CERTS_C
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-02-01 18:47:58 +01:00
Gilles Peskine
33d03feb61 Add missing dependencies on certs.c in unit tests
The tests here use the test certificates from the cert module where
certificates are needed. Thus, wherever there is a dependency on
MBEDTLS_KEY_EXCHANGE_WITH_CERT_ENABLED, there is also a dependency on
MBEDTLS_CERTS_C.

Fixes `make test` when MBEDTLS_CERTS_C is disabled.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-02-01 18:47:58 +01:00
Gilles Peskine
90420aac5b Add missing dependencies on certs.c in fuzz programs
Fix `make programs` when MBEDTLS_CERTS_C is disabled.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-02-01 18:47:50 +01:00
Gilles Peskine
4d483a1814 Fix misplaced #endif in test program
This broke the build when MBEDTLS_CERTS_C is undefined. Fixes #6243.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-02-01 18:19:23 +01:00
David Horstmann
5e29196561 Fix near-tautological repetition in ChangeLog
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-02-01 13:41:34 +00:00
Aditya Deshpande
a9186f37a8 Allow whole Box Drawings range
Signed-off-by: Aditya Deshpande <aditya.deshpande@arm.com>
2023-02-01 13:31:57 +00:00
Gilles Peskine
45379cbe6b
Merge pull request #7001 from ucko/2023a-bignum-2.28
[Backport 2.28] mbedtls_mpi_sub_abs: Skip memcpy when redundant (#6701).
2023-02-01 11:36:28 +01:00
Aaron M. Ucko
78b823ab0e mbedtls_mpi_sub_abs: Skip memcpy when redundant (#6701).
In some contexts, the output pointer may equal the first input
pointer, in which case copying is not only superfluous but results in
"Source and destination overlap in memcpy" errors from Valgrind (as I
observed in the context of ecp_double_jac) and a diagnostic message
from TrustInSoft Analyzer (as Pascal Cuoq reported in the context of
other ECP functions called by cert-app with a suitable certificate).

Signed-off-by: Aaron M. Ucko <ucko@ncbi.nlm.nih.gov>
2023-01-31 15:45:44 -05:00
Gilles Peskine
9a10538f20
Merge pull request #6965 from davidhorstmann-arm/2.28-code-style-improvements
[Backport 2.28] Improvements to code style script
2023-01-31 21:22:59 +01:00
Aditya Deshpande
e76dc39641 Modify comments to make them more inclusive
Signed-off-by: Aditya Deshpande <aditya.deshpande@arm.com>
2023-01-30 13:52:03 +00:00
Aditya Deshpande
ed514d3218 Allow specific Box Drawing UTF characters that are used in Markdown trees in check_files.py
Signed-off-by: Aditya Deshpande <aditya.deshpande@arm.com>
2023-01-30 13:24:11 +00:00
Manuel Pégourié-Gonnard
4b7cb8c737
Merge pull request #6919 from valeriosetti/issue6843-backport
Backport: Improve X.509 cert writing serial number management
2023-01-30 13:09:09 +01:00
David Horstmann
e28f2ee685 Add docstring for new compile function.
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-01-30 09:52:01 +00:00
Manuel Pégourié-Gonnard
54be0fafc6
Merge pull request #6968 from aditya-deshpande-arm/backport-check-names-exclusions
[Backport 2.28] check_names.py: Compare identifiers in excluded files against symbols parsed by nm
2023-01-30 09:22:09 +01:00
David Horstmann
41fbc3ad3a Add ChangeLog for c_build_helper improvements
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-01-27 19:56:49 +00:00
David Horstmann
0b1b97badf Make c_build_helper module respect HOSTCC
If HOSTCC is set, use that to generate files, otherwise use CC. This
should make cross-compilation with generated files slightly easier.

Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-01-27 19:56:49 +00:00
David Horstmann
ddb09e4f17 c_build_helper.py: Move compile to helper
Move compilation to a separate helper function in c_build_helper.py to
allow more generic use.

Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-01-27 19:56:47 +00:00
Aditya Deshpande
7d20bb4740 Re-add empty lines that were accidentally omitted in the previous commit.
Signed-off-by: Aditya Deshpande <aditya.deshpande@arm.com>
2023-01-27 16:03:22 +00:00
Manuel Pégourié-Gonnard
27276fcb97
Merge pull request #6844 from gilles-peskine-arm/test_suite_psa_crypto_metadata-20221215-2.28
Backport 2.28: Add metadata tests for CCM* and TLS1.2-ECJPAKE-to-PMS
2023-01-27 10:05:04 +01:00
Gilles Peskine
f57f3db920
Merge pull request #6931 from AndrzejKurek/timeless-selftest-waz-bad
[2.28] Enable the timing.c selftest with MBEDTLS_TIMING_ALT
2023-01-26 21:55:44 +01:00
Gilles Peskine
0f16ce0116
Merge pull request #6963 from davidhorstmann-arm/2.28-fix-check-python-errors
[Backport 2.28] Fix check python errors
2023-01-26 21:54:30 +01:00
Gilles Peskine
c2738f22b3
Merge pull request #6954 from gilles-peskine-arm/6658-not-print-Terminated-ubuntu-22.04-2.28
Backport 2.28: Fix the problem of printing "Terminated" in compat.sh under Ubuntu-22.04
2023-01-26 21:53:28 +01:00
Valerio Setti
7ba0037468 test: improve error handling in x509_set_serial_check()
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-01-26 18:03:27 +01:00
Andrzej Kurek
26d383998d Be consistent with self-test naming
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2023-01-26 04:38:37 -05:00
Andrzej Kurek
3a261a4dfd Add a selftest run for the TIMING_ALT test
The fuzz programs require one layer of directories
more when adding include directories.
Also remove an unnecessary include directory in the Makefile.

Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2023-01-26 04:33:59 -05:00