mirror of
https://github.com/Mbed-TLS/mbedtls-framework.git
synced 2026-07-26 22:09:06 +00:00
Add rules to generate wrappers during the psasim build
We don't need to check those generated files into version control. This fixes the problem that the generated files have precise knowledge of the functions that exist on whatever branch of TF-PSA-Crypto is consuming the framework. Signed-off-by: Gilles Peskine <[email protected]>
This commit is contained in:
@@ -67,6 +67,23 @@ test/psa_server: $(PSA_SERVER_SRC) $(GENERATED_H_FILES)
|
||||
$(PARTITION_SERVER_BOOTSTRAP) $(GENERATED_H_FILES): src/manifest.json src/server.c
|
||||
tools/psa_autogen.py src/manifest.json
|
||||
|
||||
GENERATED_C_FILES = \
|
||||
src/psa_sim_serialise.h src/psa_sim_serialise.c \
|
||||
src/psa_functions_codes.h src/psa_sim_crypto_client.c src/psa_sim_crypto_server.c
|
||||
|
||||
src/psa_sim_serialise.h: src/psa_sim_serialise.pl
|
||||
cd src && ./psa_sim_serialise.pl h >$(@F)
|
||||
|
||||
src/psa_sim_serialise.c: src/psa_sim_serialise.pl
|
||||
cd src && ./psa_sim_serialise.pl c >$(@F)
|
||||
|
||||
src/psa_functions_codes.h src/psa_sim_crypto_client.c src/psa_sim_crypto_server.c: $(TF_PSA_CRYPTO_PATH)/include/psa/crypto.h
|
||||
src/psa_functions_codes.h src/psa_sim_crypto_client.c src/psa_sim_crypto_server.c: $(TF_PSA_CRYPTO_PATH)/include/psa/crypto_extra.h
|
||||
src/psa_functions_codes.h src/psa_sim_crypto_client.c src/psa_sim_crypto_server.c: src/psa_sim_generate.pl
|
||||
cd $(TF_PSA_CRYPTO_PATH) && $(abspath src/psa_sim_generate.pl)
|
||||
|
||||
generated_files: $(GENERATED_H_FILES) $(PARTITION_SERVER_BOOTSTRAP) $(GENERATED_C_FILES)
|
||||
|
||||
# Build MbedTLS libraries (crypto, x509 and tls) and copy them locally to
|
||||
# build client/server applications.
|
||||
#
|
||||
|
||||
@@ -19,24 +19,3 @@ Please refer to `tests/scripts/components-psasim.sh` for guidance on how to buil
|
||||
|
||||
- `component_test_psasim()`: builds the server and a couple of test clients which are used to evaluate some basic PSA Crypto API commands.
|
||||
- `component_test_suite_with_psasim()`: builds the server and _all_ the usual test suites (those found under the `<mbedtls-root>/tests/suites/*` folder) which are used by the CI and runs them. A small subset of test suites (`test_suite_constant_time_hmac`,`test_suite_lmots`,`test_suite_lms`) are being skipped, for CI turnover time optimization. They can be run locally if required.
|
||||
|
||||
## How to update automatically generated files
|
||||
|
||||
A significant portion of the intermediate code of PSASIM is auto-generated using Perl. In particular:
|
||||
|
||||
- `psa_sim_serialise.[c|h]`:
|
||||
- Generated by `psa_sim_serialise.pl`.
|
||||
- These files provide the serialisation/deserialisation support that is required to pass functions' parameters between client and server.
|
||||
- `psa_sim_crypto_[client|server].c` and `psa_functions_codes.h`:
|
||||
- Generated by `psa_sim_generate.pl`.
|
||||
- `psa_sim_crypto_[client|server].c` provide interfaces for PSA Crypto APIs on client and server sides, while `psa_functions_codes.h` simply enumerates all PSA Crypto APIs.
|
||||
|
||||
These files need to be regenerated whenever some PSA Crypto API is added/deleted/modified. The procedure is as follows:
|
||||
|
||||
- `psa_sim_serialise.[c|h]`:
|
||||
- go to `framework/psasim/src/`
|
||||
- run `./psa_sim_serialise.pl h > psa_sim_serialise.h`
|
||||
- run `./psa_sim_serialise.pl c > psa_sim_serialise.c`
|
||||
- `psa_sim_crypto_[client|server].c` and `psa_functions_codes.h`:
|
||||
- go to the TF-PSA-Crypto root folder
|
||||
- run `framework/psasim/src/psa_sim_generate.pl`
|
||||
|
||||
Reference in New Issue
Block a user