9827 Commits

Author SHA1 Message Date
David Horstmann
49a7276c49 Switch error code to more appropriate value
Since we are internal rather than user-facing,
PSA_ERROR_CORRUPTION_DETECTED makes more sense than
PSA_ERROR_BUFFER_TOO_SMALL. Whilst it really is a buffer that is too
small, this error code is intended to indicate that a user-supplied
buffer is too small, not an internal one.

Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-11-03 19:51:40 +00:00
David Horstmann
86cdc7646d Switch to TEST_CALLOC_NONNULL()
This removes some gubbins related to making sure the buffer is not NULL
that was previously cluttering the test case.

Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-11-03 19:45:39 +00:00
David Horstmann
b8381513c1 Switch from ret to status as naming convention
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-11-03 19:31:35 +00:00
David Horstmann
8075c7faf7 Switch from int to psa_status_t for test args
Remove unnecessary casts as well.

Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-11-03 19:28:08 +00:00
David Horstmann
ac12d2dc69 Remove psa_crypto_ prefix from test functions
This ensures they have a different name to the functions they test.

Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-11-03 19:23:49 +00:00
David Horstmann
8995b50cf4 Remove superfluous comment
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-11-03 19:20:33 +00:00
David Horstmann
676cfdd0ea Replace compound-initializers with memset
This should eliminate some pedantic compiler warnings.

Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-11-02 20:47:04 +00:00
David Horstmann
8f77dc7f68 Refactor: move buffer pattern fills into helper
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-11-02 18:40:19 +00:00
David Horstmann
70fda48670 Add full round-trip tests for buffer copying
Test that a buffer pair can be created with psa_crypto_alloc_and_copy()
and destroyed with psa_crypto_copy_and_free() correctly.

Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-11-02 18:39:42 +00:00
David Horstmann
5b9c21756a Add test case for overlapping buffers
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-11-02 18:39:42 +00:00
David Horstmann
72ab8ad44a Reject zero-lengths in psa_crypto_copy_and_free()
Zero-length buffers should be represented in the
psa_crypto_buffer_copy_t struct as NULL if it was created in
psa_crypto_alloc_and_copy(), so reject non-NULL zero-length buffers.

Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-11-02 18:39:42 +00:00
David Horstmann
2b79cbaa17 Reject NULL original_output with non-NULL output
If we have a copy buffer but no original to copy back to, there is not
much sensible we can do. The psa_crypto_buffer_copy_t state is invalid.

Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-11-02 18:39:42 +00:00
David Horstmann
9700876520 Add testcases for psa_crypto_copy_and_free()
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-11-02 18:39:37 +00:00
David Horstmann
0fee689e57 Simplify zero-length buffers to always be NULL
Since it is implementation-dependent whether
malloc(0) returns NULL or a pointer, explicitly
represent zero-length buffers as NULL in the
buffer-copy struct, so as to have a uniform
behaviour.

Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-11-02 18:33:17 +00:00
David Horstmann
03b0472413 Zero-length test for psa_crypto_alloc_and_copy()
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-11-02 18:33:17 +00:00
David Horstmann
f06ac88284 Add extra testcases for buffer copying
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-11-02 18:33:17 +00:00
David Horstmann
24f11f9cc7 Add testcases for psa_crypto_alloc_and_copy()
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-11-02 18:33:08 +00:00
David Horstmann
2f96423147 Add testcases for psa_crypto_copy_output()
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-11-02 17:16:25 +00:00
David Horstmann
0b241ee584 Add testcases for psa_crypto_copy_input()
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-11-02 17:15:30 +00:00
Ronald Cron
a89d2ba132
Merge pull request #8327 from ronald-cron-arm/adapt-psa-crypto-repo-name
Adapt to new PSA Crypto repo name
2023-10-11 06:45:30 +00:00
Ronald Cron
fea6606f98
Merge pull request #8296 from ronald-cron-arm/remove-redundant-test-component
Remove redundant test component
2023-10-09 10:29:20 +00:00
Ronald Cron
070e8652d5 Adapt to new PSA Crypto repo name
Patterns I looked for:
grep -i "psa-crypto"
grep -i "psa.*crypto.*repo"
grep -i "psa.*crypto.*root"

Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2023-10-09 10:26:18 +02:00
Dave Rodgman
866b3a1886
Merge pull request #8323 from tom-daubney-arm/fix_mbedtls_styling_docs
Correct styling of Mbed TLS in documentation
2023-10-06 19:10:10 +00:00
Thomas Daubney
540324cd21 Correct styling of Mbed TLS in documentation
Several bits of documentation were incorrectly styling Mbed TLS
as MbedTLS.

