Gilles Peskine
bfda1a96bb
MBEDTLS_PSA_INJECT_ENTROPY: Skip incompatible tests
...
When MBEDTLS_PSA_INJECT_ENTROPY is enabled, we disable standard entropy
sources, so mbedtls_entropy_func() doesn't work out of the box. Disable
tests that rely on it. MBEDTLS_PSA_INJECT_ENTROPY is intended for PSA-only
environments anyway, so it doesn't matter if some legacy features don't work
normally.
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-07-20 18:10:26 +02:00
Gilles Peskine
4f8bf3cc54
MBEDTLS_PSA_INJECT_ENTROPY: Make sure the seed file exist when running tests
...
The seed file must exist before running tests. Because the location is
somewhat platform- and configuration-dependent, and to be friendly to
developers who run test suites individually and aren't familiar with this
feature, rely on the test framework code rather than on test scripts to
create the seed file.
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-07-20 18:09:02 +02:00
Gilles Peskine
73521b0715
Tests: provide necessary functions for MBEDTLS_PSA_INJECT_ENTROPY
...
The build option MBEDTLS_PSA_INJECT_ENTROPY requires some extra platform
functions, for historical reasons. To enable us to test this option, provide
a version of these functions for testing.
(These versions would actually work in production, but providing them in the
library in a way that doesn't break existing users might be slightly tricky,
so it's out of scope of this commit.)
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-07-20 18:08:24 +02:00
Gilles Peskine
9a9d5eea53
Fix a build error when MBEDTLS_PSA_INJECT_ENTROPY is enabled
...
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-07-20 18:07:47 +02:00
Dave Rodgman
668323c49e
Merge pull request #7922 from AndrzejKurek/doxygen-bad-param-names-2-28
...
[Backport 2.28] Fix wrong doxygen parameter names and misused \p commands
2023-07-20 14:10:13 +01:00
Agathiyan Bragadeesh
27e2989840
Back port TEST_FAIL
...
Signed-off-by: Agathiyan Bragadeesh <agathiyan.bragadeesh2@arm.com>
2023-07-18 12:54:30 +01:00
Andrzej Kurek
0841b5a178
Add a workaround for max test suite parameter sizes
...
int isn't enough for SIZE_MAX/2.
Hardcoding the value will make the compilers complain.
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2023-07-14 15:16:35 -04:00
Andrzej Kurek
3f87d63c71
Improve the documentation of MBEDTLS_PLATFORM_MEMORY
...
Introduce requests from review comments.
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2023-07-14 10:22:34 -04:00
Andrzej Kurek
710e54e2d6
Add msan and asan env variables to .travis.yml
...
This way the CI tests don't fail on a null allocation.
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2023-07-14 10:17:32 -04:00
Andrzej Kurek
6e4a9beb2b
Disable msan errors on null allocation in all.sh
...
Such error was raised in platform tests,
and it's a valid test case.
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2023-07-14 10:16:11 -04:00
Andrzej Kurek
f1e61fcb09
Add a dummy usage of a pointer in tests
...
This way clang with O1 doesn't optimize it.
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2023-07-14 10:16:00 -04:00
Andrzej Kurek
33b1222c88
Enable certain documented defines only when generating doxygen
...
Avoid an "unrecognized define" error.
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2023-07-14 10:14:29 -04:00
Andrzej Kurek
d95b8edf29
Disable asan errors on null allocation in all.sh
...
Such error was raised in platform tests,
and it's a valid test case.
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2023-07-14 10:13:40 -04:00
Andrzej Kurek
f35490e7af
Move the overallocation test to test suites
...
This way the compiler does not complain about
an overly large allocation made.
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2023-07-14 10:13:31 -04:00
Andrzej Kurek
8ca66a0795
Add an mbedtls_calloc(SIZE_MAX/2, SIZE_MAX/2) test
...
It should return NULL and not a valid pointer.
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2023-07-14 10:13:26 -04:00
Andrzej Kurek
c83d49ebc2
Add a description of how mbedtls_calloc is determined
...
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2023-07-14 09:58:17 -04:00
Andrzej Kurek
c8bf05954b
Add a calloc selftest for more than a page
...
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2023-07-14 09:56:12 -04:00
Andrzej Kurek
ba16859cc6
Documentation and cosmetic fixes
...
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2023-07-14 09:56:02 -04:00
Andrzej Kurek
5ffea9dc77
Rework the calloc buffer initialization test in selftest.c
...
This way it's more in line with development.
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2023-07-14 09:53:08 -04:00
Andrzej Kurek
dc11cd1668
Extend mbedtls_calloc and mbedtls_free documentation
...
Co-authored-by: Gilles Peskine <Gilles.Peskine@arm.com>
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2023-07-14 09:47:05 -04:00
Andrzej Kurek
db54dbdc56
Fix \p misuses in documentation
...
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2023-07-14 05:35:38 -04:00
Andrzej Kurek
532ec20983
doxygen: \p commands misuse - review comments
...
Apply comments suggested in review.
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2023-07-14 05:29:33 -04:00
Andrzej Kurek
c00fb7f379
doxygen: fix parameter name typos and misused \p commands
...
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2023-07-14 05:29:20 -04:00
Andrzej Kurek
0cbfbd96c1
doxygen: fix misused \p commands in rsa.h
...
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2023-07-14 05:22:57 -04:00
Andrzej Kurek
96ce1b04ea
doxygen: fix parameter name typos and misused \p commands
...
\p is reserved for function parameters.
\c is used to describe other values and variables.
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2023-07-14 05:22:42 -04:00
Dave Rodgman
45b93ec621
Merge pull request #1037 from daverodgman/cmac-blocksize-2.28
2023-07-13 19:32:58 +01:00
Dave Rodgman
a3e4e229ef
Change value of MBEDTLS_CIPHER_BLKSIZE_MAX if ARIA or Camellia present
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-07-13 15:41:04 +01:00
Andrzej Kurek
a490042f1c
Fix documentation - parameter name mistakes
...
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2023-07-13 10:16:08 -04:00
Andrzej Kurek
a3d315a216
doxygen: remove unnecessary description
...
Due to the nature of CTR, there is no mode parameter.
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2023-07-13 10:15:02 -04:00
Gilles Peskine
4e73afe6ed
Merge pull request #7907 from gowthamsk-arm/fix_ecp_group_compare
...
tests/test_suite_ecp: Fix ECP group compare test
2023-07-13 12:43:10 +02:00
Gowtham Suresh Kumar
21f2b7a64b
tests/test_suite_ecp: Fix ECP group compare test
...
ECP group compare function should not check the value of T. We only need
to assert the value of T after the ECP group copy function is called.
Signed-off-by: Gowtham Suresh Kumar <gowtham.sureshkumar@arm.com>
2023-07-12 13:59:18 +01:00
Gilles Peskine
76a54ff1a8
Merge pull request #7901 from tgonzalezorlandoarm/tg/7879-backport
...
Backport 2.28: tests/test_suite_pem: Augment DES test cases with AES: PEM
2023-07-10 18:27:55 +02:00
Dave Rodgman
814a14a994
Merge pull request #7897 from tgonzalezorlandoarm/7136-backport
...
Backport 2.28: Record the outcome of each test case in compat.sh
2023-07-10 12:08:41 +01:00
Tomás González
991c49f812
tests/test_suite_pem: Augment DES test cases with AES: PEM
...
A few negative test cases in test_suite_pem.data rely on DES
(“invalid iv”, “malformed”). DES is deprecated.
Construct similar test cases using AES.
Signed-off-by: Tomás González <tomasagustin.gonzalezorlando@arm.com>
2023-07-10 11:38:30 +01:00
Yanray Wang
5659981cf8
ssl-opt.sh: support to parse --outcome-file
...
Adjust where to set absolute path for MBEDTLS_TEST_OUTCOME_FILE
as it's supposed to set its absolute path after all possible
value assignment.
Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-07-10 09:38:24 +01:00
Dave Rodgman
b18d45f042
Merge pull request #7483 from gilles-peskine-arm/mbedtls_x509_crt_parse_path-qemu-bug-2.28
...
Backport 2.28: More mbedtls_x509_crt_parse_path() tests, and note qemu-user bug when 32-bit code run on 64-bit host
2023-07-07 19:15:46 +01:00
Paul Elliott
dc1244d135
Merge pull request #6974 from davidhorstmann-arm/2.28-cmake-pass-through-config-defines
...
[Backport 2.28] Pass `MBEDTLS_CONFIG_FILE` defines through cmake
2023-07-07 17:01:24 +01:00
Tom Cosgrove
f788a45d47
Merge pull request #7213 from sergio-nsk/patch-5
...
mbedtls-2.28: Fix error: comparison of integers of different signs: 'SOCKET' and 'int'
2023-07-07 16:46:03 +01:00
Dave Rodgman
f8f4c6053a
Merge branch 'mbedtls-2.28' into mbedtls_x509_crt_parse_path-qemu-bug-2.28
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-07-07 15:15:47 +01:00
Yanray Wang
31d5046f32
test-framework.md: document compat.sh
...
Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-07-07 12:25:19 +01:00
Yanray Wang
44ba969acb
compat.sh: add support to record outcome of test cases
...
If the environment variable MBEDTLS_TEST_OUTCOME_FILE is set,
the test outcome file records each test case in a single line
with the format of
PLATFORM;CONFIGURATION;compat;TEST CASE DESCRIPTION;RESULT;[CAUSE]
- CONFIGURATION comes from MBEDTLS_TEST_CONFIGURATION to record
configuration of each test case
- PLATFORM is either set by users or calculated from test
platform
- RESULT is one of PASS, FAIL or SKIP. If test case fails,
srv_out/cli_out follows as FAILURE CAUSE.
Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-07-07 12:23:08 +01:00
Dave Rodgman
e992af6fba
Merge pull request #7585 from gilles-peskine-arm/fuzz-file-open-fail-2.28
...
Backport 2.28: Fuzz programs: print an error if loading the reproducer fails
2023-07-07 11:51:50 +01:00
Yanray Wang
0f386b7372
compat.sh: call record_fail if test case fails
...
Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-07-07 11:34:54 +01:00
David Horstmann
63b06a8889
Add ChangeLog entry for CMake config defines
...
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-07-07 11:29:23 +01:00
Dave Rodgman
b8e6b66644
Merge pull request #7868 from gilles-peskine-arm/readme-python3.6
...
Backport 2.28: officially require Python 3.6
2023-07-07 09:58:22 +01:00
David Horstmann
58dda6713c
Use emptiness-checks rather than DEFINED checks
...
For the MBEDTLS_CONFIG_FILE and MBEDTLS_USER_CONFIG_FILE variables,
check that they are non-empty and defined. This means they can be
unconditionally created in the cache, simplifying the CMakeLists.txt
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-07-05 18:12:09 +01:00
David Horstmann
6762231e4b
Use CONFIG_H variable rather than config file name
...
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-07-05 14:35:25 +01:00
David Horstmann
175afbdfe8
all.sh component to test cmake custom config file
...
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-07-05 14:35:25 +01:00
David Horstmann
1a30cf70cc
Pass config file options to mbedtls_test(_helpers)
...
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-07-05 14:35:08 +01:00
David Horstmann
e31e287109
Pass MBEDTLS_CONFIG_FILE defines through cmake
...
When -DMBEDTLS_CONFIG_FILE or -DMBEDTLS_USER_CONFIG_FILE are passed to
cmake, pass them through as compile definitions. This allows different
mbedtls configs to be passed at configure time without modifying any
cmake files.
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-07-05 14:33:11 +01:00