17911 Commits

Author SHA1 Message Date
Dave Rodgman
001917898f Document minimum size for DEBUG_BUF_SIZE
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-05-16 16:47:09 +01:00
valord577
0d87d90cea simplify code
Signed-off-by: valord577 <valord577@gmail.com>
2023-05-16 16:47:09 +01:00
valord577
de6ea9847d code style
Signed-off-by: valord577 <valord577@gmail.com>
2023-05-16 16:47:09 +01:00
valord577
06b0bb55e3 make code readable and change var name
Signed-off-by: valord577 <valord577@gmail.com>
2023-05-16 16:47:09 +01:00
valord577
e3623920cf send debug msg if contains '\n'
Signed-off-by: valord577 <valord577@gmail.com>
2023-05-16 16:47:09 +01:00
Dave Rodgman
40fe1cd364 Update library/debug.c
Fix trailing white-space

Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-05-16 16:47:09 +01:00
valord577
afbaac29e8 Fix: no newline when debug msg over DEBUG_BUF_SIZE
Signed-off-by: valord577 <valord577@gmail.com>
2023-05-16 16:47:09 +01:00
Fredrik Hesse
6f665a56d0 Minor adjustments after review.
Signed-off-by: Fredrik Hesse <fredrik@hesse.se>
2023-05-15 15:28:46 +01:00
Fredrik Hesse
02501f6ba1 Replace references to Mbed Crypto with Mbed TLS through-out documentation and comments.
Signed-off-by: Fredrik Hesse <fredrik@hesse.se>
2023-05-15 15:28:39 +01:00
Fredrik Hesse
5b673a828d Replace references to Mbed Crypto with Mbed TLS through-out documentation and comments.
Signed-off-by: Fredrik Hesse <fredrik@hesse.se>
2023-05-15 15:27:54 +01:00
Paul Elliott
9febc989c7
Merge pull request #7587 from gilles-peskine-arm/gitignore-objects-at-root-2.28
Backport 2.28: Ignore *.o everywhere
2023-05-15 13:57:12 +01:00
Gilles Peskine
e32e447407 Ignore *.o everywhere
We don't commit *.o files anywhere, not even as test data. So ignore them
everywhere.

Also remove a redundant ignore of *.exe in a subdirectory.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-05-12 13:57:39 +02:00
Gilles Peskine
d47c7b104e Fuzz programs: print an error if loading the reproducer fails
The fuzz programs were returning a nonzero status if they failed to load the
reproducer, but that's discreet and not informative. Make them also print an
error message.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-05-12 13:47:33 +02:00
Mukesh Bharsakle
2599a71c74 updating test-ca.key to use AES instead of DES 2023-05-10 12:12:40 +01:00
Gilles Peskine
a8b3d0c7a2
Merge pull request #7553 from davidhorstmann-arm/2.28-remove-doxygen-mainpage-content
[Backport 2.28] Remove API docs mainpage content
2023-05-07 20:35:31 +02:00
David Horstmann
73474ed121 Minor cosmetic changes
* Change "source code documentation" to "API documentation" for
precision
* Change "mbed TLS" to "Mbed TLS" following established convention
* Use title case in the title

Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-05-04 15:36:23 +01:00
David Horstmann
1ef4dc9df9 Update broken link to doxygen homepage
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-05-04 15:35:10 +01:00
David Horstmann
07b1cf91e1 Remove most of the doxygen mainpage
Since the API docs are now published as part of the larger
documentation, it makes no sense to give an overview of Mbed TLS in the
mainpage as this is already given elsewhere.

Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-05-04 15:35:08 +01:00
Dave Rodgman
2e4541f96f
Merge pull request #7545 from tom-cosgrove-arm/use-mbedtls_ct_uint_if-rather-than-mbedtls_ct_cond_select_sign-2.28
Backport 2.28: Use mbedtls_ct_uint_if() rather than mbedtls_ct_cond_select_sign()
2023-05-04 12:23:36 +01:00
Gilles Peskine
5ead738269
Merge pull request #7503 from gilles-peskine-arm/test-argument-types-union-2.28
Backport 2.28: Support larger integer test arguments
2023-05-04 10:05:25 +02:00
Paul Elliott
d7570a2a3b
Merge pull request #7536 from valeriosetti/issue7480-backport
Backport: Fix test gap in PK write: private (opaque) -> public
2023-05-03 17:08:43 +01:00
Gilles Peskine
4ac90508f8 Fix pastapasta
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-05-03 14:53:05 +02:00
Gilles Peskine
25c9f4bb8c typo
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-05-03 14:53:05 +02:00
Gilles Peskine
a4394d4be1 Document a known issue with testing of mbedtls_x509_crt_parse_path
The parse_path tests are known to fail when compiled for a 32-btt architecture
and run via qemu-user on Linux on a 64-bit host. This is due to a known
bug in Qemu: https://gitlab.com/qemu-project/qemu/-/issues/263

