Commit graph

7975 commits

Author SHA1 Message Date
Przemek Stekiel
685d472db3 Adapt expected output of existing tests
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com>
2023-01-24 10:57:19 +01:00
Przemek Stekiel
46a4a4987e Add tests to very parsing of CSR v3 extensions
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com>
2023-01-24 10:57:19 +01:00
Przemek Stekiel
e7fbbb3fbd Generate csr files to test v3 extensions
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com>
2023-01-24 10:57:19 +01:00
Gilles Peskine
449bd8303e Switch to the new code style
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-01-11 14:50:10 +01:00
Gilles Peskine
c55c343670
Merge pull request #6884 from gilles-peskine-arm/check-files-unicode
Reject bad characters in source code
2023-01-11 13:46:59 +01:00
Ronald Cron
83c5ad4873
Merge pull request #6787 from yuhaoth/pr/workaround-gnutls_anti_replay_fail
TLS 1.3: EarlyData: Workaround anti replay fail from GnuTLS
2023-01-11 09:05:36 +01:00
Gilles Peskine
3900bddd77
Merge pull request #6823 from mpg/unify-openssl-variables
Use OPENSSL everywhere, not OPENSSL_CMD
2023-01-10 22:10:19 +01:00
Manuel Pégourié-Gonnard
28d4d43416
Merge pull request #6863 from valeriosetti/issue6830
Remove uses of mbedtls_ecp_curve_info in TLS (with USE_PSA)
2023-01-10 10:01:17 +01:00
Manuel Pégourié-Gonnard
6e666c2e79 Remove obsolete comment
Was explaining why we didn't use the OPENSSL name, but we are using it
now...

Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2023-01-10 09:38:58 +01:00
Manuel Pégourié-Gonnard
3368724ade
Merge pull request #6870 from valeriosetti/issue6831
Document/test dependencies on ECP & Bignum
2023-01-10 09:25:41 +01:00
Valerio Setti
2c12185b88 test: fix dependencies on function and data files
Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2023-01-09 18:00:39 +01:00
Valerio Setti
1e868ccbac fix several typos and extra blank spaces
Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2023-01-09 17:59:46 +01:00
Jerry Yu
a15af37867 Change time resolution of reco_delay from second to millionseconds
Per gnutls anti replay issue, it needs millionsecond time delay for
improve the fail rate.