Signed-off-by: Thomas Daubney <thomas.daubney@arm.com>
2023-10-06 17:07:24 +01:00
Valerio Setti
49c835e5ec test_suite_pkcs12: fix typo in test case description
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2023-10-06 11:25:08 +02:00
Minos Galanakis
4855fdf887 Revert "Auto-generated files for v3.5.0"
This reverts commit 591416f32b7a6472aa988c5106edbf334e228d2e.

Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2023-10-05 00:17:21 +01:00
Gilles Peskine
35b49c4d7d Ignore tests of built-in interfaces for driver-only testing parity
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-10-04 12:28:41 +02:00
Gilles Peskine
010f035cdf Renaming all MBEDTLS_HAVE for curves to MBEDTLS_ECP_HAVE
Fix test cases that were merged concurrently to
db6b4db7a0e982b15a95e048ac14f8d56fec44a6.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-10-04 12:27:14 +02:00
Minos Galanakis
591416f32b Auto-generated files for v3.5.0
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2023-10-04 00:55:02 +01:00
Minos Galanakis
31ca313efa Bump version to 3.5.0
```
./scripts/bump_version.sh --version 3.5.0
```

Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2023-10-03 22:02:18 +01:00
Minos Galanakis
1a3ad265cc Merge branch 'development-restricted' into mbedtls-3.5.0rc0-pr
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2023-10-03 21:57:51 +01:00
Minos Galanakis
3974b17631 check-generated-files: Added psa_crypto_driver_wrappers_no_static.c file
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
2023-10-03 11:47:03 +01:00
Ronald Cron
466286a14a Remove redundant test component
In the full configuration MBEDTLS_TEST_HOOKS is
enabled thus the configurations in
test_full_cmake_gcc_asan_new_bignum and
test_full_cmake_gcc_asan_new_bignum_test_hooks
are the same. Keep the component that runs more
tests.

Signed-off-by: Ronald Cron <ronald.cron@arm.com>
2023-10-03 12:44:15 +02:00
Dave Rodgman
b51f3da354
Merge pull request #8264 from mpg/follow-up-8075
Follow up to 8075
2023-09-28 17:32:12 +00:00
Gilles Peskine
42f8d5f0c9
Merge pull request #8261 from Mbed-TLS/fix-cmake-header-include
Add CMake include path for generated header
2023-09-28 15:16:15 +00:00
Manuel Pégourié-Gonnard
3b2357cdca Remove components that partially accelerate ECC keys
These are build-only components so this was never supported for sure.

Let's stick to what's really tested for now, and expand later (with
proper testing!) if there's demand for more flexibility.

Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2023-09-28 16:56:12 +02:00
Manuel Pégourié-Gonnard
680b48e6b5 Update list of ECC key types in user-config-for-test.h
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2023-09-28 16:52:44 +02:00
David Horstmann
f868d6f4e8 Remove spurious comments
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-09-28 14:01:25 +01:00
David Horstmann
6c979856c3 Remove generated files in all cmake_as_x tests
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-09-28 11:30:43 +01:00
David Horstmann
862abe2d0f Fix lowercase comment start
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-09-28 11:28:20 +01:00
Manuel Pégourié-Gonnard
c0c9b23b23 Test only what's support with partial curves accel
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2023-09-28 10:19:19 +02:00
Manuel Pégourié-Gonnard
faea919365 Fix typo: weiErstrass
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2023-09-28 10:19:16 +02:00
Manuel Pégourié-Gonnard
6be64f7d5b Use lowercase for local variables
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2023-09-28 10:19:16 +02:00
Manuel Pégourié-Gonnard
5aab46b91e Remove now-redundant tests
These were temporaries to avoid unwanted use of low-level modules. Now
that we have test components with those modules fully disabled (replaced
with drivers), we no longer need these tests - which were out of date
too.

Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2023-09-28 08:53:05 +02:00
Manuel Pégourié-Gonnard
eda7086bdd Auto-enable ACCEL macros for p256-m driver
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2023-09-28 08:53:05 +02:00
Manuel Pégourié-Gonnard
f07ce3b8ff Don't extend support for deprecated functions
Restore guards from the previous release, instead of the new, more
permissive guards.

Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
2023-09-28 08:51:51 +02:00
Gilles Peskine
7f288566c3
Merge pull request #8260 from gilles-peskine-arm/crypto_spe-include-fix
Fix include path to psa/crypto_spe.h
2023-09-27 18:10:16 +00:00
David Horstmann
9f48fff467 Ensure tests will fail if CMake generation fails
Remove the in-source-tree generated files before running CMake.

Signed-off-by: David Horstmann <david.horstmann@arm.com>
2023-09-27 16:35:15 +01:00
Dave Rodgman
0fc86b2ddf
Merge pull request #8075 from valeriosetti/issue8016
driver-only ECC: curve acceleration macros
2023-09-27 14:39:02 +00:00
Gilles Peskine
c1bedfe184 Put crypto_spe.h on the include search path where needed
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
2023-09-27 16:23:41 +02:00