Document this, and add test cases to parse the files involved to confirm
that the problem is only with parse_path.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-05-03 14:53:05 +02:00
Gilles Peskine
ad72ea02b3 Improve testing of mbedtls_x509_crt_parse_file
Check the number of certificates found, as was done in the test of
mbedtls_x509_crt_parse_path().

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-05-03 14:53:04 +02:00
Tom Cosgrove
735d2c99e7 Backport 2.28: Use mbedtls_ct_uint_if() rather than mbedtls_ct_cond_select_sign()
Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com>
2023-05-03 09:50:10 +01:00
Valerio Setti
0eace4128b pk: fixing backport issues
Note: RSA is not supported in mbedtls-2.28 for opaque wrapping
so it was removed from test_suite_pkwrite.data.

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-05-02 16:38:57 +02:00
Valerio Setti
974b816b3e test: check for exact length of returned pub key
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-05-02 16:06:40 +02:00
Valerio Setti
3f8bf06534 test: optimize code for pk_write_public_from_private()
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-05-02 16:06:39 +02:00
Valerio Setti
39a669433b test: use better naming for the newly introduced test function
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-05-02 16:06:36 +02:00
Valerio Setti
5e7494ea75 pk: fix position for mbedtls_platform_zeroize
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-05-02 16:06:34 +02:00
Valerio Setti
b4468c45ac test: fix makefile for ec_pub.[der/pem] generation
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-05-02 16:04:46 +02:00
Valerio Setti
50dacdfd34 test: fix wrong private key file
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-05-02 16:00:58 +02:00
Valerio Setti
7406e967f0 test: add test function for public key derivation starting from private one
Data test cases are also included in the commit.

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-05-02 16:00:53 +02:00
Valerio Setti
aae96c9060 pk: fix: clear buffer holding raw EC private key on exit
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-05-02 16:00:45 +02:00
Manuel Pégourié-Gonnard
c69614bec0
Merge pull request #7505 from valeriosetti/issue7460-part1-backport
Backport: Fixing USE_PSA_INIT/DONE in SSL/X509/PK test suites
2023-05-02 10:44:15 +02:00
Gilles Peskine
dca0501089 Adjust code style for pointer types and casts
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-04-28 13:19:30 +02:00
Gilles Peskine
47903b17e9 typo
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-04-28 13:19:30 +02:00
Gilles Peskine
97f5cff2a2 Add test cases with a question mark
The test framework used to treat them specially (but no longer does). Add
these test cases as non-regression for how the test framework allows "?"
and especially "??" (which I think in the very distant path needed special
handling because the test data was embedded in a .c file, and thus ?? could
be interpreted as the prefix of a trigraph).

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-04-28 13:19:30 +02:00
Gilles Peskine
5be40834e4 Fix wrong comment
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-04-28 13:19:30 +02:00
Gilles Peskine
f089972625 Explain the format argument expected by the test functions
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-04-28 13:19:30 +02:00
Gilles Peskine
c2fda4b7fb Fix typos in test descriptions
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-04-28 13:19:30 +02:00
Gilles Peskine
c627917439 Test the line number returned by parse_test_data
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-04-28 13:19:30 +02:00
Gilles Peskine
f599ddfb43 Remove string hack for mbedtls_mpi_mod_int testing
Now that the test framework can pass arbitrary values of type
mbedtls_mpi_sint, just do that.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-04-28 13:19:30 +02:00
Gilles Peskine
ba72662730 Allow more signed integer types in test function arguments
Now that the C code supports the full range of intmax_t, allow any size of
signed integer type in the .data file parser.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-04-28 13:19:30 +02:00
Gilles Peskine
6494d923f0 Support larger integer test arguments: C part
Change the type of signed integer arguments from int32_t to intmax_t.
This allows the C code to work with test function arguments with a range
larger than int32_t. A subsequent commit will change the .datax generator
to support larger types.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-04-28 13:19:30 +02:00
Gilles Peskine
615be63565 parse_function_arguments: stricter type parsing
Use normalization the equality comparisons instead of loose regular
expressions to determine the type of an argument of a test function.

Now declarations are parsed in a stricter way: there can't be ignored junk
at the beginning or at the end. For example, `long long unsigned int x`
was accepted as a test function argument (but not `long long unsigned x`),
although this was misleading since the value was truncated to the range of
int. Now only recognized types are accepted.

The new code is slightly looser in that it accepts `char const*` as well as
`const char*`.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-04-28 13:19:30 +02:00
Gilles Peskine
46476e04f4 Support (void) as an argument list of a test function
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-04-28 13:19:30 +02:00
Gilles Peskine
f153c5676b parse_function_arguments: extract per-argument function
Internal refactoring only, no behavior change.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-04-28 13:19:30 +02:00
Gilles Peskine
3a37f19e31 parse_function_arguments: make local_vars a list
Internal refactoring only, no behavior change.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-04-28 13:19:30 +02:00