Commit graph

28774 commits

Author SHA1 Message Date
Paul Elliott
80fa88e2fa Remove warning with GCC 12 and TSan
Compiler is unhappy that the return from mbedtls_cipher_get_name() could
be NULL as this is used in a printf statement.

Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2023-12-18 14:49:34 +00:00
Paul Elliott
356597f077 Make TSan test run operate on full config
Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2023-12-18 14:49:34 +00:00
Paul Elliott
bb0e48f94f Make number of threads a test argument
Remove hard coded number of threads.

Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2023-12-18 14:49:34 +00:00
Paul Elliott
fed410f58e Increase entropy buffer sizes
Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2023-12-18 14:49:34 +00:00
Paul Elliott
811c600d88 Guard tests correctly
All guarded options change output, thus failing the test.

Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2023-12-18 14:49:34 +00:00
Paul Elliott
6a997c9994 Fix code style
Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2023-12-18 14:49:34 +00:00
Paul Elliott
2667eda785 Explicitly link tests with pthreads
Required to use pthreads within tests.

Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2023-12-18 14:49:34 +00:00
Paul Elliott
8860021abc Fix false claim of variables used unitialised
GCC with TSan + O3 causes an error where it claims key_len and iv_len
may be used uninitialised. This is, as far as I can tell incorrect (the
only way it could not be set is in the error case, and then it is not
used), however the simplest option seemed to be just to fix it.

Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2023-12-18 14:49:34 +00:00
Paul Elliott
bbdfc8ad2c Add TsanDbg, standardise Tsan with other sanitisers
Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2023-12-18 14:49:34 +00:00
Paul Elliott
bda25dd29c Add re-seeding option to test
Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2023-12-18 14:49:34 +00:00
Paul Elliott
20b2efa293 Fix missing include
Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2023-12-18 14:49:33 +00:00
Janos Follath
178bf3ee8a Fix failing multi-threaded unit test
Signed-off-by: Janos Follath <janos.follath@arm.com>
2023-12-18 14:49:33 +00:00
Janos Follath
a16ee6b7d4 Add multi-threaded unit test
The unit test we add is designed to fail. The goal is to test the tests
and show that they catch the problem. A later commit will fix the unit
test and will make it pass.

Signed-off-by: Janos Follath <janos.follath@arm.com>
2023-12-18 14:49:33 +00:00
Janos Follath
9338cac050 Add tsan to all.sh
component_test_tsan now builds and tests the library with
clang ThreadSanitizer enabled.

There are no multi-threaded unit tests so far, the goal is that they are
automatically tested with TSan when they are added.

Signed-off-by: Janos Follath <janos.follath@arm.com>
2023-12-18 14:49:33 +00:00
Janos Follath
eb075c5de4 Add cmake build type for tsan
Building with clang ThreadSanitizer can now be done by setting the build
type:

cmake -D CMAKE_BUILD_TYPE:String=TSan .

(ThreadSanitizer is available in clang 3.2 and gcc 4.8, README.md states
that we test with clang 3.8 and gcc 5.4.)

Signed-off-by: Janos Follath <janos.follath@arm.com>
2023-12-18 14:49:33 +00:00
Dave Rodgman
af616d9123 Merge remote-tracking branch 'origin/development' into iar-fixes 2023-12-18 13:38:22 +00:00
Manuel Pégourié-Gonnard
8f1c36df00
Merge pull request #8607 from valeriosetti/issue8602
Make enrollement "optional" in pk_can_do_ext()
2023-12-18 11:30:04 +00:00
Bence Szépkúti
a085fa8ccf
Merge pull request #8627 from tom-cosgrove-arm/ip_len
Avoid use of `ip_len` as it clashes with a macro in AIX system headers
2023-12-18 02:03:17 +00:00
Dave Rodgman
543d275c68
Merge pull request #8635 from daverodgman/asan-opt
CI perf - prefer clang for Asan
2023-12-15 13:25:02 +00:00
Ryan Everett
abd8977cc1 Make check_files ignore png files in docs
Signed-off-by: Ryan Everett <ryan.everett@arm.com>
2023-12-15 12:33:38 +00:00
Ryan Everett
c1c6e0d906 Justify linearization points
Signed-off-by: Ryan Everett <ryan.everett@arm.com>
2023-12-15 12:33:26 +00:00
Dave Rodgman
d5635e95e2 Undo accidental change
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-12-15 11:04:34 +00:00
Dave Rodgman
a2cf240fff Add explanatory comment
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-12-15 11:04:13 +00:00
Manuel Pégourié-Gonnard
cddab78612
Merge pull request #8630 from joerchan/mbedtls-tfm-compat
Mbedtls tfm compat
2023-12-15 09:31:27 +00:00
Dave Rodgman
c1f0f5b8af Fix a typo
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-12-14 23:34:48 +00:00
Dave Rodgman
b90f87b9a8 Use gcc for -m32 Asan builds
There seem to be known issues with clang for this target.

Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-12-14 23:27:39 +00:00
Dave Rodgman
815b240d72 Fix unused function/variable warnings from clang
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-12-14 23:20:48 +00:00
Dave Rodgman
17127e9f39 Use clang as default compiler for Asan
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-12-14 19:34:52 +00:00
Dave Rodgman
852de3c3f5 Build with -O2, but without assembly
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-12-14 16:44:11 +00:00
Joakim Andersson
9ede76cd1d changelog: add changelog for move of mbedtls_ecc psa helper functions
add changelog for move of mbedtls_ecc psa helper functions.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2023-12-14 16:33:18 +01:00
Ryan Everett
6ecb9ce5fc Link directly to the state transition diagram
Signed-off-by: Ryan Everett <ryan.everett@arm.com>
2023-12-14 15:19:31 +00:00
Ryan Everett
acfd774bca Add some clarifications in thread_safety.md
Make it clearer how it is possible to reason here using linearization

