-
Notifications
You must be signed in to change notification settings - Fork 67
Move psasim into framework #238
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
davidhorstmann-arm
merged 235 commits into
Mbed-TLS:main
from
minosgalanakis:rework/move-psasim
Jan 23, 2026
Merged
Changes from all commits
Commits
Show all changes
235 commits
Select commit
Hold shift + click to select a range
3f48668
Update crypto pointer to development-restricted
mpg c13f2ec
Merge pull request #1400 from mpg/ct-gcd-modinv-dev
gilles-peskine-arm 6569cc6
Update framework pointer
felixc-arm 7f60c7d
Merge pull request #1410 from felixc-arm/bignum-update-crypto-gcdinvmod
mpg 73728d5
Make test more robust
mpg aa19698
Merge pull request #1412 from mpg/bypass-wrappers-prelim
mpg a1d6b27
Merge remote-tracking branch 'development' into restricted-mbedtls-me…
gilles-peskine-arm 710869b
Update framework to the merge of main and main-restricted
gilles-peskine-arm 2fe29ab
Update submodules to the merge of the merge PR
gilles-peskine-arm 7ea9f1b
Merge pull request #1426 from gilles-peskine-arm/restricted-mbedtls-m…
gilles-peskine-arm 9314555
Restored changelog entries
minosgalanakis 120914b
Removed entries already in tf-psa-crypto Clog
minosgalanakis 5bb46ef
Moved TLS related changelogs
minosgalanakis f47c865
Moved x509 related changelogs
minosgalanakis a439ac5
moved psa changelogs
minosgalanakis 582cb04
Changelog: Moved fix-clang-psa-build-without-dhm to MbedTLS
minosgalanakis 92a2154
Changelog: Split changelogs for both libraries
minosgalanakis 4b0923f
Changelog: Brought forward changelog changes from #4716308
minosgalanakis 1789bbd
Changelog: Moved entries to tf-psa-psa
minosgalanakis 514375e
Changelog: Brought entries from tf-psa-crypto
minosgalanakis 9b1db5d
Moved entries back to Changelog.d
minosgalanakis 48bfaa9
Changelog: Removed psa migrated entries
minosgalanakis 9364208
Changelogs: Fixed aligment issues
minosgalanakis cc3f987
Changelogs: Added CVEs
minosgalanakis 30f42ed
Changelog: Reworded fix-clang-psa-build-without-dhm
minosgalanakis 8120169
Changelog: Removed check-config.txt
minosgalanakis 55e4bf8
Changelog: Introduced oid.txt
minosgalanakis c8e4fd3
Initial removal of DES from mbedtls
4936b17
Add ChangeLog
c32f591
Improved ChangeLog
c4dee5c
Remove ChangeLog
1317d7f
Remove spurious make command
6c4df1a
Update tf-psa-crypto submodule
db39c0f
Update framework modules
0a49a8b
Merge pull request #10397 from minosgalanakis/debug/restore_changelogs
gilles-peskine-arm 332ad50
Merge pull request #10413 from bjwtaylor/remove-des
mpg 28d1d61
Update BRANCHES.md
ronald-cron-arm 94f102c
Update SECURITY.md
ronald-cron-arm dc0036b
Updated framework pointer
minosgalanakis 0552033
Updated tf-psa-crypto pointer
minosgalanakis d4b6bc7
Merge pull request #10435 from Mbed-TLS/mbedtls-release-sync
gilles-peskine-arm d196cbd
README.md: The crypto code is provided by TF-PSA-Crypto
ronald-cron-arm eef87b3
README.md: Microsoft Visual Studio is not directly supported anymore
ronald-cron-arm 0f2ef4a
README.md: Update Configuration section
ronald-cron-arm 200b89b
README.md: Update/Fix documentation section
ronald-cron-arm 7cf78b4
README.md: Update build sections
ronald-cron-arm 4ccdaf1
README.md: Update minimum version of tools
ronald-cron-arm e2d4684
README.md: Update tests section
ronald-cron-arm c9d79ff
README.md: Various small improvements
ronald-cron-arm c9998d3
README.md: Fix/Update the "Git usage" section
ronald-cron-arm 74a4984
README.md: Fix/Improve CMake section
ronald-cron-arm e943bd7
configs/README.txt: Improve example with MBEDTLS/TF_PSA_CRYPTO_CONFIG…
ronald-cron-arm 8267196
README.md: Add mention to topics.html for Doxygen documentation
ronald-cron-arm b906301
Various minor improvements
ronald-cron-arm 864c31a
README.md: IAR not currently used in our testing
ronald-cron-arm 63180eb
README.md: Adjust CMake minimum version
ronald-cron-arm 91b8310
Remove internal deprecated items
2f13c8c
Merge pull request #10436 from ronald-cron-arm/root-documentation
gilles-peskine-arm 9228e4a
Add repo-split migration guide
ronald-cron-arm a5e1b6d
Rework "CMake as the only build system" section
ronald-cron-arm c764624
Various small changes
ronald-cron-arm d3f02cd
Improve file and directory relocation table
ronald-cron-arm 79a2631
Expand "Configuration file split" section
ronald-cron-arm 5d069c9
Add Make to CMake migration section
ronald-cron-arm 25b1a02
Rework "Impact on some usages of the library" section
ronald-cron-arm de8bb96
Change footnote indication
ronald-cron-arm f37dbf6
Add missing typesettings
ronald-cron-arm 15557d0
Various improvements
ronald-cron-arm dca3b38
Various improvements
ronald-cron-arm 7c39b60
Improve sections "Using Mbed TLS as a CMake subproject/package"
ronald-cron-arm 5394731
Merge pull request #10441 from ronald-cron-arm/migration-guide
gilles-peskine-arm 9fc5910
Remove 3.0 migration guide
gilles-peskine-arm e79923c
Consolidate migration guide chapters into a single file
gilles-peskine-arm 2c0cb99
Add short introduction
gilles-peskine-arm 6671909
Ensure there is a blank line before headers (markdown portability)
gilles-peskine-arm d83c476
Fix copypasta
gilles-peskine-arm 75a36bd
Fix copypasta in title
gilles-peskine-arm fa4e946
Add sentence that was in 3.0 and is in TF-PSA-Crypto 1.0
gilles-peskine-arm ccd9e29
Merge pull request #10446 from gilles-peskine-arm/migration-guide-4.0…
gilles-peskine-arm 0283fa0
Merge remote-tracking branch 'restricted/development-restricted' into…
minosgalanakis ca4a1a1
Merge remote-tracking branch 'mbedtls4.0.0-documentation' into mbedtl…
minosgalanakis 65c29f0
Updated framework submodule
minosgalanakis 3765e5c
Merge pull request #10438 from bjwtaylor/deprecated-functions
gilles-peskine-arm 0ff335d
Remove uses of mbedtls_pk_verify_new
21cd2dd
Updated tf psa-crypto submodule
minosgalanakis e5862c0
Removed Beta Changelog
minosgalanakis 38181b6
Assemble ChangeLog
minosgalanakis 411461a
Doc: Removed references to beta version
minosgalanakis ec40440
ChangeLog: Added CVEs
minosgalanakis 2842c33
Merge tag 'v4.0.0' into mbedtls-4.0.0_mergeback
minosgalanakis b2878ee
Updated tf-psa-crypto pointer
minosgalanakis 58439de
Fix documentation link to submodule that doesn't work on GitHub
gilles-peskine-arm b180696
Merge pull request #10459 from gilles-peskine-arm/fix-doc-submodule-l…
mpg d0881ed
prepare_release.sh: Added psed helper function
minosgalanakis 1f95b78
prepare_release.sh: Limited .gitignore to current project
minosgalanakis d995a21
prepare_release.sh: Adjusted logic
minosgalanakis 0b79666
prepare_release.sh:Removed Makefiles modification
minosgalanakis 61fdef5
prepare_release.sh: Adjusted psed logic.
minosgalanakis c4d4f6b
prepare_release.sh: Removed -r/-u modes
minosgalanakis ffc2606
Use GNUInstallDirs CMAKE_INSTALL_INCLUDEDDIR path for headers install…
Begasus 4624f50
Merge pull request #10449 from bjwtaylor/mbedtls.remove-mbedtls_verif…
valeriosetti 94f1628
Remove dependencies on mbedtls_pk_sign
279dd4a
Remove dependencies on mbedtls_pk_verify
c3e2b37
Remove mbedtls_ssl_write_handshake_msg as it now replaced by mbedtls_…
5e23093
Fix code style issues
cef9d2d
Revert change to mbedtls_pk_{sign,verify}_restartable and replace wit…
2c05672
Tidy up debug of non ext functions
1b32994
Fix style issues
b190c1b
Replace change to restartable with ext
10d471a
Correct debug return
4b4ca81
Corrected debug return
a2de40a
Change the return type of mbedtls_ssl_get_ciphersuite_sig_pk_alg to m…
bc076f9
fix style isses
a5384bd
add cast to fix IAR compiler errors
574aae2
Fix duplication of product version in CMakeLists.txt
gilles-peskine-arm 64e7d4b
format: apply suggestions (add spaces)
Cube707 32b597b
Merge pull request #10469 from Begasus/includedir
minosgalanakis 958d9d9
prepare_release.sh: Added documentation
minosgalanakis bdb1dcb
prepare_release.sh: simplified regex
minosgalanakis a2cba40
prepare_release.sh: modify submodule files recursively
minosgalanakis 4565d5d
Change the call to mbedtls_pk_verify_ext in pkcs7 to have a variable …
0035cfb
Removed unnecessary cast in mbedtls_pk_sign_ext
5f037c7
Rename mbedtls_ssl_pk_alg_from_sig to mbedtls_ssl_pk_alg_from_sig_pk_…
00b04a6
Update mbedtls_pk_sign_ext in x509write_crt.c to use mbedtls_pk_sigal…
f21e63c
Update pk_alg to use mbedtls_pk_sigalg_t and remove casts in library/…
b76c383
Update name of mbedtls_ssl_pk_alg_from_sig_pk_alg to mbedtls_ssl_pk_s…
42074c1
Rename mbedtls_ssl_get_pk_type_and_md_alg_from_sig_alg to mbedtls_ssl…
525dd91
Merge pull request #10477 from Cube707/fix/iar-compiler-warning
valeriosetti ee72a20
Merge pull request #10481 from gilles-peskine-arm/cmake-package-versi…
valeriosetti 284481f
Remove lcov.sh as this will be moved to the framework
9b4f222
Update lcov.sh paths in make files
82a48d4
Update lcov.sh patch to use CMake variable
76899ea
Update framework module
4b8d9d4
Update tf-psa-crypto submodule to include new framework
a35e332
library: debug: remove temporary fixes for RSA key handling
valeriosetti 910bf4b
tests: suite_x509parse: remove temporary fixes
valeriosetti 18f2661
Merge pull request #10491 from valeriosetti/issue10229
gilles-peskine-arm 00d579e
Merge pull request #10439 from bjwtaylor/remove-all-non-ext-apis
valeriosetti 5dae448
Merge pull request #10462 from minosgalanakis/bugfix/update_prepare_r…
ronald-cron-arm 666fa2d
ssl_msg.c: change log level for record checking
JuhaPekkaa 5f4cbcd
ssl_tls12: change log level for ECDH computation
JuhaPekkaa a6e59a9
Merge pull request #10450 from bjwtaylor/move-lcov
mpg 1f2f6fc
framework: update reference
valeriosetti 148bc11
Merge pull request #10498 from valeriosetti/issue435-part2-mbedtls
mpg 3a0868b
Merge pull request #10496 from JuhaPekkaa/juke/change-loglevel
mpg 28f7455
Changelog entry for fix #10502
gilles-peskine-arm 6116d8f
Update framework with fix of Mbed-TLS/mbedtls#10502
gilles-peskine-arm 3057ea0
Merge pull request #10509 from gilles-peskine-arm/config_checks_gener…
valeriosetti caf73f8
library: check_config: remove references to secp192 curves
valeriosetti 65ec4cc
tests: scripts: make enabling of secp192 curves fault tolerant in tes…
valeriosetti caaa938
Merge pull request #10519 from valeriosetti/issue568-mbedtls
davidhorstmann-arm 5ae6c62
tests: x509parse: transition tests based on secp192 curves to secp256
valeriosetti 59c9ebf
ssl: rm useless private includes in public headers
mpg 53c5115
x509: rm useless private include in public header
mpg 4b663ab
ssl: rm useless private includes in internal headers
mpg c53c43c
x509: rm useless private includes in internal headers
mpg eab6d32
ssl: rm useless private include in C file
mpg 411282d
x509: rm useless private include in C file
mpg d6551ea
Add comment about internal crypto include
mpg 3e6455d
Remove useless includes of psa_util_internal
mpg ea57187
Remove two more useless internal includes
mpg 5341c86
Add comments for remaining internal includes
mpg d262352
Merge pull request #10523 from mpg/rm-ecdh
valeriosetti 725e3f1
tests: x509parse: replace certificates using secp192 with those using…
valeriosetti 35d90d1
framework: update reference
valeriosetti d36ed4a
tf-psa-crypto: update reference
valeriosetti 8f66d59
Merge pull request #10522 from valeriosetti/issue568-mbedtls-part2
davidhorstmann-arm 024c3ae
library: ssl: remove duplicate check in ssl_parse_server_key_exchange()
valeriosetti 92926ff
library: common: add helper to get PSA algorithm from PK sigalg
valeriosetti 81a5a09
library: ssl: replace mbedtls_pk_can_do() with mbedtls_pk_can_do_psa()
valeriosetti 9d1fa1a
library: x509: change order of checks in x509_crt_check_signature()
valeriosetti 1de094f
library: x509: replace mbedtls_pk_can_do() with mbedtls_pk_can_do_psa()
valeriosetti 902467d
ssl: replace usage of mbedtls_pk_can_do() with mbedtls_pk_get_key_type()
valeriosetti 9eb5b2a
x509: replace usage of mbedtls_pk_can_do() with mbedtls_pk_get_key_ty…
valeriosetti 8b364c7
Fix the commands to build library
lpy4105 d86c4ae
Fix dependencies in programs/Makefile
lpy4105 e7b035e
Merge pull request #10532 from gilles-peskine-arm/race-condition-in-m…
valeriosetti 1c479f8
Avoid references to ecdh.o
mpg e5ba96c
Merge pull request #10528 from mpg/prep-rm-ecdh
valeriosetti d8f0b37
ssl: replace remaining occurrence of pk_can_do with pk_get_key_type
valeriosetti 5ad2bfa
library: ssl: adjust return type of mbedtls_psa_alg_from_pk_sigalg()
valeriosetti c0ac4a6
library: ssl: specify hash algorithm when checking signature in ssl_p…
valeriosetti abb0b22
Merge pull request #10505 from valeriosetti/issue10453
mpg a733725
tests: remove temporary fix for secp192 curves in test_psa_crypto_wit…
valeriosetti 3b74e0e
tf-psa-crypto: update reference
valeriosetti a7fd88a
framework: update reference
valeriosetti 216c195
Merge pull request #10539 from valeriosetti/issue10518
davidhorstmann-arm 23aad2c
Replace references of mbedtls_ecp_set_max_ops with psa_interruptible_…
27c2284
Re-instate failure when disabling non-existing option
da7aa76
Merge pull request #10549 from bjwtaylor/replace-mbedtls_ecp_set_map_ops
gilles-peskine-arm fe34bc8
Merge pull request #10550 from bjwtaylor/restore-failure
gilles-peskine-arm 262d9ca
Update framework with config_macros.py
gilles-peskine-arm 35821e7
Switch from config_history to config_macros
gilles-peskine-arm 30323af
Read current data rather than data about 4.0
gilles-peskine-arm 1de879c
Also reject internal macros that weren't options in 3.6
gilles-peskine-arm 0e2eb22
New script to check or update config-options-current.txt
gilles-peskine-arm 43784b5
Create the config option list shadow file
gilles-peskine-arm 93ef003
Check that the config option list shadow file is up to date
gilles-peskine-arm b6c30c3
Print a useful message when the file is out of date
gilles-peskine-arm 168c6ec
Improve out-of-date message
gilles-peskine-arm 64ab9a2
Merge pull request #10548 from gilles-peskine-arm/config-checks-gener…
gilles-peskine-arm d0f6b54
Don't call SHA3 selftest when SHA3 is accelerated
gilles-peskine-arm 40b11f5
Remove component_test_sha3_variations
gilles-peskine-arm 4185efa
Fix non-determinism when generating mbedtls_config_check_user.h
gilles-peskine-arm a1502f5
Drop the ability to build the library without the framework
gilles-peskine-arm d13d041
Check for the framework submodule before anything else
gilles-peskine-arm 3884bf3
Remove a XySSL-era comment that has run its course
gilles-peskine-arm f79f401
Fix missing dependencies of test_certs.h
gilles-peskine-arm d78060b
Get a clean run from make --warn-undefined-variables
gilles-peskine-arm a47cc27
Fix mixup in dependencies for generated config checks
gilles-peskine-arm 7bef731
Create a TF-PSA-Crypto make helper for Mbed TLS
gilles-peskine-arm 46568f3
Move some crypto core and drivers variable definitions to crypto-comm…
gilles-peskine-arm e3e4da6
Use intermediate variables for TF-PSA-Crypto's contribution to LOCAL_…
gilles-peskine-arm 2607134
Move configurable variables to the top
gilles-peskine-arm c00bd2a
THREADING autodetection: only check the crypto config
gilles-peskine-arm ef25955
Move THREADING autodetection to crypto-common.make
gilles-peskine-arm d9c6a41
Introduce intermediate variables for various TF-PSA-Crypto lists
gilles-peskine-arm 8ac7168
Move crypto-specific code from library/Makefile to a new file
gilles-peskine-arm cffc118
Move crypto-specific code from programs/Makefile to a new file
gilles-peskine-arm 49d6985
Move crypto-specific code from tests/Makefile to a new file
gilles-peskine-arm 8a528cf
Split the rules to generate config tests
gilles-peskine-arm 5626779
Use intermediate variable for TF-PSA-Crypto's contribution to LOCAL_L…
gilles-peskine-arm b988dd8
Remove accidentally duplicated definitions
gilles-peskine-arm dd25569
Make use of some intermediate variables
gilles-peskine-arm 6250af4
Merge pull request #10554 from gilles-peskine-arm/sha3-cleanup-202512…
gilles-peskine-arm a271e93
Merge pull request #10555 from gilles-peskine-arm/sort-config_check_u…
ronald-cron-arm 67152f3
Merge pull request #10543 from gilles-peskine-arm/split-crypto-makefiles
ronald-cron-arm 68b0ad1
Adapt to the split of test_suite_shax
gilles-peskine-arm 0294b11
Merge pull request #10556 from gilles-peskine-arm/sha3-cleanup-202512…
valeriosetti bf38106
psasim: Moved to psasim_deprecated
minosgalanakis d982361
Moved tests/psa-client-server to framework.
minosgalanakis daee5e1
Merge branch 'tmp-branch-move-files-to-framework' into move-files-int…
minosgalanakis fc4689b
Removed old psasim dir
minosgalanakis 7f6ad7c
psasim: Update location in Makefile and all-core.sh
minosgalanakis f51cf54
all-core.sh: Allow overriding of the psa-sim location
minosgalanakis File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,64 +1,81 @@ | ||
| CFLAGS ?= -Wall -std=c99 | ||
| INCLUDE := -I./include/ | ||
| DESTDIR ?= /usr/local | ||
| PREFIX := libpsaff | ||
| BUILDDIR ?= bin | ||
| CFLAGS += -Wall -Werror -std=c99 -D_XOPEN_SOURCE=1 -D_POSIX_C_SOURCE=200809L | ||
|
|
||
| .PHONY: all install test uninstall run docker ci | ||
| ifeq ($(DEBUG),1) | ||
| override CFLAGS += -DDEBUG -O0 -g | ||
| endif | ||
|
|
||
| all: libpsaff.so | ||
| CLIENT_LIBS := -Lclient_libs -lpsaclient -lmbedtls -lmbedx509 -lmbedcrypto | ||
| SERVER_LIBS := -Lserver_libs -lmbedcrypto | ||
|
|
||
| libpsaff.so: | ||
| $(CC) $(INCLUDE) $(CFLAGS) -c -fpic src/common.c -o common.o | ||
| $(CC) $(INCLUDE) $(CFLAGS) -c -fpic src/client.c -o client.o | ||
| $(CC) $(INCLUDE) $(CFLAGS) -c -fpic src/service.c -o server.o | ||
| $(CC) -shared -o libpsaff.so common.o client.o server.o | ||
| MBEDTLS_ROOT_PATH = ../.. | ||
| COMMON_INCLUDE := -I./include -I$(MBEDTLS_ROOT_PATH)/include \ | ||
| -I$(MBEDTLS_ROOT_PATH)/tf-psa-crypto/include \ | ||
| -I$(MBEDTLS_ROOT_PATH)/tf-psa-crypto/drivers/builtin/include | ||
|
|
||
| ifeq ($(DEBUG),1) | ||
| CFLAGS += -DDEBUG -g | ||
| endif | ||
| GENERATED_H_FILES = include/psa_manifest/manifest.h \ | ||
| include/psa_manifest/pid.h \ | ||
| include/psa_manifest/sid.h | ||
|
|
||
| LIBPSACLIENT_SRC = src/psa_ff_client.c \ | ||
| src/psa_sim_crypto_client.c \ | ||
| src/psa_sim_serialise.c | ||
| LIBPSACLIENT_OBJS=$(LIBPSACLIENT_SRC:.c=.o) | ||
|
|
||
| PSA_CLIENT_BASE_SRC = $(LIBPSACLIENT_SRC) src/client.c | ||
|
|
||
| PSA_CLIENT_FULL_SRC = $(LIBPSACLIENT_SRC) \ | ||
| $(wildcard src/aut_*.c) | ||
|
|
||
| PARTITION_SERVER_BOOTSTRAP = src/psa_ff_bootstrap_TEST_PARTITION.c | ||
|
|
||
| PSA_SERVER_SRC = $(PARTITION_SERVER_BOOTSTRAP) \ | ||
| src/psa_ff_server.c \ | ||
| src/psa_sim_crypto_server.c \ | ||
| src/psa_sim_serialise.c | ||
|
|
||
| .PHONY: all clean client_libs server_libs | ||
|
|
||
| all: | ||
|
|
||
| test/seedfile: | ||
| dd if=/dev/urandom of=./test/seedfile bs=64 count=1 | ||
|
|
||
| src/%.o: src/%.c $(GENERATED_H_FILES) | ||
| $(CC) $(COMMON_INCLUDE) $(CFLAGS) -c $< $(LDFLAGS) -o $@ | ||
|
|
||
| client_libs/libpsaclient: $(LIBPSACLIENT_OBJS) | ||
| mkdir -p client_libs | ||
| $(AR) -src client_libs/libpsaclient.a $(LIBPSACLIENT_OBJS) | ||
|
|
||
| test/psa_client_base: $(PSA_CLIENT_BASE_SRC) $(GENERATED_H_FILES) test/seedfile | ||
| $(CC) $(COMMON_INCLUDE) $(CFLAGS) $(PSA_CLIENT_BASE_SRC) $(CLIENT_LIBS) $(LDFLAGS) -o $@ | ||
|
|
||
| test/psa_client_full: $(PSA_CLIENT_FULL_SRC) $(GENERATED_H_FILES) test/seedfile | ||
| $(CC) $(COMMON_INCLUDE) $(CFLAGS) $(PSA_CLIENT_FULL_SRC) $(CLIENT_LIBS) $(LDFLAGS) -o $@ | ||
|
|
||
| test/psa_server: $(PSA_SERVER_SRC) $(GENERATED_H_FILES) | ||
| $(CC) $(COMMON_INCLUDE) $(CFLAGS) $(PSA_SERVER_SRC) $(SERVER_LIBS) $(LDFLAGS) -o $@ | ||
|
|
||
| $(PARTITION_SERVER_BOOTSTRAP) $(GENERATED_H_FILES): src/manifest.json src/server.c | ||
| tools/psa_autogen.py src/manifest.json | ||
|
|
||
| # Build MbedTLS libraries (crypto, x509 and tls) and copy them locally to | ||
| # build client/server applications. | ||
| # | ||
| # Note: these rules assume that mbedtls_config.h is already configured by all.sh. | ||
| # If not using all.sh then the user must do it manually. | ||
| client_libs: client_libs/libpsaclient | ||
| client_libs server_libs: | ||
| $(MAKE) -C $(MBEDTLS_ROOT_PATH)/library CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" libmbedcrypto.a libmbedx509.a libmbedtls.a | ||
| mkdir -p $@ | ||
| cp $(MBEDTLS_ROOT_PATH)/library/libmbed*.a $@/ | ||
|
|
||
| clean: | ||
| rm -rf $(BUILDDIR) | ||
| rm -f *.so *.o | ||
| rm -rf test/*dSYM | ||
| cd test && make clean | ||
|
|
||
| test: | ||
| cd test && make | ||
|
|
||
| test/partition: | ||
| cd test && make | ||
|
|
||
| run: test/partition | ||
| pkill partition || true | ||
| pkill client || true | ||
| ipcs | grep q | awk '{ printf " -q " $$2 }' | xargs ipcrm > /dev/null 2>&1 || true | ||
| (sleep 3 && ./test/client)& | ||
| ./test/partition | ||
|
|
||
| ci: | ||
| pkill client || true | ||
| ipcs | grep q | awk '{ printf " -q " $$2 }' | xargs ipcrm > /dev/null 2>&1 || true | ||
| ./test/partition 2>&1 & | ||
| sleep 3 && ./test/client | ||
| pkill partition || true | ||
|
|
||
| docker: | ||
| @docker run --rm -ti -v $$PWD:/opt --entrypoint /bin/bash ubuntu \ | ||
| -c "cd /opt && ls && apt-get update -qq && apt install \ | ||
| -y gcc make gdb python -qq && make clean && make install && make test && ldconfig && make run" | ||
|
|
||
| install: libpsaff.so | ||
| mkdir -p $(DESTDIR)/lib | ||
| mkdir -p $(DESTDIR)/include | ||
| cp libpsaff.so $(DESTDIR)/lib/ | ||
| cp -r include/* $(DESTDIR)/include/ | ||
| cp tools/psa_autogen /usr/local/bin/ | ||
|
|
||
| uninstall: | ||
| rm $(DESTDIR)/lib/libpsaff.so | ||
| rm -rf $(DESTDIR)/include/psa | ||
| rm -rf $(DESTDIR)/include/psasim | ||
| rm -f /usr/local/bin/psa_autogen | ||
| clean_server_intermediate_files: | ||
| rm -f $(PARTITION_SERVER_BOOTSTRAP) | ||
| rm -rf include/psa_manifest | ||
|
|
||
| clean: clean_server_intermediate_files | ||
| rm -f test/psa_client_base test/psa_client_full test/psa_server | ||
| rm -rf client_libs server_libs | ||
| rm -f test/psa_service_* test/psa_notify_* test/*.log | ||
| rm -f test/seedfile |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,60 +1,42 @@ | ||
| # psasim | ||
|
|
||
| This tool simulates a PSA Firmware Framework implementation. | ||
| It allows you to develop secure partitions and their clients on a desktop computer. | ||
| It should be able to run on all systems that support POSIX and System V IPC: | ||
| e.g. macOS, Linux, FreeBSD, and perhaps Windows 10 WSL2. | ||
| PSASIM holds necessary C source and header files which allows to test Mbed TLS in a "pure crypto client" scenario, i.e `MBEDTLS_PSA_CRYPTO_CLIENT && !MBEDTLS_PSA_CRYPTO_C`. | ||
| In practical terms it means that this allow to build PSASIM with Mbed TLS sources and get 2 Linux applications, a client and a server, which are connected through Linux's shared memeory, and in which the client relies on the server to perform all PSA Crypto operations. | ||
|
|
||
| Please note that the code in this directory is maintained by the Mbed TLS / PSA Crypto project solely for the purpose of testing the use of Mbed TLS with client/service separation. We do not recommend using this code for any other purpose. In particular: | ||
| The goal of PSASIM is _not_ to provide a ready-to-use solution for anyone looking to implement the pure crypto client structure (see [Limitations](#limitations) for details), but to provide an example of TF-PSA-Crypto RPC (Remote Procedure Call) implementation using Mbed TLS. | ||
| ## Limitations | ||
|
|
||
| * This simulator is not intended to pass or demonstrate compliance. | ||
| * This code is only intended for simulation and does not have any security goals. It does not isolate services from clients. | ||
| In the current implementation: | ||
|
|
||
| ## Building | ||
| - Only Linux PC is supported. | ||
| - There can be only 1 client connected to 1 server. | ||
| - Shared memory is the only communication medium allowed. Others can be implemented (ex: net sockets), but in terms of simulation speed shared memory proved to be the fastest. | ||
| - Server is not secure at all: keys and operation structs are stored on the RAM, so they can easily be dumped. | ||
|
|
||
| To build and run the test program make sure you have `make`, `python` and a | ||
| C compiler installed and then enter the following commands: | ||
| ## Testing | ||
|
|
||
| ```sh | ||
| make install | ||
| make run | ||
| ``` | ||
| Please refer to `tests/scripts/components-psasim.sh` for guidance on how to build & test PSASIM: | ||
|
|
||
| On Linux you may need to run `ldconfig` to ensure the library is properly installed. | ||
| - `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. | ||
|
|
||
| An example pair of programs is included in the `test` directory. | ||
| ## How to update automatically generated files | ||
|
|
||
| ## Features | ||
| A significant portion of the intermediate code of PSASIM is auto-generated using Perl. In particular: | ||
|
|
||
| The implemented API is intended to be compliant with PSA-FF 1.0.0 with the exception of a couple of things that are a work in progress: | ||
| - `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. | ||
|
|
||
| * `psa_notify` support | ||
| * "strict" policy in manifest | ||
| These files need to be regenerated whenever some PSA Crypto API is added/deleted/modified. The procedure is as follows: | ||
|
|
||
| The only supported "interrupts" are POSIX signals, which act | ||
| as a "virtual interrupt". | ||
|
|
||
| The standard PSA RoT APIs are not included (e.g. cryptography, attestation, lifecycle etc). | ||
|
|
||
| ## Design | ||
|
|
||
| The code is designed to be readable rather than fast or secure. | ||
| In this implementation only one message is delivered to a | ||
| RoT service at a time. | ||
| The code is not thread-safe. | ||
|
|
||
| To debug the simulator enable the debug flag: | ||
|
|
||
| ```sh | ||
| make DEBUG=1 install | ||
| ``` | ||
|
|
||
| ## Unsupported features | ||
|
|
||
| Because this is a simulator there are a few things that | ||
| can't be reasonably emulated: | ||
|
|
||
| * Manifest MMIO regions are unsupported | ||
| * Manifest priority field is ignored | ||
| * Partition IDs are in fact POSIX `pid_t`, which are only assigned at runtime, | ||
| making it infeasible to populate pid.h with correct values. | ||
| - `psa_sim_serialise.[c|h]`: | ||
| - go to `<mbedtls-root>/tests/psa-client-server/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 Mbed TLS' root folder | ||
| - run `./tests/psa-client-server/psasim/src/psa_sim_generate.pl` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| /* Common definitions used for clients and services */ | ||
|
|
||
| /* | ||
| * Copyright The Mbed TLS Contributors | ||
| * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later | ||
| */ | ||
|
|
||
| #ifndef _COMMON_H_ | ||
| #define _COMMON_H_ | ||
|
|
||
| #include <stdint.h> | ||
| #include <stddef.h> | ||
|
|
||
| /* Increasing this might break on some platforms */ | ||
| #define MAX_FRAGMENT_SIZE 200 | ||
|
|
||
| #define CONNECT_REQUEST 1 | ||
| #define CALL_REQUEST 2 | ||
| #define CLOSE_REQUEST 3 | ||
| #define VERSION_REQUEST 4 | ||
| #define READ_REQUEST 5 | ||
| #define READ_RESPONSE 6 | ||
| #define WRITE_REQUEST 7 | ||
| #define WRITE_RESPONSE 8 | ||
| #define SKIP_REQUEST 9 | ||
| #define PSA_REPLY 10 | ||
|
|
||
| #define NON_SECURE (1 << 30) | ||
|
|
||
| typedef int32_t psa_handle_t; | ||
|
|
||
| #define PSA_MAX_IOVEC (4u) | ||
|
|
||
| #define PSA_IPC_CALL (0) | ||
|
|
||
| struct message_text { | ||
| int qid; | ||
| int32_t psa_type; | ||
| char buf[MAX_FRAGMENT_SIZE]; | ||
| }; | ||
|
|
||
| struct message { | ||
| long message_type; | ||
| struct message_text message_text; | ||
| }; | ||
|
|
||
| typedef struct vector_sizes { | ||
| size_t invec_sizes[PSA_MAX_IOVEC]; | ||
| size_t outvec_sizes[PSA_MAX_IOVEC]; | ||
| } vector_sizes_t; | ||
|
|
||
| #endif /* _COMMON_H_ */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| /* PSA status codes used by psasim. */ | ||
|
|
||
| /* | ||
| * Copyright The Mbed TLS Contributors | ||
| * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later | ||
| */ | ||
|
|
||
| #ifndef PSA_ERROR_H | ||
| #define PSA_ERROR_H | ||
|
|
||
| #include <stdint.h> | ||
|
|
||
| #include "common.h" | ||
|
|
||
| #define PSA_ERROR_PROGRAMMER_ERROR ((psa_status_t) -129) | ||
| #define PSA_ERROR_CONNECTION_REFUSED ((psa_status_t) -130) | ||
| #define PSA_ERROR_CONNECTION_BUSY ((psa_status_t) -131) | ||
|
|
||
| #endif |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use
mbedtls-move-to-frameworkinstead of importing a rewritten history. With a rewritten history, we don't get the same commits.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately this particular move is outside of the script's capabilities for the following reasons:
The git tool that solves all of the above issues is git-filter-repo that will basically purge the git history of the not kept files and only maintain the commits that touch the files that we want. This is how this pr was created.
In the merge commit 101363b I have added a comment that explains on how to reproduce the merge, but I was unware of how hard github makes it to see that comment when reviewing.
I am attaching the commit message
I think restructuring the script is outside of the scope of this pr.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did see your comment. It was impossible to understand the PR on GitHub, so I looked at it locally to understand where the merge commits were coming from.
If the script doesn't work due to specificities of the history of psasim, we should do the relevant part manually. Specifically, I want to preserve the commit history — not write a new history with the same messages and (partial) diffs but different commits.