Skip to content

Conversation

@minosgalanakis
Copy link
Contributor

Description

Part of the work required by Mbed-TLS/mbedtls#10487. Psasim was originally places in framework directory, but moved to mbedtls while we were workign on it. Now this PR is migrating it back, while preserving the history

  • TF-PSA-Crypto PR provided # | not required because:
  • development PR provided # | not required because:
  • 3.6 PR provided # | not required because:

valeriosetti and others added 30 commits May 3, 2024 17:28
This is a temporary fix that will be reverted once the framework
repository will have CI checks.

Signed-off-by: Valerio Setti <[email protected]>
…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 <[email protected]>
…er 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 <[email protected]>
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 <[email protected]>
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 <[email protected]>
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 <[email protected]>
Signed-off-by: Valerio Setti <[email protected]>
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 <[email protected]>
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 <[email protected]>
While at this, fix also Makefile so that "make clean" does not
complain if some of the files to be cancelled do not exist.

Signed-off-by: Valerio Setti <[email protected]>
Not hooked into the build yet

Signed-off-by: Tom Cosgrove <[email protected]>
…or psa_hash_compute()

Still not used

Signed-off-by: Tom Cosgrove <[email protected]>
…ute()

A Perl script that creates them is also included as reference. This is not the
final script (that will be in Python) but a proof-of-concept to show that
creaation client and server wrappers can be scripted.

It is not hooked into the build: it must be run manually. It is not part of the
deliverables for this PR.

Signed-off-by: Tom Cosgrove <[email protected]>
- smoke test client.c becomes a trivial call to psa_crypto_init()
- server.c now uses psa_sim_crypto_server.c's psa_crypto_call()
- Makefile is updated to build all the modules, and allow a different MAIN
- all.sh's test_psasim now tests the simulation of psa_hash_compute() too

Signed-off-by: Tom Cosgrove <[email protected]>
…en they're no longer needed

Signed-off-by: Tom Cosgrove <[email protected]>
Signed-off-by: Tom Cosgrove <[email protected]>
paul-elliott-arm and others added 29 commits November 15, 2024 14:09
Non generated code was unfortnuately added to psa_sim_crypto_server.c,
fix that by adding it to the generation scripts.

Signed-off-by: Paul Elliott <[email protected]>
Signed-off-by: Paul Elliott <[email protected]>
This commit fixes paths for programs/psa to tf-psa-crypto/programs/psa.

Signed-off-by: Harry Ramsey <[email protected]>
This commit refactors comments refering to tf-psa-crypto for the
correct path upon repo split.

Signed-off-by: Harry Ramsey <[email protected]>
This commit also includes regenerated C and H files.

Signed-off-by: Valerio Setti <[email protected]>
This commit also includes regenerated C and H files.

Signed-off-by: Valerio Setti <[email protected]>
[development] md: allow dispatch to PSA whenever CRYPTO_CLIENT is enabled
The README file content dates back to the early stages of PSASIM
development. Since then a lot of things have changed, so the README
file required a complete rewrite.

Signed-off-by: Valerio Setti <[email protected]>
[development] Remove the dynamic SE interface in 4.0
[development] Remove MBEDTLS_PSA_INJECT_ENTROPY
…MINATED_STRING

This macro applies __attribute__((nonstring)) when using a compiler that supports it

Signed-off-by: Felix Conway <[email protected]>
Signed-off-by: Ari Weiler-Ofek <[email protected]>
[Development] Fix GCC 15 warning 'Wunterminated-string-initialization'
This commit was generated using the following command:

sed -i 's/\(^\|[^_]\)common\.h/\1tf_psa_crypto_common.h/g' \
    $(git ls-files .                                       \
        ':!:programs/fuzz'                                 \
        ':!:tests/psa-client-server'                       \
        ':!:tf-psa-crypto'                                 \
        ':!:framework')                                    \
    $(git grep -l 'tf-psa-crypto/core/common.h')

Signed-off-by: Bence Szépkúti <[email protected]>
…erge-public-20250916

mbedtls: : merge public into restricted 2025-09-16
This is required in util.h in PSASIM as it uses fprintf. Previously
stdio was inadvertantly included via psa/crypto_struct.h (of all
places).

Signed-off-by: David Horstmann <[email protected]>
Signed-off-by: Minos Galanakis <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.