29443 Commits

Author SHA1 Message Date
David Horstmann
63dfb45e5e
Merge pull request #1181 from tom-daubney-arm/key_agreement_buffer_protection
Implement safe buffer copying in key agreement
2024-03-11 15:10:49 +00:00
David Horstmann
849bb717bc
Merge pull request #1160 from davidhorstmann-arm/copying-pake
Add secure buffer copying to PAKE
2024-03-08 16:09:10 +00:00
tom-daubney-arm
d4c57c0ad2
Merge branch 'development-restricted' into key_agreement_buffer_protection
Signed-off-by: tom-daubney-arm <74920390+tom-daubney-arm@users.noreply.github.com>
2024-03-06 16:47:13 +00:00
Thomas Daubney
a4866945b8 Fix issue with large allocation in tests
In test_suite_psa_crypto_op_fail.generated.function
the function key_agreement_fail was setting the
public_key_length variable to SIZE_MAX which meant that
a huge allocation was being attempted.

Signed-off-by: Thomas Daubney <thomas.daubney@arm.com>
2024-03-06 16:32:25 +00:00
David Horstmann
a5175634b0
Merge branch 'development-restricted' into copying-pake
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2024-03-06 11:18:28 +00:00
David Horstmann
714418f2dc
Merge pull request #1167 from gabor-mezei-arm/buffer_protection_for_cipher
Buffer protection for cipher functions
2024-03-05 18:42:48 +00:00
Gabor Mezei
1b5b58d4d9
Fix merge
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2024-03-04 17:15:08 +01:00
Gábor Mezei
716cf2d4e0
Merge branch 'development-restricted' into buffer_protection_for_cipher
Signed-off-by: Gábor Mezei <63054694+gabor-mezei-arm@users.noreply.github.com>
2024-03-04 15:38:05 +00:00
David Horstmann
2bb537ec61
Merge pull request #1172 from davidhorstmann-arm/generate-random-buffer-protection
Add secure buffer copying to `psa_generate_random()`
2024-03-04 13:23:46 +00:00
David Horstmann
c5688a2629
Merge branch 'development-restricted' into generate-random-buffer-protection
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2024-02-29 14:25:56 +00:00
David Horstmann
920a932bab
Merge pull request #1153 from tom-daubney-arm/asymmetric_encrypt_buffer_protection
Implement safe buffer copying in asymmetric encryption
2024-02-29 14:16:59 +00:00
David Horstmann
7581363122 Fix incorrect conflict resolution
A return statement was missing in the wrapper generation script.