Signed-off-by: Ryan Everett <ryan.everett@arm.com>
2023-12-14 15:19:31 +00:00
Ryan Everett
3eb4274a57 Fix transitions in diagram
Move the finish_key_creation transition
Neaten the diagram
Add transitions for the key loading functions in psa_get_and_lock_key_slot
Add psa_wipe_key_slot transition
Change file to be a png

Signed-off-by: Ryan Everett <ryan.everett@arm.com>
2023-12-14 15:19:01 +00:00
Dave Rodgman
a19c75381c Remove redundant use of -O2 with ASAN_FLAGS
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-12-14 14:52:58 +00:00
Wenxing Hou
3b9de38208 Make clienthello comment clear
Signed-off-by: Wenxing Hou <wenxing.hou@intel.com>
2023-12-14 22:44:08 +08:00
Ryan Everett
b461b8731c Change how the state transition diagram is stored
Store the source of the diagram as a url instead of an xml file.
Signed-off-by: Ryan Everett <ryan.everett@arm.com>
2023-12-14 14:40:45 +00:00
Joakim Andersson
b349108b99 library: Move mbedtls_ecc helper functions to psa_util
Move the mbedtls_ecc helper functions from psa_core to psa_util.
These files are not implemented as part of the PSA API and should not
be part of the PSA crypto implementation.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2023-12-14 13:55:11 +01:00
Dave Rodgman
69928dbe86 Fix compile warning from IAR
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-12-14 12:09:18 +00:00
Dave Rodgman
650674bb41 Add MBEDTLS_BSWAPxx intrinsics for IAR
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-12-14 12:08:57 +00:00
Dave Rodgman
f3c04f3f47 Better definition of MBEDTLS_IS_BIG_ENDIAN for IAR
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-12-14 12:08:57 +00:00
Manuel Pégourié-Gonnard
4dde0b293c md-cipher-dispatch: editorial improvements
Fix a typo, add a reference.

Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2023-12-14 12:09:38 +01:00
Manuel Pégourié-Gonnard
1f67363d6a
Merge pull request #8616 from lpy4105/issue/8553/test-driver-only-rsa
Add test for driver-only RSA (crypto only)
2023-12-14 11:05:55 +00:00
Manuel Pégourié-Gonnard
001fb73131
Merge pull request #8612 from valeriosetti/issue8601
Quit using enrollment in pkparse
2023-12-13 14:55:34 +00:00
Dave Rodgman
bdba26c8d7
Merge pull request #8626 from davidhorstmann-arm/fix-uninit-mpi-test
Fix possible free of uninitialized MPI
2023-12-13 11:19:00 +00:00
Gilles Peskine
1ef1eb234f Clarify psa_constant_names
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-12-13 11:09:47 +01:00
Manuel Pégourié-Gonnard
7404af6ec3
Merge pull request #8599 from valeriosetti/issue8357
G2 wrap-up
2023-12-13 08:17:27 +00:00
Gilles Peskine
5feac959a5 Correct and clarify discussion of AES-CMAC-PRF-128
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-12-12 19:20:45 +01:00
Gilles Peskine
0308d79a34 Fix some MAC-related function names
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-12-12 19:20:30 +01:00
Manuel Pégourié-Gonnard
ea6b3c030d
Merge pull request #8605 from valeriosetti/issue8600
Quit using enrollment alg in for ECDSA in PK
2023-12-12 16:53:15 +00:00
Gilles Peskine
b4362d2cc7
Merge pull request #8523 from tom-daubney-arm/modify_check_generated_files_script
Modify check generated files script to work with TF PSA Crypto too
2023-12-11 21:15:00 +00:00