30924 Commits

Author SHA1 Message Date
Valerio Setti
c98f8ab5f7 crypto-client: allow debug build of libraries and test binaries
Add DEBUG=1 in test_psasim() to helpers and final make to build
the libraries and the final binaries with debug symbols
enabled.

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-05-10 15:53:40 +02: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
Valerio Setti
237a64ef07 crypto-client: remove log files on "make clean"
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-05-10 12:32:10 +02:00
Valerio Setti
400168cd1a crypto-client: fix the SID
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-05-10 12:31:41 +02:00
Valerio Setti
cd89c1ffc8 crypto-client: simplify build of mbedtls static libraries
Instead of copying the entire library & include folders twice
to build libraries for client and server:

- change the main config file (mbedtls_config.h)
- build in the root library folder
- move the generated library in the psasim folder
- use those library for linking the client/server binaries

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-05-10 11:23:30 +02:00
Valerio Setti
66fb1c17ff crypto-client: reorganize source files/folders
The goal is to keep psasim as simple as possible:

- do not build a separate lib for psa-ff; build those source
  files as part of server or client
- do not have lot of different makefiles: just 1 that does all
  we need
- do not have several subfolders for headers: only 1 is enough
  for this kind of project

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-05-10 07:59:22 +02:00
Valerio Setti
dde9579fab all.sh: crypto-client: keep NV_SEED disabled in the server lib
This is necessary because otherwise the library is not able to
find the seedfile at runtime and it fails the initialization.
However since this test runs on a standard PC we can rely on
platform entropy as source of entropy.

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-05-10 05:22:33 +02:00
Valerio Setti
655b9793c0 crypto-client test: implement the first IPC call for psa_crypto_init()
This commit implements the first useful IPC communication between
the client and the server. The implemented command is simple,
psa_crypto_init(), and its return value is sent back to the client.

Note: the newly added file psa_functions_codes.h is temporary
and it's probably the one that needs to be automatically
generated by a python script to support all crypto functions.

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-05-10 05:22:23 +02:00
Valerio Setti
4362aaef7f crypto-client test: ensure that client/server are linked against proper MbedTLS libraries
Ensure that both server and client can call mbedtls_version_get_string_full()
to verify that they are linked against proper libraries.

Note: each side (client/server) performs the call against its own
MbedTLS library. There is no IPC communication involved in this
test. Client/server communication will come later.

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-05-09 09:23:46 +02:00
Valerio Setti
d1b6ef1959 crypto-client test: add mechanism to build crypto library for client and server
It includes changes to:
- tests/Makefile: build the library for client and server in different
  folders. It mimica the libtestdriver1 behavior (without functions
  renaming though).
- tests/scripts/all.sh: helper function to build for client and
  server with some default configuration for each of them.
- crypto_spe.h: this is dummy file taken from the already existing
  tests. It's just meant to pacify the compiler, not to provide
  something useful. It will likely be changed in the future.

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-05-09 07:31:54 +02: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
Ronald Cron
7661aa0e20 Do not use --recurse-submodules
On the CI, the git version when running on
Ubuntu 16.04 is 2.7 and it does not support
the "--recurse-submodules" option of
"git ls-files" thus do not use it.

Another argument to not use it is that
when TF-PSA-Crypto will be a submodule of
mbedtls we will not want check_files.py to
check the TF-PSA-Crypto files as well.

Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2024-05-03 16:25:07 +02: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
Ronald Cron
62a908d869 Extend C code style check to framework files
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2024-05-02 16:53:23 +02: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
1e05debd60 Extend basic checks of files to framework files
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2024-05-02 15:53:28 +02:00
Ronald Cron
72b980062d Update framework submodule
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2024-05-02 15:53:28 +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
Gilles Peskine
ff3b8211ff Driver-only FFDH is not good enough for DHE support in TLS 1.2
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-04-30 16:20:20 +02:00
Gilles Peskine
6191f4aeb5 Add seme missing dependencies on renegotiation support
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-04-30 16:20:20 +02:00
Gilles Peskine
dd782f4197 Default NEXT versions to be the base executables
This allows many tests to pass with the system openssl and gnutls-*. As
before, not all test cases will pass due to differences between versions and
build options.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-04-30 16:20:20 +02:00
Gilles Peskine
01fde2c3cc Force some test cases to use TLS 1.2
Some OpenSSL or GnuTLS interoperability test cases fail if the other
implementation is recent enough to support TLS 1.3. Force those test cases
to use TLS 1.2 so that the script works with more recent $OPENSSL or
$GNUTLS_CLI or $GNUTLS_SERV than our official CI versions.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-04-30 16:20:20 +02:00
Gilles Peskine
3b81ea1e9c Add some missing dependencies on crypto features
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-04-30 16:20:20 +02: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