Commit graph

24942 commits

Author SHA1 Message Date
Valerio Setti
2d81499026 pk: fix position for mbedtls_platform_zeroize
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-05-02 15:45:39 +02:00
Valerio Setti
8820b57b6e test: fix makefile for ec_pub.[der/pem] generation
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-05-02 15:45:39 +02:00
Valerio Setti
d860a79029 test: fix wrong private key file
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-05-02 15:45:39 +02:00
Valerio Setti
1751341b68 test: add test function for public key derivation starting from private one
Data test cases are also included in the commit.

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-05-02 15:45:39 +02:00
Valerio Setti
2c50526476 pk: fix: clear buffer holding raw EC private key on exit
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-05-02 15:45:39 +02:00
Valerio Setti
c8b7865612 test: align ec_pub public keyfile with its ec_prv.sec1 counterpart
This change affects:
- both PEM and DER files, since they contain the same public key
  only in different formats
- "ec_pub.comp.pem" since it's the same as "ec_pub.pem" but in
  compressed format

The makefile was also updated accordingly to reflect these
dependencies.

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-05-02 15:45:39 +02:00
Manuel Pégourié-Gonnard
8e076e4132
Merge pull request #6915 from aditya-deshpande-arm/example-driver-post-codestyle
Document (with examples) how to integrate a third-party driver with Mbed TLS
2023-05-02 12:13:42 +02:00
Manuel Pégourié-Gonnard
f317df98ea
Merge pull request #7461 from valeriosetti/issue7460-part1
Fixing USE_PSA_INIT/DONE in SSL/X509/PK test suites
2023-05-02 10:44:13 +02:00
Kusumit Ghoderao
d60dfc0e43 Add test for parse_binary_string
Signed-off-by: Kusumit Ghoderao <Kusumit.Ghoderao@silabs.com>
2023-05-02 10:47:50 +05:30
Andrzej Kurek
6f400a376e Disallow leading zeroes when parsing IPv4 addresses
Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
2023-05-01 06:23:42 -04:00
Aditya Deshpande
8225587fd7 Change from Mbed TLS 3.3.0 to 3.4.0 in driver documentation.
Signed-off-by: Aditya Deshpande <aditya.deshpande@arm.com>
2023-04-28 17:55:02 +01:00
Aditya Deshpande
641cb8914d Minor changes to documentation and code comments for clarity
Signed-off-by: Aditya Deshpande <aditya.deshpande@arm.com>
2023-04-28 17:55:02 +01:00
Aditya Deshpande
7b9934dcdd Add support for building p256-m alongside Mbed TLS with CMake.
Also check if p256-m is enabled in the config before including the contents of p256-m.c

Signed-off-by: Aditya Deshpande <aditya.deshpande@arm.com>
2023-04-28 17:54:55 +01:00
Aditya Deshpande
ac363d8d20 Migrate p256-m_driver_entrypoints.[hc] to new code style
Signed-off-by: Aditya Deshpande <aditya.deshpande@arm.com>
2023-04-28 17:54:15 +01:00
Aditya Deshpande
ebd624e691 Minor formatting change to driver wrapper jinja template
Signed-off-by: Aditya Deshpande <aditya.deshpande@arm.com>
2023-04-28 17:54:15 +01:00
Aditya Deshpande
f100f00679 Add warnings to documentation stating that p256-m code may be out of date with upstream, plus other minor grammatical fixes.
Signed-off-by: Aditya Deshpande <aditya.deshpande@arm.com>
2023-04-28 17:54:15 +01:00
Aditya Deshpande
be55bb2d5d Use psa_generate_random() instead of mbedtls_ctr_dbrg
Signed-off-by: Aditya Deshpande <aditya.deshpande@arm.com>
2023-04-28 17:54:15 +01:00
Aditya Deshpande
8d99f2590c Add 3rdparty license information to the README
Signed-off-by: Aditya Deshpande <aditya.deshpande@arm.com>
2023-04-28 17:54:15 +01:00
Aditya Deshpande
045b370c66 Add SPDX license identifiers to driver entry point files
Signed-off-by: Aditya Deshpande <aditya.deshpande@arm.com>
2023-04-28 17:54:15 +01:00
Aditya Deshpande
a8d663d3af Add README and license from the p256-m repo
Signed-off-by: Aditya Deshpande <aditya.deshpande@arm.com>
2023-04-28 17:54:15 +01:00
Aditya Deshpande
bac592d53e Remove rand() from p256_generate_random() and move to an implementation based on mbedtls_ctr_drbg
Signed-off-by: Aditya Deshpande <aditya.deshpande@arm.com>
2023-04-28 17:54:15 +01:00
Aditya Deshpande
caed18e741 Add README in p256-m/
Signed-off-by: Aditya Deshpande <aditya.deshpande@arm.com>
2023-04-28 17:54:15 +01:00
Aditya Deshpande
a9612d00a4 Remove unnecessary no-check-names comments
Signed-off-by: Aditya Deshpande <aditya.deshpande@arm.com>
2023-04-28 17:54:15 +01:00
Aditya Deshpande
f80b939096 Add information for driver points where auto-generation is implemented
Signed-off-by: Aditya Deshpande <aditya.deshpande@arm.com>
2023-04-28 17:54:15 +01:00
Aditya Deshpande
755b174fec Add example for integrating a driver alongside Mbed TLS for entrypoints where auto-generation of driver wrappers is not implemented yet.
Using p256-m as the example driver/software accelerator.

