Commit graph

29121 commits

Author SHA1 Message Date
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
Gilles Peskine
5d867872dd Improve readability of null-argument tests
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-01-02 17:57:51 +01:00
Gilles Peskine
39b7bba8a0 Make input parameter const
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2024-01-02 17:56:54 +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
Dave Rodgman
1cc90a1003
Merge pull request #8517 from mschulz-at-hilscher/fixes/issue-6910
Fixes redundant declarations for psa_set_key_domain_parameters
2024-01-02 16:34:40 +00:00
Valerio Setti
6315441be7 adjust_legacy_from_psa: relax condition for legacy block cipher auto-enabling
CCM/GCM can be either fully accelerated or rely on just the key type
being accelerated. This means that ultimately it is just the key
type which determines if the legacy block cipher modes need to
be auto-enabled or not.

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-01-02 17:21:01 +01:00
Valerio Setti
c1c6858bfc cipher_wrap: fix guards for some CCM/GCM functions
Legacy CCM and GCM can work even when AES_C is not defined thanks
to the block_cipher module, so we can relax guards in
cipher_wrap.

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-01-02 17:20:58 +01:00
Valerio Setti
a87cd17b35 psa-transition: update with MD translation functions
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-01-02 16:20:44 +01:00
Valerio Setti
a835d6da08 changelog: document MD's conversion functions
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-01-02 16:20:39 +01:00
Valerio Setti
2c1070b397 test_suite_md: improve md_to_from_psa() test function and related data
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-01-02 14:58:22 +01:00
Valerio Setti
3d2e0f5f42 psa_util: add algorithm's availability checks for MD conversion functions
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-01-02 14:57:47 +01:00
Valerio Setti
384fbde49a library/tests: replace md_psa.h with psa_util.h as include file for MD conversion
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-01-02 13:27:32 +01:00
Valerio Setti
45c3cae8a5 md: move PSA conversion functions from md_psa.h to psa_util.h
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-01-02 13:26:04 +01:00
Dave Rodgman
84125a167e Merge remote-tracking branch 'origin/development' into default-compiler-all
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
2024-01-02 11:42:38 +00:00
Valerio Setti
8c8b4da3a3 all.sh: keep PSA_WANT_ALG_[CCM/GCM] enabled in common_block_cipher_dispatch()
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-01-02 11:44:30 +01:00
Gilles Peskine
ea982e39a1
Merge pull request #8637 from bensze01/fix_supported_components
all.sh: Parse arguments before checking if a test is supported
2024-01-02 09:41:02 +00:00
Waleed Elmelegy
3d46b7f81a Fix Max fragmen length test to use TLS 1.2 maximum output size
Signed-off-by: Waleed Elmelegy <waleed.elmelegy@arm.com>
2024-01-01 20:50:53 +00:00
Waleed Elmelegy
bae705c12b Fix TLS 1.2 test to use TLS 1.2 maximum output size
Signed-off-by: Waleed Elmelegy <waleed.elmelegy@arm.com>
2024-01-01 14:21:21 +00:00
Valerio Setti
84d19e0836 all.sh: keep DES_C and CTR_DRBG_C enabled in test_full_no_cipher_with_crypto()
These were probably leftovers from the development phase of the
associated PR that were not removed in the end.

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-12-29 16:42:21 +01:00
Waleed Elmelegy
ea03183bd7 Adjust TLS 1.3 tests to new maximum output changes
Signed-off-by: Waleed Elmelegy <waleed.elmelegy@arm.com>
2023-12-29 15:36:51 +00:00
Valerio Setti
e581e140cc oid/pkparse: add missing guards for PKCS[5/12] functions when !CIPHER_C
This commit also updates test_suite_pkparse.data file adding
MBEDTLS_CIPHER_C dependencies whenever PKCS[5/12] is used.

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-12-29 16:35:58 +01:00
Valerio Setti
562dfe1067 all.sh: keep PKCS[5/12] enabled in full_no_cipher test components
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-12-29 16:34:19 +01:00
Valerio Setti
81338483e6 changelog: enhance description
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-12-29 15:46:17 +01:00
Valerio Setti
045d680054 driver-only-builds: enhancing cipher related sections
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-12-29 15:42:22 +01:00
Valerio Setti
f333b3fbde driver-only-builds: fix typos
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-12-29 15:08:39 +01:00
Valerio Setti
a0c9c6684d analyze_outcomes: ignore only test concerning AES/ARIA/Camellia in CMAC
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-12-29 14:14:11 +01:00
Valerio Setti
160b2bde09 test_suite_cmac: add used key type to all test cases
This is useful for grepping and skipping disparities in
analyze_outcomes.py.

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-12-29 14:07:11 +01:00
Waleed Elmelegy
87a373eea6 Improve Record size limit testing
Signed-off-by: Waleed Elmelegy <waleed.elmelegy@arm.com>
2023-12-28 17:49:36 +00:00
Waleed Elmelegy
6a971fd61a Refactor and improve Record size limit handling
Signed-off-by: Waleed Elmelegy <waleed.elmelegy@arm.com>
2023-12-28 17:48:16 +00:00
Valerio Setti
0635cca7d1 analyze_outcomes: update skipped tests following latest changes to all.sh
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-12-28 18:33:17 +01:00
Valerio Setti
cd21d4eb8f all.sh: keep legacy cipher modes enabled in test_full_block_cipher_legacy_dispatch()
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-12-28 18:33:17 +01:00
Valerio Setti
1fff4f2012 psa: add key_type as input parameter of psa_can_do_cipher()
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-12-28 18:33:17 +01:00
Valerio Setti
9a4cc122a7 test_suite_block_cipher.psa: remove misleading initial comment
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-12-28 18:33:17 +01:00
Valerio Setti
1994e72e18 check_config/block_cipher: minor improvements
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-12-28 18:33:04 +01:00
Valerio Setti
ab0494f193 analyze_outcomes: update comments of skipped tests
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-12-28 13:56:52 +01:00
Valerio Setti
92e5c693ba driver-only-builds: updated ciphers and AEADs related sections
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-12-28 13:28:03 +01:00
Valerio Setti
b3413bf0b4 changelog: update description
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-12-28 12:15:45 +01:00
Valerio Setti
b9f4bfc33b all.sh: fix messages in test_psa_crypto_config_accel_des
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-12-28 11:07:48 +01:00
Valerio Setti
e98ad5931a mbedls_config: update documentation for MBEDTLS_PKCS[5/12]_C
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-12-28 10:42:12 +01:00
Manuel Pégourié-Gonnard
d2d2cd1a16
Merge pull request #8653 from gilles-peskine-arm/pthread-link-auto-make
Autodetect whether linking with pthread is needed
2023-12-27 08:59:53 +00:00
Gilles Peskine
28e9d86cbc Changelog entry for the new ECP functions
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-12-24 19:51:57 +01:00
Gilles Peskine
3b17ae78d2 Add ECP-heavy-only test cases to the driver parity analysis ignore list
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-12-24 19:51:57 +01: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
62e33bcc64 New function mbedtls_ecp_write_public_key
Directly export the public part of a key pair without having to go through
intermediate objects (using mbedtls_ecp_point_write_binary would require a
group object and a point object).

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-12-24 15:23:19 +01:00
Gilles Peskine
6dd87384ae Rename variable that's a C++ keyword
It gave uncrustify trouble
(https://github.com/uncrustify/uncrustify/issues/4044)

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-12-24 15:23:19 +01:00
Gilles Peskine
ad5e437c8e mbedtls_ecp_read_key: explain how to set the public key
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-12-24 15:23:19 +01:00
Gilles Peskine
7ea72026cd New function mbedtls_ecp_keypair_calc_public
For when you calculate or import a private key, and then need to calculate
the public key.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-12-22 21:30:03 +01:00
Gilles Peskine
28240323d3 New function mbedtls_ecp_set_public_key
Set the public key in a key pair. This complements mbedtls_ecp_read_key and
the functions can be used in either order.

Document the need to call check functions separately.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-12-22 21:30:03 +01:00
Gilles Peskine
091a85a762 Promise mbedtls_ecp_read_key doesn't overwrite the public key
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-12-22 21:30:03 +01:00