Commit Graph

31064 Commits

Author SHA1 Message Date
Ronald Cron
640276268d Fix compat.sh filters
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2024-05-16 08:12:03 +02:00
Ryan Everett
21eaa77ba8 Address ccm-psk-tls1_2 comments
Signed-off-by: Ryan Everett <ryan.everett@arm.com>
2024-05-16 08:12:03 +02:00
Ryan Everett
0855b26a80 Address thread comments
Signed-off-by: Ryan Everett <ryan.everett@arm.com>
2024-05-16 08:12:03 +02:00
Ryan Everett
2abd658030 Address symmetric-only comments
Signed-off-by: Ryan Everett <ryan.everett@arm.com>
2024-05-16 08:12:03 +02:00
Ryan Everett
c3051572ca Address suite-b comments
Signed-off-by: Ryan Everett <ryan.everett@arm.com>
2024-05-16 08:12:03 +02:00
Ryan Everett
44d7ddf82f In suite-b move definition of MBEDTLS_PSA_CRYPTO_CONFIG_FILE
Signed-off-by: Ryan Everett <ryan.everett@arm.com>
2024-05-16 08:12:03 +02:00
Ryan Everett
4540cd3429 Add a crypto config file for suite-b
Also converts legacy symbols into their PSA equivalents.
When PSA is defined this does not change the compiled code

Signed-off-by: Ryan Everett <ryan.everett@arm.com>
2024-05-16 08:12:03 +02:00
Ryan Everett
0a0393e8bd Use crypto config for ccm-psk-dtls1_2.h
Convert legacy symbols to their PSA equivalents.
This does not change code compiled when this config is active with PSA
enabled

Signed-off-by: Ryan Everett <ryan.everett@arm.com>
2024-05-16 08:12:03 +02:00
Ryan Everett
ab5ec9d3a4 Add a crypto config file for ccm-psk-tls1_2.h
Also convert legacy symbols to their PSA equivalents.
This does not change code compiled when this config is active with PSA
enabled

Signed-off-by: Ryan Everett <ryan.everett@arm.com>
2024-05-16 08:12:02 +02:00
Ryan Everett
d3b11571e2 Add a crypto-config file for symmetric-only
Replaces legacy symbols with the PSA equivalents.
This doesn't change the code generated when this config is active

Signed-off-by: Ryan Everett <ryan.everett@arm.com>
2024-05-16 08:12:02 +02:00
Ryan Everett
885ea8db8f Add a crypto config file for config-thread
This file consists of PSA symbols which are defined
if and only if the original config was set

Signed-off-by: Ryan Everett <ryan.everett@arm.com>
2024-05-16 08:12:02 +02:00
Gilles Peskine
bdce65700e
Merge pull request #9067 from gilles-peskine-arm/ssl-opt-server2-detection
Fix skipped tests in configurations without RSA
2024-05-15 12:06:31 +00:00
Thomas Daubney
69ca57eadc Fix typo
Signed-off-by: Thomas Daubney <thomas.daubney@arm.com>
2024-05-14 16:29:23 +01:00
Thomas Daubney
b7c624ddd8 Remove _use_psa suffix from remaining components
Signed-off-by: Thomas Daubney <thomas.daubney@arm.com>
2024-05-14 16:11:00 +01:00
Thomas Daubney
5f2595a018 Remove non- _use_psa versions of components
Signed-off-by: Thomas Daubney <thomas.daubney@arm.com>
2024-05-14 16:09:34 +01:00
Manuel Pégourié-Gonnard
f5761ff26c
Merge pull request #9129 from valeriosetti/update-gitignore
Update gitignore for `test_keys.h`, `test_certs.h` and `.vscode`
2024-05-14 10:15:59 +00:00
Valerio Setti
87d99fbd6c psasim: create a seedfile to be used for the crypto server
This allows to re-enable MBEDTLS_ENTROPY_NV_SEED since the
seedfile is correctly found in the "test" folder at runtime.

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-05-14 10:57:35 +02:00
Valerio Setti
dce6b85af8 psa_ff_client: fix typos and useless blank lines
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-05-14 10:43:14 +02:00
Valerio Setti
f57afd5acd all.sh: improvements
- add quotes to the $@ parameter in helper_crypto_client_build()
- instead of copying mbedtls_config.h to build static libraries,
  we rely on the already existing backup/cleanup mechanism which
  is available in all.sh.

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-05-14 10:39:20 +02:00
Gilles Peskine
fc73aa02b0 Add missing dependency that isn't autodetected
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-05-13 21:18:41 +02:00
Gilles Peskine
f5a30afdae Remove redundant RSA dependency
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-05-13 21:18:28 +02:00
Gilles Peskine
d9c7be775e Explicitly use TLS 1.2 on <=1.2-specific keyUsage/extKeyusage tests
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-05-13 21:17:35 +02:00
Gilles Peskine
f9f3d21a67 Fix PSK invocation: GnuTLS PSK length (more)
Replace more sample PSK by longer (GnuTLS-compatible) strings, taking care
of keeping distinct PSK distinct for wrong-PSK tests.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-05-13 21:06:26 +02:00
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
Valerio Setti
b5ea455d77 gitignore: ignore .vscode folder in main repo
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-05-13 11:38:42 +02:00
Valerio Setti
a621fd9df3 gitignore: ignore test_keys.h and test_certs.h
These files are automatically generated at build time so they
do not need to be tracked.

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-05-13 11:13:36 +02: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
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
Thomas Daubney
67338c050a Restore toggling of MBEDTLS_CIPHER_MODE_CBC
Signed-off-by: Thomas Daubney <thomas.daubney@arm.com>
2024-05-09 15:21:14 +01: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