Signed-off-by: David Horstmann <david.horstmann@arm.com>
2024-02-29 11:26:45 +00:00
Gabor Mezei
0b04116cc8
Do not copy the content to the local output buffer with allocation
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2024-02-29 10:08:16 +00:00
tom-daubney-arm
840dfe8b41
Merge branch 'development-restricted' into asymmetric_encrypt_buffer_protection
Signed-off-by: tom-daubney-arm <74920390+tom-daubney-arm@users.noreply.github.com>
2024-02-28 15:42:38 +00:00
Gabor Mezei
f1dd0253ec
Remove write check in driver wrappers tests
This check is intended to ensure that we do not write intermediate
results to the shared output buffer. This check will be made obselete
by generic memory-poisoning-based testing for all functions.

Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2024-02-28 15:18:21 +00:00
Gabor Mezei
358eb218ab
Fix buffer protection handling for cipher_generate_iv
Use the `LOCAL_OUTPUT_` macros for buffer protection instead of the existing
local variable.

Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2024-02-28 15:17:19 +00:00
Gabor Mezei
b74ac66c8b
Update test wrapper functions for ciper buffer protection
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2024-02-28 15:17:18 +00:00
Gabor Mezei
7abf8ee51b
Add buffer protection for cipher_generate_iv and cipher_set_iv
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2024-02-28 15:17:18 +00:00
Gabor Mezei
8b8e485961
Move local buffer allocation just before usage
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2024-02-28 15:17:18 +00:00
Gabor Mezei
4892d75e9b
Add LOCAL_OUTPUT_ALLOC_WITH_COPY macro if buffer protection is disabled
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2024-02-28 15:17:17 +00:00
Gabor Mezei
c25fbd2cc1
Fix ASAN error for psa_cipher_update
The ASAN gives an error for `psa_cipher_update` when the `input_length`
is 0 and the `input` buffer is `NULL`. The root cause of this issue is
`mbedtls_cipher_update` always need a valid pointer for the
input buffer even if the length is 0.
This fix avoids the `mbedtls_cipher_update` to be called if the
input buffer length is 0.

Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2024-02-28 15:17:17 +00:00
Gabor Mezei
b8f97a1f3f
Add test wrapper functions for cipher buffer protection
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2024-02-28 15:17:17 +00:00
Gabor Mezei
212eb08884
Add buffer protection for cipher functions
Signed-off-by: Gabor Mezei <gabor.mezei@arm.com>
2024-02-28 15:15:49 +00:00
David Horstmann
e097bbdcf3 Add missing guards around exit label
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2024-02-28 14:17:10 +00:00
David Horstmann
1ff95e61d7
Merge pull request #1149 from tom-daubney-arm/mac_buffer_protection
Implement safe buffer copying in MAC API
2024-02-26 19:06:42 +00:00
David Horstmann
075c5fb76f Generate test wrappers for psa_generate_random()
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2024-02-26 17:12:34 +00:00
David Horstmann
6e99bb203f Add buffer copying to psa_generate_random()
Signed-off-by: David Horstmann <david.horstmann@arm.com>
2024-02-26 17:12:34 +00:00
Thomas Daubney
4a46d73bb0 Suppress pylint
Signed-off-by: Thomas Daubney <thomas.daubney@arm.com>
2024-02-26 13:49:26 +00:00
tom-daubney-arm
5cd611d144
Merge branch 'development-restricted' into mac_buffer_protection
Signed-off-by: tom-daubney-arm <74920390+tom-daubney-arm@users.noreply.github.com>
2024-02-22 15:26:06 +00:00
Thomas Daubney
5390acada9 Decouple if statements in psa_raw_key_agreement exit.
Signed-off-by: Thomas Daubney <thomas.daubney@arm.com>
2024-02-22 11:06:04 +00:00
Thomas Daubney
0576a6a174 Revise how output allocation is checked
Signed-off-by: Thomas Daubney <thomas.daubney@arm.com>
2024-02-21 15:15:00 +00:00
Thomas Daubney
89d8c2a1b4 Rework check for failed output allocation
Signed-off-by: Thomas Daubney <thomas.daubney@arm.com>
2024-02-21 12:14:57 +00:00
David Horstmann
cf3457ef26
Merge pull request #1132 from davidhorstmann-arm/copying-aead
Copy buffers in AEAD
2024-02-20 16:07:30 +00:00
Thomas Daubney
d997e7ad9a Check output allocated before randomising
Signed-off-by: Thomas Daubney <thomas.daubney@arm.com>
2024-02-20 11:24:07 +00:00
Thomas Daubney
50f58fc3e4 Conditionally include exit label
Signed-off-by: Thomas Daubney <thomas.daubney@arm.com>
2024-02-15 14:24:03 +00:00
Thomas Daubney
fe2bda3257 Generate test wrappers
Signed-off-by: Thomas Daubney <thomas.daubney@arm.com>
2024-02-15 13:35:06 +00:00
Thomas Daubney
9739ac047a Add buffer protection to psa_key_derivation_key_agreement
Signed-off-by: Thomas Daubney <thomas.daubney@arm.com>
2024-02-15 13:15:47 +00:00
Thomas Daubney
81899aba11 Add buffer protection to psa_raw_key_agreement
Signed-off-by: Thomas Daubney <thomas.daubney@arm.com>
2024-02-15 12:57:26 +00:00
David Horstmann
b539126670
Merge pull request #1156 from Ryan-Everett-arm/key-derivation-buffer-protection
Add buffer copying to the Key Derivation API
2024-02-15 11:54:20 +00:00
David Horstmann
2e7db3c0dd
Merge pull request #1142 from tom-daubney-arm/hash_buffer_protection
Add secure buffer copying to PSA Hash API
2024-02-13 18:17:52 +00:00
Thomas Daubney
54e6b412bd Generate all test wrappers
One was missed due to a typo

Signed-off-by: Thomas Daubney <thomas.daubney@arm.com>
2024-02-12 12:49:22 +00:00
Thomas Daubney
27b48a312f Generate test wrappers
Signed-off-by: Thomas Daubney <thomas.daubney@arm.com>
2024-02-12 12:49:19 +00:00
Thomas Daubney
6adbb2a351 Implement safe buffer copying in asymm. encryption
Use local copy buffer macros to implement safe
copy mechanism in asymmetric encryption API.

Signed-off-by: Thomas Daubney <thomas.daubney@arm.com>
2024-02-12 12:48:36 +00:00
Thomas Daubney
03f1ea3624 Change condition on wiping tag buffer
Signed-off-by: Thomas Daubney <thomas.daubney@arm.com>
2024-02-12 12:07:38 +00:00
Thomas Daubney
1ffc5cb4a5 Modify allocation and buffer wiping in sign_finish
Allocate immediately after declaration and only wipe
tag buffer if allocation didn't fail.

Signed-off-by: Thomas Daubney <thomas.daubney@arm.com>
2024-02-12 12:07:38 +00:00
Thomas Daubney
7480a74cba Fix code style
Signed-off-by: Thomas Daubney <thomas.daubney@arm.com>
2024-02-12 12:07:38 +00:00
Thomas Daubney
c6705c6cb2 Conditionally include exit label
... on MAC functions where the label was only added
due to the modifications required by this PR.

Signed-off-by: Thomas Daubney <thomas.daubney@arm.com>
2024-02-12 12:07:38 +00:00
Thomas Daubney
a1cf1010cc Generate test wrappers for mac functions
Signed-off-by: Thomas Daubney <thomas.daubney@arm.com>
2024-02-12 12:07:35 +00:00
Thomas Daubney
8db8d1a83e Implement safe buffer copying in MAC API
Use buffer local copy macros to implement safe
copy mechanism in MAC API.

Signed-off-by: Thomas Daubney <thomas.daubney@arm.com>
2024-02-12 12:07:02 +00:00
Thomas Daubney
d2411565ce Fix code style
Signed-off-by: Thomas Daubney <thomas.daubney@arm.com>
2024-02-12 11:43:07 +00:00