30808 Commits

Author SHA1 Message Date
David Horstmann
ecd6d01023 Rename framework_path to framework_scripts_path
This name is more descriptive of its purpose, since it actually adds
framework/scripts to the path rather than just framework/

Signed-off-by: David Horstmann <david.horstmann@arm.com>
2024-05-13 14:43:38 +01:00
David Horstmann
6c0e362a82 Update framework submodule to tip of branch
This allows us to use the mbedtls_framework python files moved there.

Signed-off-by: David Horstmann <david.horstmann@arm.com>
2024-05-13 14:43:38 +01:00
David Horstmann
299e741e8e Add mbedtls_framework to mypy checks
Since this python module resides in the framework submodule we must
add an extra explicit path to it for mypy.

Signed-off-by: David Horstmann <david.horstmann@arm.com>
2024-05-13 14:43:38 +01:00
David Horstmann
875c32fa07 Add framework_path module
This allows scripts in the scripts/ directory to get the path to the
mbedtls_framework module in framework/scripts/

Signed-off-by: David Horstmann <david.horstmann@arm.com>
2024-05-13 14:43:38 +01:00
David Horstmann
cd84bb287b Update references to mbedtls_dev
Change these to point to the new mbedtls_framework module in the
framework submodule.

Signed-off-by: David Horstmann <david.horstmann@arm.com>
2024-05-13 14:43:29 +01:00
David Horstmann
1131318b72 Add framework/scripts to scripts_path.py
This allows test scripts to find the new mbedtls_framework module.

Signed-off-by: David Horstmann <david.horstmann@arm.com>
2024-05-13 13:48:13 +01:00
David Horstmann
6343a83057 Move some files to framework repository
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2024-05-13 13:48:13 +01:00
Gilles Peskine
2cdc8f7aa5
Merge pull request #9122 from davidhorstmann-arm/fix-fuzzing-build-failures
Move some test data generation to main CMakeLists.txt (/ fix fuzzing build failures)
2024-05-12 18:56:11 +00:00
David Horstmann
cbea7d6e67 Add note explaining component purpose
We are testing that we don't break OSS-Fuzz, primarily.

Signed-off-by: David Horstmann <david.horstmann@arm.com>
2024-05-10 15:37:57 +01:00
David Horstmann
041ed42555 Add all.sh component for programs without tests
Check that we can build under CMake with ENABLE_TESTING=OFF but
ENABLE_PROGRAMS=ON.

Signed-off-by: David Horstmann <david.horstmann@arm.com>
2024-05-10 14:37:48 +01:00
David Horstmann
1238b37573 Move test generated files to main CMakeLists.txt
Move the generation of tests/src/test_certs.h and tests/src/test_keys.h
to the main CMakeLists.txt. This is required because these files are
needed both by tests and programs, whereas tests/CMakeLists.txt is only
included when ENABLE_TESTING is on.

Signed-off-by: David Horstmann <david.horstmann@arm.com>
2024-05-10 14:23:16 +01:00
Tom Cosgrove
9b5768782e
Merge pull request #9104 from valeriosetti/issue8962
Add a component to all.sh to build and run psasim
2024-05-10 12:45:04 +00:00
Manuel Pégourié-Gonnard
0e7aaae1fd
Merge pull request #9017 from valeriosetti/issue9010
Improve generate_test_keys.py
2024-05-07 11:59:54 +00:00
Valerio Setti
a8ccddce68 generate_test_keys: move code for arrays and LUT generation to a separate function
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-05-07 12:35:40 +02:00
Valerio Setti
aabdca6950 check-generated-files: move check for generate_test_cert_macros.py
This test should only be performed when in MbedTLS repo and not
in tf-psa-crypto one.

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-05-07 11:15:12 +02:00
Valerio Setti
3fcaf6cc8a generate_test_[keys/cert_macros]: minor fixes
- remove new line at beginning of test_keys.h
- add footer at the end of both generated files

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-05-07 10:41:47 +02:00
Valerio Setti
cc403cb6ec generate_test_keys: move output file writing to a separate function
This helps removing the previous pylint exception.

