Commit graph

23992 commits

Author SHA1 Message Date
Demi Marie Obenour
889534a4d2 Fix segfault in mbedtls_oid_get_numeric_string
When passed an empty OID, mbedtls_oid_get_numeric_string would read one
byte from the zero-sized buffer and return an error code that depends on
its value.  This is demonstrated by the test suite changes, which
check that an OID with length zero and an invalid buffer pointer does
not cause Mbed TLS to segfault.

Also check that second and subsequent subidentifiers are terminated, and
add a test case for that.  Furthermore, stop relying on integer division
by 40, use the same loop for both the first and subsequent
subidentifiers, and add additional tests.

Signed-off-by: Demi Marie Obenour <demiobenour@gmail.com>
2023-03-16 01:06:41 -04:00
Gilles Peskine
8d60574b7b
Merge pull request #6500 from yanrayw/split-TLS-connection-func-into-ssl_helpers
Move TLS connection helper code from test_suite_ssl.function to ssl_helpers.c
2023-03-15 10:50:03 +01:00
Dave Rodgman
a94c90d30d
Merge pull request #7282 from gilles-peskine-arm/changelog-6567-psa_key_derivation_abort-no-other_secret
Add changelog entry for a bug in non-PAKE code fixed during PAKE work
2023-03-15 09:27:33 +00:00
Dave Rodgman
b599562033
Merge pull request #7240 from tom-cosgrove-arm/fix-issue-7234
Don't insist on MBEDTLS_HAVE_ASM for MBEDTLS_AESCE_C on non-Arm64 systems
2023-03-15 09:04:44 +00:00
Manuel Pégourié-Gonnard
18336dace2
Merge pull request #7196 from mprse/ecjpake-driver-dispatch-peer-user
EC J-PAKE: partial fix for role vs user+peer
2023-03-15 09:37:30 +01:00
Gilles Peskine
51b2868f3c Add changelog entry for a bug in non-PAKE code fixed during PAKE work
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-03-14 21:41:54 +01:00
Dave Rodgman
e59c46e161
Merge pull request #7278 from daverodgman/aesce-macro-name-tidyup 2023-03-14 20:33:31 +00:00
Dave Rodgman
4a1d3beaee
Merge pull request #7229 from tom-cosgrove-arm/static-assert 2023-03-14 16:57:38 +00:00
Dave Rodgman
db6ab247fc Improve macro naming
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-03-14 16:03:57 +00:00
Dave Rodgman
023c8853ac
Merge pull request #7203 from yuhaoth/pr/add-cpu-modifier-for-aesce
Add CPU modifier for AESCE
2023-03-14 15:58:57 +00:00
Tom Cosgrove
57f04b81a0 Have MBEDTLS_STATIC_ASSERT() match current development more closely
Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com>
2023-03-14 12:03:47 +00:00
Przemek Stekiel
c0e6250ff9 Fix documentation and tests
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com>
2023-03-14 11:49:36 +01:00
Manuel Pégourié-Gonnard
2a13cfd2b0
Merge pull request #7243 from valeriosetti/issue7148
driver-only ECDH: enable ssl-opt.sh with parity
2023-03-14 11:07:56 +01:00
Yanray Wang
af727a28c9 ssl_helpers.c: improve code readability
Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-03-14 17:43:37 +08:00
Gilles Peskine
215ecd0439
Merge pull request #7252 from daverodgman/enable_pkcs7
Enable PKCS 7
2023-03-14 10:39:50 +01:00
Gilles Peskine
8128037017
Merge pull request #7163 from lpy4105/issue/all_sh-do-not-list-unsupported-cases
all.sh: Do not list unsupported cases
2023-03-14 10:34:04 +01:00
Manuel Pégourié-Gonnard
ca3e32aaa8
Merge pull request #7207 from valeriosetti/issue7140
Handle output consistently in analyze_outcomes.py
2023-03-14 09:43:45 +01:00
Dave Rodgman
cdaaef52f4
Update include/mbedtls/pkcs7.h
Co-authored-by: Xiaokang Qian <53458466+xkqian@users.noreply.github.com>
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-03-14 07:13:50 +00:00
Dave Rodgman
bcc92d4f03
Update include/mbedtls/pkcs7.h
Co-authored-by: Xiaokang Qian <53458466+xkqian@users.noreply.github.com>
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-03-14 07:13:44 +00:00
Jerry Yu
ec9be84ae6 skip pragma when cpu modifier has been set
Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
2023-03-14 10:42:47 +08:00
Jerry Yu
b28d55b242 fix wrong typo and indent issue
Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
2023-03-14 10:36:47 +08:00
Jerry Yu
fbf9523449 Revert "Add experimental warning"
This reverts commit be510fe470.

Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
2023-03-14 10:33:32 +08:00
Valerio Setti
3951d1bcce analyze_outcomes: symplify log functions
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-03-13 18:37:34 +01:00
Przemek Stekiel
fde112830f Code optimizations and documentation fixes
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com>
2023-03-13 16:28:27 +01:00
Przemek Stekiel
a11c1d141e Reword change log entry
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com>
2023-03-13 16:21:40 +01:00
Dave Rodgman
2ba9794adc
Merge pull request #7224 from gilles-peskine-arm/readme-pip
Improve python and pip instructions
2023-03-13 13:02:57 +00:00
Valerio Setti
e7f896d73f fix extra whitespaces
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-03-13 13:55:28 +01:00
Dave Rodgman
efbc5f7322 Update wording in comments
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-03-13 12:15:49 +00:00
Dave Rodgman
6c9cea8feb
Merge pull request #7260 from daverodgman/test-macro-cleanup
Remove duplicate test macros
2023-03-13 11:34:38 +00:00
Valerio Setti
80318d2775 ssl-opt: automatically detect requirements when using certs in dir-maxpath
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-03-13 12:26:42 +01:00
Yanray Wang
3463435ec5 ssl_helpers.c: fix review comments and improve code readability
Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-03-13 19:20:42 +08:00
Yanray Wang
5ba709c449 Move #define Directive into ssl_helpers.h
Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-03-13 19:20:42 +08:00
Yanray Wang
09a6f7e14f Move TEST_AVAILABLE_ECC into ssl_helpers.h
Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-03-13 19:20:42 +08:00
Yanray Wang
1db628f254 Move ECJPAKE_TEST_SET_PASSWORD into ssl_helpers.h
Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-03-13 19:20:42 +08:00
Yanray Wang
a8f445e60f Fix issue of conversion from size_t to int
ssl_helpers.c is treated with W3 warning level in MSVC complier.
So that it's reported as error for warning of conversion from
size_t to int. This change fixes all this type of warning seen in
Microsoft Visual Studio 12.0. Besides, some potential problems of
type conversion are also handled.

Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-03-13 19:20:42 +08:00
Yanray Wang
e64b40520d Fix build error in CI about test_fail_if_psa_leaking
During test of component build_arm_linux_gnueabi_gcc_arm5vte and
build_arm_none_eabi_gcc_m0plus. It fails with
 - error: implicit declaration of function
   ‘test_fail_if_psa_leaking’