Signed-off-by: Aditya Deshpande <aditya.deshpande@arm.com>
2023-04-28 17:54:15 +01:00
Aditya Deshpande
695e44b5a0 Rename p256m to p256 for uniform function/macro prefixes
Signed-off-by: Aditya Deshpande <aditya.deshpande@arm.com>
2023-04-28 17:54:15 +01:00
Aditya Deshpande
abf4bf31cb Start the driver example write-up (p256-m integration)
Signed-off-by: Aditya Deshpande <aditya.deshpande@arm.com>
2023-04-28 17:54:15 +01:00
Aditya Deshpande
277690e944 Add step-by-step guide for writing and integrating drivers for entry points where auto-generation is not implemented
Signed-off-by: Aditya Deshpande <aditya.deshpande@arm.com>
2023-04-28 17:54:15 +01:00
Aditya Deshpande
e41f7e457f Integrate p256-m as an example driver alongside Mbed TLS and write documentation for the example.
(Reapplying changes as one commit on top of development post codestyle change instead of rewriting old branch)

Signed-off-by: Aditya Deshpande <aditya.deshpande@arm.com>
2023-04-28 17:54:09 +01:00
Przemek Stekiel
75095cce74 mbedtls_psa_ffdh_set_prime_generator: use switch instead if-else
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com>
2023-04-28 14:20:27 +02:00
Przemek Stekiel
4ce523256b Fix definition of PSA_RAW_KEY_AGREEMENT_OUTPUT_MAX_SIZE (ECC vs FFDH max)
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com>
2023-04-28 13:40:34 +02:00
Przemek Stekiel
eb511a4495 Update config files to make PSA FFDH undependent on MBEDTLS_DHM_C
To enable support for FFDH in PSA MBEDTLS_USE_PSA_CRYPTO needs to be enabled.

Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com>
2023-04-28 13:20:16 +02:00
Przemek Stekiel
534105044c Add guards for psa_is_dh_key_size_valid
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com>
2023-04-28 13:18:43 +02:00
Gilles Peskine
14d6b1124b
Merge pull request #7419 from yuhaoth/test/random-time-test-fail
Workaround random `test_suite_platform` fail in time test
2023-04-28 13:17:31 +02:00
Gilles Peskine
7351101704
Merge pull request #7502 from daverodgman/inline-clz
Fix VS2022 build error
2023-04-28 13:06:47 +02:00
Gilles Peskine
53a9ac576d
Merge pull request #7443 from mprse/psa_init_in_programs
Init PSA in ssl and x509 programs
2023-04-28 12:49:11 +02:00
Gilles Peskine
d2e1dd098c
Merge pull request #7499 from JonathanWitthoeft/development
Bug Fix: mbedtls_ecdsa_verify_restartable fails with ECDSA_SIGN_ALT
2023-04-28 12:45:32 +02:00
Valerio Setti
7c0f91be10 test: use define for initializing ssl_message_queue struct
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-04-28 12:20:34 +02:00
Przemek Stekiel
6d85afa0cc Fix naming: FFDH key -> DH key and fix guard in psa_validate_key_type_and_size_for_key_generation
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com>
2023-04-28 11:42:17 +02:00
Valerio Setti
00a256f7b2 test: fix USE_PSA_INIT position in test_suite_ssl
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-04-28 09:37:35 +02:00
Kusumit Ghoderao
0f2f996b92 change binary_string_parser for big-endian input
Signed-off-by: Kusumit Ghoderao <Kusumit.Ghoderao@silabs.com>
2023-04-28 10:07:10 +05:30
Dave Rodgman
e93c90e881
Merge pull request #7433 from oberon-microsystems/fix-psa-aead-chacha20-test-dependency 2023-04-27 19:13:53 +01:00
Kusumit-Silabs
b6ad6823f0
Update tests/suites/test_suite_psa_crypto.function
Co-authored-by: Gilles Peskine <gilles.peskine@arm.com>
Signed-off-by: Kusumit-Silabs <89393006+silabs-Kusumit@users.noreply.github.com>
2023-04-27 22:42:19 +05:30
Kusumit Ghoderao
af0225e4de change binary_string_parser for big-endian input
Signed-off-by: Kusumit Ghoderao <Kusumit.Ghoderao@silabs.com>
2023-04-27 20:06:58 +05:30
Dave Rodgman
914347bfa3 Don't explicitly inline mbedtls_mpi_core_clz
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2023-04-27 14:20:30 +01:00
Kusumit Ghoderao
c6fdf1b683 Add tests with INPUT_INTEGER as key_type_arg
Signed-off-by: Kusumit Ghoderao <Kusumit.Ghoderao@silabs.com>
2023-04-27 17:03:20 +05:30
Kusumit Ghoderao
12e0b4b452 Use key_type_arg for determining input method
Remove input_types_arg variable in test function
Signed-off-by: Kusumit Ghoderao <Kusumit.Ghoderao@silabs.com>
2023-04-27 16:58:23 +05:30
Kusumit Ghoderao
a5376954ce Remove unrelated comment
Signed-off-by: Kusumit Ghoderao <Kusumit.Ghoderao@silabs.com>
2023-04-27 16:57:24 +05:30
Przemek Stekiel
4c0da51ee7 mbedtls_test_psa_exported_key_sanity_check: check for length equality for DH keys
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com>
2023-04-27 13:04:20 +02:00
Przemek Stekiel
2c9fc07cc4 Fix FFDH tests dependencies
Signed-off-by: Przemek Stekiel <przemyslaw.stekiel@mobica.com>
2023-04-27 12:41:32 +02:00