Also use "with" statement for opening the file in order to
ensure that all the content is flushed to the file before
exiting.

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-05-07 10:41:46 +02:00
Valerio Setti
d9e4251278 all.sh: add test component to build and test psasim
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-05-06 15:59:51 +02:00
Gilles Peskine
ca73fc6627
Merge pull request #9026 from nileshkale123/fix/redefination_warning_for_gnu_source
Fixed redefination warning messages for _GNU_SOURCE
2024-05-06 12:40:49 +00:00
Tom Cosgrove
4491ceafd9
Merge pull request #9097 from valeriosetti/moving-psasim
[crypto_client_test] Moving psasim from the framework repo to the mbedtls one
2024-05-05 16:10:39 +00:00
Valerio Setti
dc64163ad4 generate_test_keys: sort keys before processing them
Without this fix keys could be listed differently on Ubuntu 16
between different runs therefore causing
check_generated_files() to fail.

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-05-03 18:22:01 +02:00
Valerio Setti
4f4ade9c34 psa-client-server: move psasim from framework repo to the mbedtls one
This is a temporary fix that will be reverted once the framework
repository will have CI checks.

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-05-03 17:28:04 +02:00
Minos Galanakis
c16048887e Added work directory for the psa client/server testing epic
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2024-05-03 15:55:12 +01:00
Valerio Setti
d74d2ab9db check-generated-files: add test_certs.h file to the list of checked items
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-05-03 15:51:21 +02:00
Valerio Setti
5f37b25862 generate_test_cert_macros: minor fixes
- use build_tree to get the project root path
- remove "if True" in an "if" statement

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-05-03 15:51:11 +02:00
Valerio Setti
7f6eabd9b1 generated_test_keys: minor fixes
- rewrite output file (do not append)
- remove useless "os" import
- move pylint for main() function

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-05-03 15:33:18 +02:00
Manuel Pégourié-Gonnard
61734ec61d
Merge pull request #9073 from valeriosetti/issue9068
Undefined reference to mbedtls_md_error_from_psa() function
2024-05-03 07:52:37 +00:00
Gilles Peskine
aa82464dec
Merge pull request #8897 from IVOES/cpp/unbounded-write
ssl_mail_client: Fix unbounded write of sprintf()
2024-05-02 16:06:23 +00:00
Gilles Peskine
9791ee9296
Merge pull request #8538 from Ryan-Everett-arm/8537-fix-error-handling-for-secure-element-keys-in-psa_start_key_creation
Fix error handling for secure element keys in `psa_start_key_creation`
2024-05-02 16:06:07 +00:00
Gilles Peskine
fa8fc2705a
Merge pull request #9069 from Ryan-Everett-arm/fix-get-and-lock-key-slot-threading-bug
Wipe the returned slot pointer upon failure in `psa_get_and_lock_key_slot`
2024-05-02 15:48:21 +00:00
Gilles Peskine
cedb011c50
Merge pull request #9087 from ronald-cron-arm/add-cve-2024-30166-ref
ChangeLog: Add missing reference to CVE in security entry
2024-05-02 15:47:43 +00:00
Valerio Setti
19f5566843 generate_test_keys: remove left-over variable
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-05-02 16:11:26 +02:00
Valerio Setti
132d446c18 tests/CMakeLists: fix indentation
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-05-02 16:11:17 +02:00
Ronald Cron
93b660b67a ChangeLog: Add missing reference to CVE in security entry
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2024-05-02 15:36:16 +02:00
Valerio Setti
5ce51b153c generate_test_keys: do not quit script if output file already exists
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-05-02 14:40:03 +02:00
Manuel Pégourié-Gonnard
898066b851
Merge pull request #9049 from gilles-peskine-arm/test-dependencies-20240314-development
Fix some test case dependencies (PEM_C)
2024-05-02 08:00:25 +00:00
Ryan Everett
c51e948370 Add changelog
Signed-off-by: Ryan Everett <ryan.everett@arm.com>
2024-04-30 14:04:17 +01:00
Gilles Peskine
489688c0f7
Merge pull request #9065 from paul-elliott-arm/fix_ubsan_mp_aead_gcm
Add early exit if zero length AEAD additional data passed in.
2024-04-30 09:48:20 +00:00
Janos Follath
93f20f45d1 Fix Changelog formatting
Add EOL and remove trailing whitespaces.

Signed-off-by: Janos Follath <janos.follath@arm.com>
2024-04-30 10:32:17 +01:00
Valerio Setti
28cc31c9d5 md: fix guards for mbedtls_md_error_from_psa()
This should be CRYPTO_CLIENT and not CRYPTO_C as this function
can be used even when CRYPTO_C is not defined.

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-04-30 10:49:00 +02:00
Valerio Setti
0ddab0ecee generate_test_keys: add missing flush at the end of script
Ensure that all the data is actually written to the output file.

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-04-30 10:37:39 +02:00
nilesh.kale
d338d0156f Fixed issue of redefinition warning messages for _GNU_SOURCE
Signed-off-by: nilesh.kale <nilesh.kale@espressif.com>
2024-04-30 08:24:47 +05:30
Ryan Everett
925b2d76f4 Clarify psa_get_and_lock_key_slot return behaviour
Signed-off-by: Ryan Everett <ryan.everett@arm.com>
2024-04-29 18:29:48 +01:00
Ryan Everett
04e2b04f7f Explicitly document return behaviour
A bug existed previously where this guarantee was not met,
causing some issues in multi-threaded code.

Signed-off-by: Ryan Everett <ryan.everett@arm.com>
2024-04-29 18:26:19 +01:00
Ryan Everett
dd90507dc6 Fix potential non-NULL slot return on failure
If psa_get_and_lock_key_slot fails, the slot must be wiped.
This fixes a bug where a pointer to some valid key slot can
be incorrectly returned

Signed-off-by: Ryan Everett <ryan.everett@arm.com>
2024-04-29 18:24:58 +01:00
Valerio Setti
c21147efe7 test_suite_pk: use explicit key bit size instead of RSA_KEY_SIZE
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-04-29 17:38:37 +02:00
Valerio Setti
84dc3297fb generate_test_keys: use build_tree to guess the MbedTLS root path
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-04-29 17:33:48 +02:00
Valerio Setti
f27d407332 generate_test_cert_macros: minor fixes
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-04-29 17:16:41 +02:00
Valerio Setti
fb418166b5 cmake: relocate custom commands for test_certs.h and test_keys.h generation
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-04-29 17:16:41 +02:00
Valerio Setti
455fb4e803 generate_test_cert_macros: embed input args
- Embed input arguments inside the script so as to simplify the
  calls in Makefiles/CMakeLists.
- add a new "--list-dependencies" command line option to print
  out the list of dependencies.
- Modify tests/Makefile accordinlgy.

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-04-29 17:16:41 +02:00