Commit graph

2672 commits

Author SHA1 Message Date
Gilles Peskine
984352d6f1 Benchmark: remove the legacy-context ECDH block
We have two blocks of code to benchmark ECDH. One uses the legacy context
structure, which is only enabled when MBEDTLS_ECP_RESTARTABLE is enabled.
That block doesn't convey any information that's specific to restartable
ECC, it exists only for historical reasons (it came first). The other block
uses only the implementation-agnostic API.

Remove the block that uses the legacy context. It doesn't provide much
extra information and most users won't even see it.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-02-22 10:50:12 +01:00
Manuel Pégourié-Gonnard
0ecb5fd6f5
Merge pull request #8574 from ronald-cron-arm/ssl-tickets
Fix and align ticket age check in ssl_ticket.c for TLS 1.2 and TLS 1.3
2024-02-21 09:38:46 +00:00
Janos Follath
028a38b7cb
Merge pull request #8661 from BensonLiou/use_init_api
use mbedtls_ssl_session_init() to init session variable
2024-02-19 15:49:34 +00:00
Gilles Peskine
3ea9450463
Merge pull request #8734 from valeriosetti/issue8564
Add test for driver-only HMAC
2024-02-14 13:43:40 +00:00
PiotrBzdrega
f6a9cfa5d2 adjust indentation
Signed-off-by: PiotrBzdrega <piotrbzdrega@yandex.com>
2024-02-11 09:41:56 +01:00
PiotrBzdrega
2b20ff62fc move entropy init prior arguments number recognition
Signed-off-by: PiotrBzdrega <piotrbzdrega@yandex.com>
2024-02-11 02:15:03 +01:00
Manuel Pégourié-Gonnard
c3d17cde46
Merge pull request #8702 from minosgalanakis/update/dhm_context_in_programs_5015
[MBEDTLS_PRIVATE] Update dhm context in programs
2024-02-10 08:47:51 +00:00
Paul Elliott
54ad01efed Merge remote-tracking branch 'upstream/development' into make_tests_thread_safe 2024-02-09 14:33:58 +00:00
Janos Follath
7a28738205
Merge pull request #8636 from paul-elliott-arm/new_test_thread_interface
New test thread interface
2024-02-08 12:35:40 +00:00
Manuel Pégourié-Gonnard
1d7bc1ecdf
Merge pull request #8717 from valeriosetti/issue8030
PSA FFDH: feature macros for parameters
2024-02-07 10:06:03 +00:00
Jerry Yu
192e0f9b1d ssl_server2: Add read early data support
Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2024-02-01 16:40:47 +01:00
Minos Galanakis
8ee1b5f46e programs_benchmark: Updated to use mbedtls_dhm_read_public().
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2024-01-26 15:00:13 +00:00
Minos Galanakis
97489dc7e5 programs_benchmark: Updated to use mbedtls_dhm_set_group() & mbedtls_dhm_get_len()
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2024-01-26 15:00:13 +00:00
Minos Galanakis
e29c868ca4 programs_dh_server: Updated to use mbedtls_dhm_set_group() & mbedtls_dhm_get_len().
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2024-01-26 15:00:13 +00:00
Paul Elliott
0c847bcbe7 Fix Make issues with Everest enabled
Apply Gilles suggestion to fix the problem with make on the CI when everest is enabled, i.e. use $(THIRDPARTY_DIR) instead of a fuzz specific hack involving $(THIRDPARTY_INCLUDES)

Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2024-01-24 19:08:31 +00:00
Paul Elliott
7fd162ec26 Refactor common PThreads CMake code
Move the flags and find of Threads to root CMakeLists.txt, rather
than duplicate these everywhere. Make explicit linking of library with
PThreads use the same mechanism.

Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2024-01-24 18:05:53 +00:00
Valerio Setti
e35117640d cert_[req/write]: add MD_C dependency
Both programs use mbedtls_md_info_from_string() which is only
available as long as MBEDTLS_MD_C is enabled.

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-01-22 16:28:23 +01:00
Paul Elliott
a8f6192f9a Remove unneeded lines from fuzz/Makefile
Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2024-01-19 16:41:05 +00:00
Paul Elliott
85ea3e623b Set preferences before finding Threads in CMake
Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2024-01-19 15:57:22 +00:00
Minos Galanakis
42151380af programs_dh_client/server: Updated config guards.
Adjusted to use `MBEDTLS_SHA256_C` instead of `MBEDTLS_MD_CAN_SHA256`
since the former is being used in accelerated driver configurations.

Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2024-01-19 14:39:41 +00:00
Minos Galanakis
db8915287e programs_dh_client/server: Changed mdlen type to unsigned integer.
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2024-01-19 14:38:51 +00:00
Minos Galanakis
7c8448842d programs_dh_client/server: Updated to query digest size using mbedtls_md_info_from_type().
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2024-01-18 14:29:41 +00:00
Minos Galanakis
6e92df12c2 programs_rsa_rsa_verify: Updated program to use mbedtls_rsa_get_len()
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2024-01-18 14:29:41 +00:00
Minos Galanakis
992f0b8427 programs_rsa_rsa_sign: Updated program to use mbedtls_rsa_get_len()
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2024-01-18 14:29:41 +00:00
Minos Galanakis
ee757d35df programs_rsa_encrypt/decrypt: Updated programs to use mbedtls_rsa_get_len()
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2024-01-18 14:29:41 +00:00
Minos Galanakis
b6a96195fb programs_dh_client/server: Updated programs to use mbedtls_rsa_get_len()
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2024-01-18 14:29:41 +00:00
Minos Galanakis
f4dfd1c8a5 programs/dh_client/server: Added entropy source to mbedtls_rsa_pkcs1_sign()
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2024-01-18 14:29:41 +00:00
Minos Galanakis
a184fd0516 programs/dh_client/server: Replaced mbedtls_sha1 with mbedtls_sha256
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2024-01-18 14:29:41 +00:00
Gilles Peskine
b1f96c0354
Merge pull request #7815 from gilles-peskine-arm/ecp-export-partial
ECP keypair utility functions
2024-01-18 10:29:05 +00:00
Valerio Setti
e8683ce9ef ssl_test_lib: add guards for enabled DH groups
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-01-17 15:56:30 +01:00
Ronald Cron
d1c106c787 Define ticket creation time in TLS 1.2 case as well
The purpose of this change is to eventually base
the calculation in ssl_ticket.c of the ticket age
when parsing a ticket on the ticket creation time
both in TLS 1.2 and TLS 1.3 case.

Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2024-01-15 08:58:19 +01:00
Dave Rodgman
67223bb501 add support for AES-CTR to benchmark
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2024-01-12 18:33:57 +00:00
Tom Cosgrove
3a6059beca
Merge pull request #7455 from KloolK/record-size-limit/comply-with-limit
Comply with the received Record Size Limit extension
2024-01-09 15:22:17 +00:00
Paul Elliott
053db696b3 Allow programs/fuzz to be linked against pthread
Use the same mechanisms used to link other programs against pthread with
make, i.e. include common.make, and remove common code from programs/
fuzz/Makefile

Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2024-01-05 21:05:23 +00:00
Paul Elliott
4068c7e47c Link programs with pthread via cmake
All programs are now linked directly with all test code, thus adding a
pthread abstraction into the test code means having to link the programs
with pthread (if the library is found under cmake).

Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2024-01-05 21:04:52 +00:00
Paul Elliott
17c119a5e3 Migrate to threading_helpers.h
Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2024-01-05 21:04:52 +00:00
Paul Elliott
4580d4d829 Add accessor helpers for mbedtls_test_info
Step one of being able to control access to mbedtls_test_info with
a mutex.

