Skip to content
Merged
Show file tree
Hide file tree
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 Jul 29, 2025
c13f2ec
Merge pull request #1400 from mpg/ct-gcd-modinv-dev
gilles-peskine-arm Jul 29, 2025
6569cc6
Update framework pointer
felixc-arm Aug 11, 2025
7f60c7d
Merge pull request #1410 from felixc-arm/bignum-update-crypto-gcdinvmod
mpg Aug 11, 2025
73728d5
Make test more robust
mpg Aug 14, 2025
aa19698
Merge pull request #1412 from mpg/bypass-wrappers-prelim
mpg Aug 26, 2025
a1d6b27
Merge remote-tracking branch 'development' into restricted-mbedtls-me…
gilles-peskine-arm Sep 16, 2025
710869b
Update framework to the merge of main and main-restricted
gilles-peskine-arm Sep 16, 2025
2fe29ab
Update submodules to the merge of the merge PR
gilles-peskine-arm Sep 17, 2025
7ea9f1b
Merge pull request #1426 from gilles-peskine-arm/restricted-mbedtls-m…
gilles-peskine-arm Sep 17, 2025
9314555
Restored changelog entries
minosgalanakis Sep 9, 2025
120914b
Removed entries already in tf-psa-crypto Clog
minosgalanakis Sep 11, 2025
5bb46ef
Moved TLS related changelogs
minosgalanakis Sep 10, 2025
f47c865
Moved x509 related changelogs
minosgalanakis Sep 10, 2025
a439ac5
moved psa changelogs
minosgalanakis Sep 10, 2025
582cb04
Changelog: Moved fix-clang-psa-build-without-dhm to MbedTLS
minosgalanakis Sep 25, 2025
92a2154
Changelog: Split changelogs for both libraries
minosgalanakis Sep 25, 2025
4b0923f
Changelog: Brought forward changelog changes from #4716308
minosgalanakis Sep 25, 2025
1789bbd
Changelog: Moved entries to tf-psa-psa
minosgalanakis Sep 25, 2025
514375e
Changelog: Brought entries from tf-psa-crypto
minosgalanakis Sep 25, 2025
9b1db5d
Moved entries back to Changelog.d
minosgalanakis Sep 25, 2025
48bfaa9
Changelog: Removed psa migrated entries
minosgalanakis Sep 26, 2025
9364208
Changelogs: Fixed aligment issues
minosgalanakis Sep 29, 2025
cc3f987
Changelogs: Added CVEs
minosgalanakis Sep 29, 2025
30f42ed
Changelog: Reworded fix-clang-psa-build-without-dhm
minosgalanakis Sep 29, 2025
8120169
Changelog: Removed check-config.txt
minosgalanakis Sep 29, 2025
55e4bf8
Changelog: Introduced oid.txt
minosgalanakis Sep 29, 2025
c8e4fd3
Initial removal of DES from mbedtls
Sep 22, 2025
4936b17
Add ChangeLog
Sep 25, 2025
c32f591
Improved ChangeLog
Sep 26, 2025
c4dee5c
Remove ChangeLog
Sep 29, 2025
1317d7f
Remove spurious make command
Sep 29, 2025
6c4df1a
Update tf-psa-crypto submodule
Sep 30, 2025
db39c0f
Update framework modules
Sep 30, 2025
0a49a8b
Merge pull request #10397 from minosgalanakis/debug/restore_changelogs
gilles-peskine-arm Sep 30, 2025
332ad50
Merge pull request #10413 from bjwtaylor/remove-des
mpg Oct 1, 2025
28d1d61
Update BRANCHES.md
ronald-cron-arm Sep 30, 2025
94f102c
Update SECURITY.md
ronald-cron-arm Sep 30, 2025
dc0036b
Updated framework pointer
minosgalanakis Oct 1, 2025
0552033
Updated tf-psa-crypto pointer
minosgalanakis Oct 1, 2025
d4b6bc7
Merge pull request #10435 from Mbed-TLS/mbedtls-release-sync
gilles-peskine-arm Oct 1, 2025
d196cbd
README.md: The crypto code is provided by TF-PSA-Crypto
ronald-cron-arm Sep 30, 2025
eef87b3
README.md: Microsoft Visual Studio is not directly supported anymore
ronald-cron-arm Sep 30, 2025
0f2ef4a
README.md: Update Configuration section
ronald-cron-arm Sep 30, 2025
200b89b
README.md: Update/Fix documentation section
ronald-cron-arm Oct 1, 2025
7cf78b4
README.md: Update build sections
ronald-cron-arm Oct 1, 2025
4ccdaf1
README.md: Update minimum version of tools
ronald-cron-arm Oct 1, 2025
e2d4684
README.md: Update tests section
ronald-cron-arm Oct 1, 2025
c9d79ff
README.md: Various small improvements
ronald-cron-arm Oct 2, 2025
c9998d3
README.md: Fix/Update the "Git usage" section
ronald-cron-arm Oct 3, 2025
74a4984
README.md: Fix/Improve CMake section
ronald-cron-arm Oct 3, 2025
e943bd7
configs/README.txt: Improve example with MBEDTLS/TF_PSA_CRYPTO_CONFIG…
ronald-cron-arm Oct 5, 2025
8267196
README.md: Add mention to topics.html for Doxygen documentation
ronald-cron-arm Oct 5, 2025
b906301
Various minor improvements
ronald-cron-arm Oct 5, 2025
864c31a
README.md: IAR not currently used in our testing
ronald-cron-arm Oct 5, 2025
63180eb
README.md: Adjust CMake minimum version
ronald-cron-arm Oct 5, 2025
91b8310
Remove internal deprecated items
Oct 7, 2025
2f13c8c
Merge pull request #10436 from ronald-cron-arm/root-documentation
gilles-peskine-arm Oct 7, 2025
9228e4a
Add repo-split migration guide
ronald-cron-arm Oct 5, 2025
a5e1b6d
Rework "CMake as the only build system" section
ronald-cron-arm Oct 8, 2025
c764624
Various small changes
ronald-cron-arm Oct 8, 2025
d3f02cd
Improve file and directory relocation table
ronald-cron-arm Oct 8, 2025
79a2631
Expand "Configuration file split" section
ronald-cron-arm Oct 8, 2025
5d069c9
Add Make to CMake migration section
ronald-cron-arm Oct 8, 2025
25b1a02
Rework "Impact on some usages of the library" section
ronald-cron-arm Oct 8, 2025
de8bb96
Change footnote indication
ronald-cron-arm Oct 9, 2025
f37dbf6
Add missing typesettings
ronald-cron-arm Oct 9, 2025
15557d0
Various improvements
ronald-cron-arm Oct 9, 2025
dca3b38
Various improvements
ronald-cron-arm Oct 9, 2025
7c39b60
Improve sections "Using Mbed TLS as a CMake subproject/package"
ronald-cron-arm Oct 9, 2025
5394731
Merge pull request #10441 from ronald-cron-arm/migration-guide
gilles-peskine-arm Oct 9, 2025
9fc5910
Remove 3.0 migration guide
gilles-peskine-arm Oct 10, 2025
e79923c
Consolidate migration guide chapters into a single file
gilles-peskine-arm Oct 10, 2025
2c0cb99
Add short introduction
gilles-peskine-arm Oct 10, 2025
6671909
Ensure there is a blank line before headers (markdown portability)
gilles-peskine-arm Oct 10, 2025
d83c476
Fix copypasta
gilles-peskine-arm Oct 10, 2025
75a36bd
Fix copypasta in title
gilles-peskine-arm Oct 10, 2025
fa4e946
Add sentence that was in 3.0 and is in TF-PSA-Crypto 1.0
gilles-peskine-arm Oct 10, 2025
ccd9e29
Merge pull request #10446 from gilles-peskine-arm/migration-guide-4.0…
gilles-peskine-arm Oct 11, 2025
0283fa0
Merge remote-tracking branch 'restricted/development-restricted' into…
minosgalanakis Oct 11, 2025
ca4a1a1
Merge remote-tracking branch 'mbedtls4.0.0-documentation' into mbedtl…
minosgalanakis Oct 11, 2025
65c29f0
Updated framework submodule
minosgalanakis Oct 11, 2025
3765e5c
Merge pull request #10438 from bjwtaylor/deprecated-functions
gilles-peskine-arm Oct 13, 2025
0ff335d
Remove uses of mbedtls_pk_verify_new
Oct 13, 2025
21cd2dd
Updated tf psa-crypto submodule
minosgalanakis Oct 11, 2025
e5862c0
Removed Beta Changelog
minosgalanakis Oct 11, 2025
38181b6
Assemble ChangeLog
minosgalanakis Oct 11, 2025
411461a
Doc: Removed references to beta version
minosgalanakis Oct 11, 2025
ec40440
ChangeLog: Added CVEs
minosgalanakis Oct 13, 2025
2842c33
Merge tag 'v4.0.0' into mbedtls-4.0.0_mergeback
minosgalanakis Oct 15, 2025
b2878ee
Updated tf-psa-crypto pointer
minosgalanakis Oct 15, 2025
58439de
Fix documentation link to submodule that doesn't work on GitHub
gilles-peskine-arm Oct 16, 2025
b180696
Merge pull request #10459 from gilles-peskine-arm/fix-doc-submodule-l…
mpg Oct 17, 2025
d0881ed
prepare_release.sh: Added psed helper function
minosgalanakis Oct 20, 2025
1f95b78
prepare_release.sh: Limited .gitignore to current project
minosgalanakis Oct 20, 2025
d995a21
prepare_release.sh: Adjusted logic
minosgalanakis Oct 20, 2025
0b79666
prepare_release.sh:Removed Makefiles modification
minosgalanakis Oct 21, 2025
61fdef5
prepare_release.sh: Adjusted psed logic.
minosgalanakis Oct 22, 2025
c4d4f6b
prepare_release.sh: Removed -r/-u modes
minosgalanakis Oct 22, 2025
ffc2606
Use GNUInstallDirs CMAKE_INSTALL_INCLUDEDDIR path for headers install…
Begasus Oct 23, 2025
4624f50
Merge pull request #10449 from bjwtaylor/mbedtls.remove-mbedtls_verif…
valeriosetti Oct 24, 2025
94f1628
Remove dependencies on mbedtls_pk_sign
Oct 2, 2025
279dd4a
Remove dependencies on mbedtls_pk_verify
Oct 2, 2025
c3e2b37
Remove mbedtls_ssl_write_handshake_msg as it now replaced by mbedtls_…
Oct 2, 2025
5e23093
Fix code style issues
Oct 2, 2025
cef9d2d
Revert change to mbedtls_pk_{sign,verify}_restartable and replace wit…
Oct 13, 2025
2c05672
Tidy up debug of non ext functions
Oct 13, 2025
1b32994
Fix style issues
Oct 13, 2025
b190c1b
Replace change to restartable with ext
Oct 21, 2025
10d471a
Correct debug return
Oct 21, 2025
4b4ca81
Corrected debug return
Oct 21, 2025
a2de40a
Change the return type of mbedtls_ssl_get_ciphersuite_sig_pk_alg to m…
Oct 21, 2025
bc076f9
fix style isses
Oct 21, 2025
a5384bd
add cast to fix IAR compiler errors
Oct 28, 2025
574aae2
Fix duplication of product version in CMakeLists.txt
gilles-peskine-arm Oct 29, 2025
64e7d4b
format: apply suggestions (add spaces)
Cube707 Oct 29, 2025
32b597b
Merge pull request #10469 from Begasus/includedir
minosgalanakis Oct 29, 2025
958d9d9
prepare_release.sh: Added documentation
minosgalanakis Oct 29, 2025
bdb1dcb
prepare_release.sh: simplified regex
minosgalanakis Oct 29, 2025
a2cba40
prepare_release.sh: modify submodule files recursively
minosgalanakis Oct 30, 2025
4565d5d
Change the call to mbedtls_pk_verify_ext in pkcs7 to have a variable …
Oct 30, 2025
0035cfb
Removed unnecessary cast in mbedtls_pk_sign_ext
Oct 30, 2025
5f037c7
Rename mbedtls_ssl_pk_alg_from_sig to mbedtls_ssl_pk_alg_from_sig_pk_…
Oct 30, 2025
00b04a6
Update mbedtls_pk_sign_ext in x509write_crt.c to use mbedtls_pk_sigal…
Oct 30, 2025
f21e63c
Update pk_alg to use mbedtls_pk_sigalg_t and remove casts in library/…
Oct 30, 2025
b76c383
Update name of mbedtls_ssl_pk_alg_from_sig_pk_alg to mbedtls_ssl_pk_s…
Oct 31, 2025
42074c1
Rename mbedtls_ssl_get_pk_type_and_md_alg_from_sig_alg to mbedtls_ssl…
Oct 31, 2025
525dd91
Merge pull request #10477 from Cube707/fix/iar-compiler-warning
valeriosetti Oct 31, 2025
ee72a20
Merge pull request #10481 from gilles-peskine-arm/cmake-package-versi…
valeriosetti Oct 31, 2025
284481f
Remove lcov.sh as this will be moved to the framework
Oct 14, 2025
9b4f222
Update lcov.sh paths in make files
Oct 17, 2025
82a48d4
Update lcov.sh patch to use CMake variable
Oct 21, 2025
76899ea
Update framework module
Oct 24, 2025
4b8d9d4
Update tf-psa-crypto submodule to include new framework
Oct 31, 2025
a35e332
library: debug: remove temporary fixes for RSA key handling
valeriosetti Nov 3, 2025
910bf4b
tests: suite_x509parse: remove temporary fixes
valeriosetti Nov 3, 2025
18f2661
Merge pull request #10491 from valeriosetti/issue10229
gilles-peskine-arm Nov 4, 2025
00d579e
Merge pull request #10439 from bjwtaylor/remove-all-non-ext-apis
valeriosetti Nov 4, 2025
5dae448
Merge pull request #10462 from minosgalanakis/bugfix/update_prepare_r…
ronald-cron-arm Nov 4, 2025
666fa2d
ssl_msg.c: change log level for record checking
JuhaPekkaa Nov 5, 2025
5f4cbcd
ssl_tls12: change log level for ECDH computation
JuhaPekkaa Nov 5, 2025
a6e59a9
Merge pull request #10450 from bjwtaylor/move-lcov
mpg Nov 6, 2025
1f2f6fc
framework: update reference
valeriosetti Nov 6, 2025
148bc11
Merge pull request #10498 from valeriosetti/issue435-part2-mbedtls
mpg Nov 12, 2025
3a0868b
Merge pull request #10496 from JuhaPekkaa/juke/change-loglevel
mpg Nov 12, 2025
28f7455
Changelog entry for fix #10502
gilles-peskine-arm Nov 14, 2025
6116d8f
Update framework with fix of Mbed-TLS/mbedtls#10502
gilles-peskine-arm Nov 20, 2025
3057ea0
Merge pull request #10509 from gilles-peskine-arm/config_checks_gener…
valeriosetti Nov 20, 2025
caf73f8
library: check_config: remove references to secp192 curves
valeriosetti Nov 20, 2025
65ec4cc
tests: scripts: make enabling of secp192 curves fault tolerant in tes…
valeriosetti Nov 20, 2025
caaa938
Merge pull request #10519 from valeriosetti/issue568-mbedtls
davidhorstmann-arm Nov 24, 2025
5ae6c62
tests: x509parse: transition tests based on secp192 curves to secp256
valeriosetti Nov 27, 2025
59c9ebf
ssl: rm useless private includes in public headers
mpg Dec 1, 2025
53c5115
x509: rm useless private include in public header
mpg Dec 1, 2025
4b663ab
ssl: rm useless private includes in internal headers
mpg Dec 1, 2025
c53c43c
x509: rm useless private includes in internal headers
mpg Dec 1, 2025
eab6d32
ssl: rm useless private include in C file
mpg Dec 1, 2025
411282d
x509: rm useless private include in C file
mpg Dec 1, 2025
d6551ea
Add comment about internal crypto include
mpg Dec 1, 2025
3e6455d
Remove useless includes of psa_util_internal
mpg Dec 2, 2025
ea57187
Remove two more useless internal includes
mpg Dec 2, 2025
5341c86
Add comments for remaining internal includes
mpg Dec 2, 2025
d262352
Merge pull request #10523 from mpg/rm-ecdh
valeriosetti Dec 2, 2025
725e3f1
tests: x509parse: replace certificates using secp192 with those using…
valeriosetti Nov 28, 2025
35d90d1
framework: update reference
valeriosetti Nov 28, 2025
d36ed4a
tf-psa-crypto: update reference
valeriosetti Dec 1, 2025
8f66d59
Merge pull request #10522 from valeriosetti/issue568-mbedtls-part2
davidhorstmann-arm Dec 3, 2025
024c3ae
library: ssl: remove duplicate check in ssl_parse_server_key_exchange()
valeriosetti Nov 12, 2025
92926ff
library: common: add helper to get PSA algorithm from PK sigalg
valeriosetti Nov 12, 2025
81a5a09
library: ssl: replace mbedtls_pk_can_do() with mbedtls_pk_can_do_psa()
valeriosetti Nov 12, 2025
9d1fa1a
library: x509: change order of checks in x509_crt_check_signature()
valeriosetti Nov 12, 2025
1de094f
library: x509: replace mbedtls_pk_can_do() with mbedtls_pk_can_do_psa()
valeriosetti Nov 12, 2025
902467d
ssl: replace usage of mbedtls_pk_can_do() with mbedtls_pk_get_key_type()
valeriosetti Dec 2, 2025
9eb5b2a
x509: replace usage of mbedtls_pk_can_do() with mbedtls_pk_get_key_ty…
valeriosetti Dec 2, 2025
8b364c7
Fix the commands to build library
lpy4105 Sep 25, 2023
d86c4ae
Fix dependencies in programs/Makefile
lpy4105 Sep 25, 2023
e7b035e
Merge pull request #10532 from gilles-peskine-arm/race-condition-in-m…
valeriosetti Dec 4, 2025
1c479f8
Avoid references to ecdh.o
mpg Dec 4, 2025
e5ba96c
Merge pull request #10528 from mpg/prep-rm-ecdh
valeriosetti Dec 5, 2025
d8f0b37
ssl: replace remaining occurrence of pk_can_do with pk_get_key_type
valeriosetti Dec 5, 2025
5ad2bfa
library: ssl: adjust return type of mbedtls_psa_alg_from_pk_sigalg()
valeriosetti Dec 9, 2025
c0ac4a6
library: ssl: specify hash algorithm when checking signature in ssl_p…
valeriosetti Dec 9, 2025
abb0b22
Merge pull request #10505 from valeriosetti/issue10453
mpg Dec 10, 2025
a733725
tests: remove temporary fix for secp192 curves in test_psa_crypto_wit…
valeriosetti Dec 11, 2025
3b74e0e
tf-psa-crypto: update reference
valeriosetti Dec 11, 2025
a7fd88a
framework: update reference
valeriosetti Dec 11, 2025
216c195
Merge pull request #10539 from valeriosetti/issue10518
davidhorstmann-arm Dec 15, 2025
23aad2c
Replace references of mbedtls_ecp_set_max_ops with psa_interruptible_…
Dec 23, 2025
27c2284
Re-instate failure when disabling non-existing option
Dec 24, 2025
da7aa76
Merge pull request #10549 from bjwtaylor/replace-mbedtls_ecp_set_map_ops
gilles-peskine-arm Dec 31, 2025
fe34bc8
Merge pull request #10550 from bjwtaylor/restore-failure
gilles-peskine-arm Jan 2, 2026
262d9ca
Update framework with config_macros.py
gilles-peskine-arm Dec 23, 2025
35821e7
Switch from config_history to config_macros
gilles-peskine-arm Dec 23, 2025
30323af
Read current data rather than data about 4.0
gilles-peskine-arm Dec 23, 2025
1de879c
Also reject internal macros that weren't options in 3.6
gilles-peskine-arm Dec 23, 2025
0e2eb22
New script to check or update config-options-current.txt
gilles-peskine-arm Dec 30, 2025
43784b5
Create the config option list shadow file
gilles-peskine-arm Dec 30, 2025
93ef003
Check that the config option list shadow file is up to date
gilles-peskine-arm Dec 30, 2025
b6c30c3
Print a useful message when the file is out of date
gilles-peskine-arm Jan 2, 2026
168c6ec
Improve out-of-date message
gilles-peskine-arm Jan 5, 2026
64ab9a2
Merge pull request #10548 from gilles-peskine-arm/config-checks-gener…
gilles-peskine-arm Jan 6, 2026
d0f6b54
Don't call SHA3 selftest when SHA3 is accelerated
gilles-peskine-arm Jan 6, 2026
40b11f5
Remove component_test_sha3_variations
gilles-peskine-arm Jan 6, 2026
4185efa
Fix non-determinism when generating mbedtls_config_check_user.h
gilles-peskine-arm Jan 7, 2026
a1502f5
Drop the ability to build the library without the framework
gilles-peskine-arm Dec 10, 2025
d13d041
Check for the framework submodule before anything else
gilles-peskine-arm Dec 10, 2025
3884bf3
Remove a XySSL-era comment that has run its course
gilles-peskine-arm Dec 16, 2025
f79f401
Fix missing dependencies of test_certs.h
gilles-peskine-arm Dec 15, 2025
d78060b
Get a clean run from make --warn-undefined-variables
gilles-peskine-arm Dec 16, 2025
a47cc27
Fix mixup in dependencies for generated config checks
gilles-peskine-arm Dec 12, 2025
7bef731
Create a TF-PSA-Crypto make helper for Mbed TLS
gilles-peskine-arm Dec 10, 2025
46568f3
Move some crypto core and drivers variable definitions to crypto-comm…
gilles-peskine-arm Dec 11, 2025
e3e4da6
Use intermediate variables for TF-PSA-Crypto's contribution to LOCAL_…
gilles-peskine-arm Dec 12, 2025
2607134
Move configurable variables to the top
gilles-peskine-arm Dec 18, 2025
c00bd2a
THREADING autodetection: only check the crypto config
gilles-peskine-arm Dec 16, 2025
ef25955
Move THREADING autodetection to crypto-common.make
gilles-peskine-arm Dec 17, 2025
d9c6a41
Introduce intermediate variables for various TF-PSA-Crypto lists
gilles-peskine-arm Dec 12, 2025
8ac7168
Move crypto-specific code from library/Makefile to a new file
gilles-peskine-arm Dec 18, 2025
cffc118
Move crypto-specific code from programs/Makefile to a new file
gilles-peskine-arm Dec 18, 2025
49d6985
Move crypto-specific code from tests/Makefile to a new file
gilles-peskine-arm Dec 18, 2025
8a528cf
Split the rules to generate config tests
gilles-peskine-arm Dec 18, 2025
5626779
Use intermediate variable for TF-PSA-Crypto's contribution to LOCAL_L…
gilles-peskine-arm Dec 18, 2025
b988dd8
Remove accidentally duplicated definitions
gilles-peskine-arm Jan 7, 2026
dd25569
Make use of some intermediate variables
gilles-peskine-arm Jan 7, 2026
6250af4
Merge pull request #10554 from gilles-peskine-arm/sha3-cleanup-202512…
gilles-peskine-arm Jan 7, 2026
a271e93
Merge pull request #10555 from gilles-peskine-arm/sort-config_check_u…
ronald-cron-arm Jan 7, 2026
67152f3
Merge pull request #10543 from gilles-peskine-arm/split-crypto-makefiles
ronald-cron-arm Jan 7, 2026
68b0ad1
Adapt to the split of test_suite_shax
gilles-peskine-arm Jan 7, 2026
0294b11
Merge pull request #10556 from gilles-peskine-arm/sha3-cleanup-202512…
valeriosetti Jan 8, 2026
bf38106
psasim: Moved to psasim_deprecated
minosgalanakis Jan 8, 2026
d982361
Moved tests/psa-client-server to framework.
minosgalanakis Jan 8, 2026
daee5e1
Merge branch 'tmp-branch-move-files-to-framework' into move-files-int…
minosgalanakis Jan 8, 2026
fc4689b
Removed old psasim dir
minosgalanakis Jan 8, 2026
7f6ad7c
psasim: Update location in Makefile and all-core.sh
minosgalanakis Dec 3, 2025
f51cf54
all-core.sh: Allow overriding of the psa-sim location
minosgalanakis Jan 7, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
133 changes: 75 additions & 58 deletions psasim/Makefile
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
76 changes: 29 additions & 47 deletions psasim/README.md
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`
11 changes: 4 additions & 7 deletions psasim/include/psa/client.h → psasim/include/client.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ extern "C" {

#include <stdint.h>
#include <stddef.h>
#include <psa/error.h>

Copy link
Copy Markdown
Contributor

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-framework‎ instead of importing a rewritten history. With a rewritten history, we don't get the same commits.

Copy link
Copy Markdown
Contributor Author

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 script is currently keeping the files we want to move on a temporary branch and then deletes all the others.
  • This works when you try to move from opaque subdirectory repo1/A/B/ORIGIN to repo2/C/D/DESTINATION but will fail when you try to move something in the root since common files like README exists in both and the “keep only moved files” strategy causes the temporary branch to carry mass deletions that collide with similarly-named files in the destination repo.
  • We have migrated the files once from framework to mbedtls and now are trying to migrate them back. The script does not allow moving a file onto itself and compounding the history.

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

This commit is created by merging two branches:
    * A stripped rewritten history of MbedTLS:development(checked out
      as psasim-history), using filter-repo:
          git filter-repo \
          --path tests/psa-client-server/psasim \
          --path-rename tests/psa-client-server/psasim:psasim \
          --force
    * The latest framework:main of mbedtls-framework
    * The mbedtls is added as a remote.
    * Any preparatory commits are applied before merge
    * Merge with --allow-unrelated-histories, and a
      merge policy to respect the incoming changes:
         git merge --allow-unrelated-histories --no-ff \
         -X theirs \
         --signoff \
         psasim-history/psasim-history\
         -m "Import psasim history from Mbed TLS"

I think restructuring the script is outside of the scope of this pr.

Copy link
Copy Markdown
Contributor

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.

#include "psa/crypto.h"

#include "error_ext.h"
/*********************** PSA Client Macros and Types *************************/

#define PSA_FRAMEWORK_VERSION (0x0100)
Expand All @@ -32,12 +35,6 @@ extern "C" {
#define PSA_HANDLE_IS_VALID(handle) ((psa_handle_t) (handle) > 0)
#define PSA_HANDLE_TO_ERROR(handle) ((psa_status_t) (handle))

#define PSA_MAX_IOVEC (4u)

#define PSA_IPC_CALL (0)

typedef int32_t psa_handle_t;

/**
* A read-only input memory region provided to an RoT Service.
*/
Expand Down
52 changes: 52 additions & 0 deletions psasim/include/common.h
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_ */
19 changes: 19 additions & 0 deletions psasim/include/error_ext.h
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
2 changes: 1 addition & 1 deletion psasim/include/psasim/init.h → psasim/include/init.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/

#include <stdint.h>
#include <psa/service.h>
#include <service.h>
void raise_signal(psa_signal_t signal);
void __init_psasim(const char **array,
int size,
Expand Down
File renamed without changes.
36 changes: 0 additions & 36 deletions psasim/include/psa/error.h

This file was deleted.

6 changes: 5 additions & 1 deletion psasim/include/psa/service.h → psasim/include/service.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@ extern "C" {
#include <stdlib.h>
#include <stdint.h>
#include <stddef.h>
#include <psa/client.h>

#include "common.h"

#include "psa/crypto.h"

/********************** PSA Secure Partition Macros and Types ****************/

/* PSA wait timeouts */
Expand Down
Loading