Ronald Cron
77abfe67db
ssl_helpers.c: Add ticket write/parse test functions
...
Add ticket write/parse test functions as defined
by mbedtls_ssl_ticket_write/parse_t. They are
intended to be used in negative testing
involving tickets.
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2024-01-22 09:37:45 +01:00
Valerio Setti
10e9aa26c5
tests: add PSA_INIT/PSA_DONE to CCM and GCM test suites
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-12-14 18:08:14 +01:00
Valerio Setti
302a487499
test_driver_key_management: rename counter for export_public_key() hits
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-12-04 11:04:42 +01:00
Valerio Setti
829ce0facf
test_driver_cipher: add forced return status for encrypt and set_iv
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-12-04 11:04:42 +01:00
Valerio Setti
7ef35a9b3c
test_suite_psa_crypto_driver_wrappers: add counter for failing psa_cipher_update()
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-12-04 11:04:42 +01:00
Valerio Setti
7448367f68
test_suite_psa_crypto_slot_management: modify check on open key slots
...
This commit
- Reverts changes previously done to psa_crypto_helpers.[c,h]
- Implements a new check for open key slots in
mbedtls_test_helper_is_psa_leaking():
- when CTR_DRBG does not use AES_C or PSA does not have an external
RNG, then we allow 1 key slot (it's the one holding the AES key)
- when the above conditions are not met, then we fallback to the
usual check for "no open key slots remaining"
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-12-04 11:04:42 +01:00
Valerio Setti
45337a8895
test_suite_psa_crypto_driver_wrappers: add counter for cipher_update()
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-12-04 11:04:42 +01:00
Valerio Setti
6ef82ae39d
test_suite_psa_crypto_driver_wrappers: improving driver access counters
...
When AES_C is not defined CTR_DRBG relies on PSA to get AES-ECB. This
means that, when AES-ECB is accelerated, each random operation goes through
driver access as well. This might result in unexpectedly increased
counters for driver's access.
We add extra counters in test_driver_[cipher/key_management].c to be
more specific on which driver functions are accessed and ignore
extra accesses due to CTR_DRBG.
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-12-04 11:04:42 +01:00
Valerio Setti
dc32ac20fd
test_suite_[ctr_drbg/random]: initialize/close PSA in tests
...
This commit also adds AES_PSA_[INIT/DONE] in "psa_crypto_helpers.h". Its
scope is to call PSA_[INIT/DONE] only when AES_C is not defined (which is
when PSA is effectively required for CTR_DRBG).
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-12-04 11:04:41 +01:00
Valerio Setti
402cfba4dc
psa: free RNG implementation before checking for remaining open key slots
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-12-04 11:04:41 +01:00
Janos Follath
c6f1637f8c
Merge pull request #8534 from paul-elliott-arm/fix_mutex_abstraction
...
Make mutex abstraction and tests thread safe
2023-11-29 13:26:23 +00:00
Dave Rodgman
c3cd410acf
Merge pull request #8286 from gilles-peskine-arm/check_mbedtls_calloc_overallocation-disable_with_asan
...
Fix test_suite_platform failure with Asan on modern Clang
2023-11-28 16:48:31 +00:00
Paul Elliott
f25d831123
Ensure mutex test mutex gets free'd
...
Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2023-11-23 18:49:43 +00:00
Gilles Peskine
fa8ec2611e
Detect enabled GCC/Clang sanitizers
...
Occasionally we want tests to take advantage of sanitizers, or work around
them.
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-11-22 17:56:26 +01:00
Valerio Setti
776981ba42
psa_exercise_key: add missing #else for KNOWN_SUPPORTED_BLOCK_CIPHER
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-11-15 09:18:14 +01:00
Valerio Setti
a4b60593c1
psa_exercise_key: replace legacy symbols with PSA_WANT ones
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-11-15 09:18:14 +01:00
Valerio Setti
a765eaa33e
test_driver_extension: fix acceleration support for CCM and CCM*
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-11-15 09:18:14 +01:00
Manuel Pégourié-Gonnard
bce640b7e3
Merge pull request #8499 from valeriosetti/issue8488
...
Clean up libtestdriver1 config: unconditonal removals
2023-11-15 04:25:14 +00:00
Valerio Setti
b9015385fd
test_driver_extension: use same def/undef pattern for all accelerated symbols
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-11-08 13:11:10 +01:00
Pengyu Lv
ba6825e37b
ssl: use MBEDTLS_SSL_HAVE_* in tests
...
Done by commands:
```
sed -i "s/MBEDTLS_\(AES\|CAMELLIA\|ARIA\|CHACHAPOLY\)_C/MBEDTLS_SSL_HAVE_\1/g" tests/{suites,include,src}/**/*ssl*
sed -i "s/MBEDTLS_\(GCM\|CCM\)_C/MBEDTLS_SSL_HAVE_\1/g" tests/{suites,include,src}/**/*ssl*
sed -i "s/MBEDTLS_CIPHER_MODE_\(CBC\)/MBEDTLS_SSL_HAVE_\1/g" tests/{suites,include,src}/**/*ssl*
```
Signed-off-by: Pengyu Lv <pengyu.lv@arm.com>
2023-11-08 14:09:16 +08:00
Gilles Peskine
e9f50bf161
Merge pull request #8443 from valeriosetti/issue8274
...
Clean up curves handling in libtestdriver1 config
2023-11-04 15:04:42 +00:00
Dave Rodgman
16799db69a
update headers
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-11-02 19:47:20 +00:00
Valerio Setti
05c25cbaf9
test_driver_extension: manage curves' acceleration the same as other PSA_WANT symbols
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-10-30 11:07:18 +01:00
Valerio Setti
221d8aa8e7
libtestdriver1: fix acceleration for ALG_STREAM_CIPHER/ALG_ECB_NO_PADDING
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-10-23 15:06:30 +02:00
Yanray Wang
af5003a157
CMAC: accelerate CMAC in accel_cipher
...
Signed-off-by: Yanray Wang <yanray.wang@arm.com>
2023-10-19 16:13:34 +08:00
Valerio Setti
02a634decd
md: remove unnecessary inclusions of mbedtls/md.h
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-10-11 13:15:58 +02:00
Gilles Peskine
ca1e605b9c
Merge remote-tracking branch 'upstream-public/development' into development-restricted-merge-20230925
...
Conflicts:
* `include/mbedtls/build_info.h`: a new fragment to auto-enable
`MBEDTLS_CIPHER_PADDING_PKCS7` was added in
c9f4040f7f
in `development-restricted`.
In `development`, this section of the file has moved to
`include/mbedtls/config_adjust_legacy_crypto.h`.
* `library/bignum.c`: function name change in `development-restricted` vs
comment change in development. The comment change in `development` is not
really relevant, so just take the line from `development-restricted`.
2023-09-25 16:16:26 +02:00
Manuel Pégourié-Gonnard
cc21ad441a
Add SHA-3 support to libtestdriver1
...
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2023-09-24 09:48:45 +02:00
Gilles Peskine
ae3cda9541
Merge pull request #8092 from silabs-Kusumit/PBKDF2_output_key
...
PBKDF2: test output_key
2023-09-22 18:01:06 +00:00
Gilles Peskine
193f94276e
Merge pull request #1071 from gilles-peskine-arm/ssl_decrypt_stream_short_buffer
...
Fix buffer overread in mbedtls_ssl_decrypt_buf with stream cipher
2023-09-22 11:43:03 +02:00
Dave Rodgman
986006e567
Make TEST_CALLOC_NONNULL more robust
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-09-19 18:30:25 +01:00
Dave Rodgman
a328635305
Introduce TEST_CALLOC_NONNULL
...
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-09-19 17:34:39 +01:00
Gilles Peskine
9099d3fd76
Refactoring: create mbedtls_test_ssl_prepare_record_mac()
...
No semantic change.
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-09-18 17:21:15 +02:00
Kusumit Ghoderao
7c61ffcc44
Rename parse_binary_string function
...
Signed-off-by: Kusumit Ghoderao <Kusumit.Ghoderao@silabs.com>
2023-09-05 19:29:47 +05:30
Gilles Peskine
44243e11ff
Remove obsolete header inclusions
...
Since 3.0.0, mbedtls_config.h (formerly config.h) no longer needs to include
config_psa.h or check_config.h: build_info.h takes care of that.
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-08-21 16:10:06 +02:00
Kusumit Ghoderao
ac7a04ac15
Move parse_binary_string function to psa_crypto_helpers
...
Add test code for pbkdf2 in psa_exercise_key
Signed-off-by: Kusumit Ghoderao <Kusumit.Ghoderao@silabs.com>
2023-08-18 22:04:16 +05:30
Tom Cosgrove
e7700a7d0a
Merge pull request #7936 from AgathiyanB/assert-false-macro
...
Add TEST_FAIL macro for tests
2023-08-10 15:01:34 +00:00
Dave Rodgman
2ec9892f24
Merge pull request #6253 from tom-cosgrove-arm/rename-assert_compare-to-test_assert_compare
...
Rename test macros `ASSERT_COMPARE()`, `ASSERT_ALLOC()` and `ASSERT_ALLOC_WEAK()`
2023-08-04 13:45:10 +00:00
Gilles Peskine
bb07377458
Merge pull request #7935 from AgathiyanB/add-enum-casts
...
Add type casts for integer and enum types
2023-07-26 11:27:27 +02:00
Agathiyan Bragadeesh
3dd3ae219e
Remove trailing backslash
...
Signed-off-by: Agathiyan Bragadeesh <agathiyan.bragadeesh2@arm.com>
2023-07-21 17:07:00 +01:00
Gilles Peskine
5647d06be8
Merge pull request #7518 from gilles-peskine-arm/psa_inject_entropy-file-stability
...
Fix and test MBEDTLS_PSA_INJECT_ENTROPY
2023-07-21 17:37:15 +02:00
Tom Cosgrove
e4e9e7da58
For tests, rename TEST_BUFFERS_EQUAL() to TEST_MEMORY_COMPARE()
...
Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com>
2023-07-21 11:45:25 +01:00
Tom Cosgrove
a45d902822
Rename the length argument to TEST_CALLOC() to be the more accurate item_count
...
Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com>
2023-07-21 11:36:11 +01:00
Tom Cosgrove
05b2a87ea0
For tests, rename TEST_CALLOC_OR_FAIL() to just TEST_CALLOC()
...
Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com>
2023-07-21 11:32:25 +01:00
Tom Cosgrove
412a813ad4
For tests, rename ASSERT_ALLOC_WEAK() to TEST_CALLOC_OR_SKIP()
...
Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com>
2023-07-20 16:55:14 +01:00
Tom Cosgrove
f9ffd11e7a
For tests, rename ASSERT_ALLOC() to TEST_CALLOC_OR_FAIL()
...
Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com>
2023-07-20 16:51:21 +01:00
Tom Cosgrove
65cd8519f7
For tests, rename ASSERT_COMPARE() to TEST_BUFFERS_EQUAL()
...
Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com>
2023-07-20 16:51:15 +01:00
Agathiyan Bragadeesh
dc28a5a105
Rename ASSERT_FALSE to TEST_FAIL
...
Signed-off-by: Agathiyan Bragadeesh <agathiyan.bragadeesh2@arm.com>
2023-07-18 11:45:28 +01:00
Agathiyan Bragadeesh
ebb40bc336
Add ASSERT_FALSE macro for tests
...
Signed-off-by: Agathiyan Bragadeesh <agathiyan.bragadeesh2@arm.com>
2023-07-18 11:38:04 +01:00
Agathiyan Bragadeesh
2d310deace
Add cast in test macros.h
...
Signed-off-by: Agathiyan Bragadeesh <agathiyan.bragadeesh2@arm.com>
2023-07-17 18:27:03 +01:00