From test result of #6712, this can improve the fail rate from 4%
to 92%.

Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
2023-01-07 13:01:42 +08:00
Jerry Yu
f05b6eed0c Revert "Skip early data basic check temp"
This reverts commit 4e83173bb7.

Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
2023-01-07 13:01:42 +08:00
Manuel Pégourié-Gonnard
b17803682e
Merge pull request #6873 from mpg/fix-derive-key-exercise
Fix test function derive_key_exercise()
2023-01-06 11:50:05 +01:00
Gilles Peskine
d11bb47fe0 Reject invalid UTF-8 and weird characters in text files
Reject "weird" characters in text files, especially control characters that
might be escape sequences or that might cause other text to appear garbled
(as in https://trojansource.codes/).

Also reject byte sequences that aren't valid UTF-8.

Accept only ASCII (except most control characters), letters, some non-ASCII
punctuation and some mathematical and technical symbols. This covers
everything that's currently present in Mbed TLS ( §áèéëñóöüłŽ–—’“”…≥).

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-01-05 20:31:14 +01:00
Gilles Peskine
b389743ace Pass line number to issue_with_line
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-01-05 20:28:30 +01:00
Gilles Peskine
0ed9e78bf7 Treat more *.bin files as binary
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-01-05 20:27:35 +01:00
Gilles Peskine
cd0a565644
Merge pull request #6703 from yuhaoth/pr/tls13-misc-from-prototype
TLS 1.3: Upstream misc fix from prototype
2023-01-05 14:35:54 +01:00
Valerio Setti
67419f0e11 tls: fix + save code size when DEBUG_C is not enabled
Some PSA curves' symbols (PSA_WANT_) were not matching the corresponding
MBEDTLS_ECP_DP_. This was fixed together with the removal of extra code
when DEBUG_C is not enabled.

Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2023-01-04 17:36:00 +01:00
Manuel Pégourié-Gonnard
9502b56192 Fix test function derive_key_exercise()
mbedtls_test_psa_setup_key_derivation_wrap() returns 1 for success, 0
for error, so the test here was wrong.

This is just a hotfix in order to avoid a testing gap. Larger issues not
addressed here:

- I don't think we should just exit and mark the test as passed; if
we're not doing the actual testing this should be marked as SKIP.
- Returning 1 for success and 0 for failure is a violation of our
documented coding guidelines. We're also supposed to test with == 0 or
!= 0. Having consistent conventions is supposed to help avoid errors
like this.

Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2023-01-04 13:16:53 +01:00
Valerio Setti
e1655b8132 test: add test for building without BIGNUM_C
Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2023-01-03 16:20:43 +01:00
Valerio Setti
73260b6e65 test: extend test_suite_ssl for testing new functions
Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2023-01-03 16:05:02 +01:00
Valerio Setti
3322f611e6 test: verify that TLS and X509 are independent from mbedtls_ecp_curve functions
Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2023-01-03 13:03:42 +01:00
Manuel Pégourié-Gonnard
7a389ddc84
Merge pull request #6784 from valeriosetti/issue6702
Make SHA224_C/SHA384_C independent from SHA256_C/SHA512_C
2023-01-03 09:36:58 +01:00
Janos Follath
b4b0bb737d
Merge pull request #5907 from mpg/use-psa-rsa-pss
Use PSA more often in `pk_verify_ext()`
2022-12-30 12:33:50 +00:00
Manuel Pégourié-Gonnard
4511ca063a Use PSS-signed CRL for PSS tests
Otherwise, in builds without PKSC1_V15, tests that are supposed to
accept the certificate will fail, because once the cert is OK they will
move on to checking the CRL and will choke on its non-PSS signature.

Tests that are supposed to reject the cert due to an invalid signature
from the CA will not check the CRL because they don't recognize the CA
as valid, so they have no reason to check the CA's CRL. This was hiding
the problem until the recent commit that added a test where the cert is
supposed to be accepted.

Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2022-12-30 10:13:41 +01:00
Valerio Setti
ea8c88fcbb test: fix some descriptions
Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2022-12-29 11:08:35 +01:00
Manuel Pégourié-Gonnard
6ea0a8d883 Disable 'wrong salt len' PK test with USE_PSA
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2022-12-29 10:07:08 +01:00
Valerio Setti
c963bb11c7 test: remove SHA224 from default test driver config
Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2022-12-28 12:58:14 +01:00
Valerio Setti
77b1452784 test: fix error in test_suite_ssl
Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2022-12-23 10:53:06 +01:00
Manuel Pégourié-Gonnard
676766ff77
Merge pull request #6776 from gabor-mezei-arm/6222_bignum_mod_mul
Bignum: Implement fixed width modular multiplication
2022-12-23 10:39:30 +01:00
Manuel Pégourié-Gonnard
2fcb4c1d06
Merge pull request #6747 from gilles-peskine-arm/bignum-mod-random
Bignum mod random
2022-12-23 10:36:22 +01:00
Valerio Setti
b6bf7dcc28 test: fix depends.py for hash tests
Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2022-12-22 14:28:03 +01:00
Manuel Pégourié-Gonnard
2510dd41bf
Merge pull request #6282 from gstrauss/sw_derive_y
mbedtls_ecp_point_read_binary from compressed fmt
2022-12-22 10:20:31 +01:00
Gabor Mezei
f65c71fbe6
Fix possible uninitialization error
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2022-12-21 11:54:22 +01:00
Manuel Pégourié-Gonnard
3b1a706935 Disable 'wrong salt len' test with USE_PSA
We've decided not to check it, see
https://github.com/Mbed-TLS/mbedtls/issues/5277

Also add a test that we accept the certificate with USE_PSA.

Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2022-12-21 09:55:30 +01:00
Manuel Pégourié-Gonnard
eab43a62c3
Merge pull request #6795 from gilles-peskine-arm/check_test_cases-quiet_ci
Hide check_test_cases warnings on the CI
2022-12-21 09:42:41 +01:00
Gilles Peskine
4c950d5ff1 Cosmetic fix
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2022-12-20 22:02:55 +01:00
Gilles Peskine
d1aa75d7b2 Update of the RNG seed in mpi_mod_random_values
The code had an earlier version. Update to the new seed that
mpi_core_random_basic has moved to.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2022-12-20 22:01:47 +01:00
Gilles Peskine
e1d8326e90 Fix representation of mod-random output
mbedtls_mpi_mod_raw_random() and mbedtls_mpi_mod_random() were producing
output in the Montgomery representation, instead of obeying the
representation chosen in the modulus structure. Fix this.

Duplicate the test cases for mod-random output to have separate test cases
for each representation.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2022-12-20 20:28:02 +01:00
Gilles Peskine
1e2a4d4089 Functions to convert raw residues to/from the modulus representation
Test cases will be generated automatically by a subsequent commit.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2022-12-20 19:55:51 +01:00
Gilles Peskine
c377f31ad9 Remove unused import
This wasn't reported by pylint due to a pylint bug (apparently):
`pylint A B` doesn't complain about an unused import in B if A happens to
import and use the same module, which happens to be the case when we run
pylint on the CI.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2022-12-20 19:52:42 +01:00
Gabor Mezei
78c4fb4551
Fix possible uninitialization error
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2022-12-20 18:09:49 +01:00
Gabor Mezei
f9728137d8
Fix the order of freeing memory
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2022-12-20 17:30:20 +01:00
Gabor Mezei
61fd1fb4b1
Calling the residue_release() is not needed
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2022-12-20 17:30:20 +01:00
Gabor Mezei
809baef2dd
Use helper functions to simplify test code
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2022-12-20 17:30:19 +01:00
Gabor Mezei
77b877d5a7
Generate operands in Mongomery representation for the test function
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2022-12-20 17:30:19 +01:00
Gabor Mezei
eca74668c7
Add tests for mod_mul
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2022-12-20 17:30:19 +01:00
Manuel Pégourié-Gonnard
82dad10746
Merge pull request #6820 from gilles-peskine-arm/code-style-skip-generated-files
Don't touch the style of generated files
2022-12-19 13:06:25 +01:00