It happens because test_fail_if_psa_leaking is defined in
helpers.function. This block of code is not converted into C code
while compiling ssl_helpers.c. The function has been moved to
psa_crypto_helpers.c in order to fix this build error.

Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-03-13 19:20:42 +08:00
Yanray Wang
b458b8c0ec Fix build errors in CMake
tests/src/ssl_helpers.c depends on functions defined
in library/*.c. If it's complied as an OBJECT with other c files,
cmake complains undefined reference in link stage under programs/.
Therefore, tests/src/test_helpers/ is created to hold c files with
dependency of library/*.c. Besides, tests/src/test_helper/*.c is
separated into another OBJECT, mbedtls_test_helpers, as sources
to build all test suite executables.

In addition, everest header directory is included in case
MBEDTLS_ECDH_VARIANT_EVEREST_ENABLED is enabled.

Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-03-13 19:20:42 +08:00
Yanray Wang
1fca4de942 ssl_helpers.c: remove duplicate comments for some functions
Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-03-13 19:20:42 +08:00
Yanray Wang
4d07d1c394 Resolve build errors for ssl_helpers.c and test_suite_ssl.c
Since we move many functions from test_suite_ssl.function to
ssl_helpers.c in commit 8e2bbdd. This causes various of
build errors. This commit fixes all the build errors by
 - including header files
 - providing function definition
 - adding guards for typedef statements and functions

Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-03-13 19:20:42 +08:00
Yanray Wang
e6afd919dd Move TLS connection related functions to ssl_helpers.c
Some functions are renamed in commit d51d285. This change moves all
those functions which are used to set up a TLS connection from
test_suite_ssl.function into ssl_helpers.c.

Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-03-13 19:20:42 +08:00
Yanray Wang
d577a68325 Improve code readability for test_suite_ssl.function
Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-03-13 19:15:53 +08:00
Yanray Wang
bd29683c90 Rewrap the lines to fit code standard in test_suite_ssl.function
As the typedef statements and functions are renamed in commit
de3caee and commit d51d285 respectively. This commit aims
to align code lines to fit code standard and improve code
readability.

Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-03-13 19:15:53 +08:00
Yanray Wang
f7b62353cb Rename the functions which are used to set up TLS connection
Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-03-13 19:15:53 +08:00
Yanray Wang
55a6619135 Move the renamed typedef statements to ssl_helpers.h
With this change, the renamed typedef statements (commit de3caee)
are moved from test_suite_ssl.function into ssl_helpers.h

Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-03-13 19:15:53 +08:00
Yanray Wang
9ef0dce9e3 Rename the typedef statements which are used for TLS connection
Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-03-13 19:15:53 +08:00
Yanray Wang
47907a4bb4 Create ssl_helpers.c to hold functions of TLS connection
test_suite_ssl.function contains many functions that are used to set
up a TLS connection. To reduce its file size, those functions would
be moved to ssl_helpers.c under tests/src. As the start of this
implementation, some necessary header files are moved in advance.

Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-03-13 19:15:53 +08:00
Valerio Setti
77588e9451 ssl-opt: uniformize requirements in tests
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-03-13 12:00:10 +01:00
Dave Rodgman
756b028511
Merge pull request #7171 from daverodgman/pr5527
Fix undefined behavior in ssl_read if buf parameter is NULL
2023-03-13 10:46:29 +00:00
Jerry Yu
be510fe470 Add experimental warning
Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
2023-03-13 11:26:35 +08:00
Jerry Yu
6f86c19d62 Improve readability for compiler version check
Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
2023-03-13 11:03:40 +08:00