Signed-off-by: Paul Elliott <paul.elliott@arm.com>
2024-01-05 19:13:43 +00:00
Paul Elliott
3ca93e5d25
Merge pull request #8667 from gilles-peskine-arm/pthread-link-auto-make-followup
Minor cleanups to common.make
2024-01-03 18:51:48 +00:00
Dave Rodgman
62a2e3c8db
Merge pull request #8512 from mschulz-at-hilscher/feature/timing-alt-compatible-benchmark
Alternative Timing compatible benchmark.c
2024-01-03 11:46:58 +00:00
Gilles Peskine
0ae58dd985 Unify MBEDTLS_TEST_OBJS
`$(MBEDTLS_TEST_OBJS)` included TLS-specific test support modules in
`tests/Makefile` but not in `programs/Makefile`. This difference is not
actually necessary. What is necessary is that all programs that use
functions from TLS-specific test support modules are linked with those
modules in addition to `-lmbedtls`, and programs that are not linked with
`-lmbedtls` are not linked with TLS-specific test support modules. Since we
always pass `-lmbedtls` when linking programs in `programs/Makefile`, we can
link with the TLS-specific test support modules as well. This keeps things
simpler.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-01-02 23:11:24 +01:00
Gilles Peskine
8939148339 Minor readability improvement
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-01-02 18:14:00 +01:00
Gilles Peskine
570e54822c Finish unifying LOCAL_CFLAGS
fixup "Create common.make with LOCAL_CFLAGS and friends"

The code wasn't what I had intended, although it was functionally
equivalent. Make it more readable and more robust.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-01-02 18:11:10 +01:00
Dave Rodgman
593e9cb600
Merge pull request #8511 from mschulz-at-hilscher/feature/rsa3072-benchmark
Add benchmark for RSA 3072
2024-01-02 16:35:14 +00:00
Benson Liou
6d0a093582 use mbedtls_ssl_session_init() to init session variable
Use mbedtls_ssl_session_init() to init variable just like
session-family APIs described

Signed-off-by: Benson Liou <benson.liou@sony.com>
2023-12-27 22:03:24 +08:00
Gilles Peskine
9552a52f5f Declare dependency on bignum in sample programs
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-12-24 19:51:57 +01:00
Gilles Peskine
52cc2a6368 Use new mbedtls_ecp_keypair functions in sample programs
This eliminates the use of MBEDTLS_PRIVATE in sample programs to access
fields of an mbedtls_ecp_keypair structure.

When displaying elliptic curve points, the program now display the
coordinates in the standard form instead of the internal representation.

The auxiliary function show_ecp_key is present in three programs. It's more
complex than the previous code which was also triplicated. There's no good
place for such auxiliary functions that don't belong in the library and are
used in multiple sample programs.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-12-24 19:49:43 +01:00
Gilles Peskine
4392fc101f Unify some common rules of programs/Makefile and tests/Makefile
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-12-22 11:49:35 +01:00
Gilles Peskine
076fd25480 Unify common variables of programs/Makefile and tests/Makefile
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-12-22 11:48:56 +01:00
Gilles Peskine
f3d1ae1f05 Create common.make with LOCAL_CFLAGS and friends
Create a common.make for definitions that are shared between tests/Makefile
and programs/Makefile, to facilitate maintenance. Start populating it with
CFLAGS/LDFLAGS variables. More to follow in subsequent commits.

Keep library/Makefile independent, at least for the time being.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-12-22 11:48:56 +01:00
Gilles Peskine
f5c5ce7789 Partly unify LOCAL_CFLAGS
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-12-22 11:48:56 +01:00