Valerio Setti
954ef4bbd5
psa_util: improve convert_raw_to_der_single_int()
...
Allow the function to support DER buffers than what it is nominally
required by the provided coordinates. In other words let's ignore
padding zeros in the raw number.
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-02-05 12:06:46 +01:00
Valerio Setti
315e4afc0a
psa_util: change parameters order in ECDSA conversion functions
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-02-05 10:09:15 +01:00
Valerio Setti
8645197937
psa_util: fix documentation of ECDSA conversion functions
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-02-05 09:50:20 +01:00
Valerio Setti
c9dd8611f8
test_suite_psa_crypto_util: add missing new line at the end of file
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-02-02 12:34:06 +01:00
Valerio Setti
3ecb395fb9
test_suite_psa_crypto_util: fix tests for 0-length and one 0x00 byte for r and s
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-02-01 15:26:24 +01:00
Valerio Setti
2d73baf171
psa_util: convert_der_to_raw_single_int: ensure the input DER integers have valid length
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-02-01 15:25:17 +01:00
Valerio Setti
3122f4da50
psa_util: invert check order for leading zeros in convert_der_to_raw_single_int()
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-01-31 11:16:46 +01:00
Valerio Setti
efcc555002
test_suite_psa_crypto_util: add test with 0-length s
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-01-31 11:15:37 +01:00
Valerio Setti
252311d41e
test_suite_psa_crypto_util: add test with 0-length for r
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-01-30 15:50:28 +01:00
Valerio Setti
98e1931a0a
test_suite_psa_crypto_util: alloc/free buffer inside loop in ecdsa_raw_to_der_incremental()
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-01-30 15:46:02 +01:00
Valerio Setti
78da7468ca
psa_util: minor improvements to convert_der_to_raw_single_int()
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-01-30 15:08:40 +01:00
Valerio Setti
7a795fd951
suite_psa_crypto_util: add more test cases for DER->RAW
...
- r with MSb set
- Invalid r (only 1 zero byte)
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-01-29 18:08:42 +01:00
Valerio Setti
122c94fd26
psa_util: remove raw_len param from convert_der_to_raw_single_int()
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-01-29 18:02:03 +01:00
Valerio Setti
ee5238fcf4
suite_psa_crypto_util: add more testing for mbedtls_ecdsa_raw_to_der()
...
A new test function is added, ecdsa_raw_to_der_incremental, that tests
incremental output DER buffer sizes checking that only the correct one
(tested at last) works correctly.
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-01-29 17:45:18 +01:00
Valerio Setti
9b9b5a52d9
psa_util: some code improvement to convert_der_to_raw_single_int()
...
This commit also fixes test_suite_psa_crypto_util.data due to the
change in one of the return values.
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-01-29 17:25:19 +01:00
Valerio Setti
f8ce457fb6
all.sh: fix comment in check_test_dependencies()
...
MBEDTLS_ASN1_WRITE_C is no more required for ECDSA conversion
functions.
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-01-26 14:55:14 +01:00
Valerio Setti
bcf0fc5119
adjust_legacy_crypto: add parenthesis to improve clarity
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-01-26 14:53:28 +01:00
Valerio Setti
448377bec7
all.sh: remove MBEDTLS_ASN1_PARSE_C exception from check_test_dependencies()
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-01-24 16:26:35 +01:00
Valerio Setti
688f795cb3
asn1: use the new symbol to guard dependencies of ECDSA conversion functions
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-01-24 16:26:35 +01:00
Valerio Setti
f4d2dc2d77
psa_util: guard ECDSA conversion functions with proper (internal) symbol
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-01-24 16:26:35 +01:00
Valerio Setti
17105df3e7
test_suite_psa_crypto_util: add comments to 512/521 bit size test cases
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-01-24 16:26:35 +01:00
Valerio Setti
31657ed70c
test_suite_psa_crypto_util: change curve type for 256bits tests
...
Tests with 256 bits curve simply depends on any curve of that size,
but they don't really care about which family is enabled.
Here I replaced PSA_WANT_ECC_SECP_R1_256 with PSA_WANT_ECC_SECP_K1_256
because otherwise there were test disparities in the
"analyze_driver_vs_reference_tfm_config" component of
"analyze_outcomes.py". It looked simpler to change the curve type
in the test suite's data rather than adding proper exceptions
in "analyze_outcomes.py"
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-01-24 16:26:35 +01:00
Valerio Setti
a7b83a04ee
psa_util: add variable casting in convert_raw_to_der_single_int()
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-01-24 16:26:35 +01:00
Valerio Setti
86bae52c55
psa_util: skip leading zeros in der format with "if" instead of "while"
...
This is possible because we know that DER format can have at most
1 leading zero.
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-01-24 16:26:35 +01:00
Valerio Setti
3ccb2b5423
all.sh: add exception for ASN1_PARSE_C in check_test_dependencies
...
There is no PSA equivalent to ASN1 legacy symbols.
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-01-24 16:26:35 +01:00
Valerio Setti
3f0809a99d
test_suite_psa_crypto_util: split ECDSA test function in two
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-01-24 16:26:35 +01:00
Valerio Setti
c22e3ce8ef
psa_util: remove CRYPTO_C guard from ECDSA conversion functions
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-01-24 16:26:31 +01:00
Valerio Setti
99c0369d31
psa_util: add include asn1write.h in public header
...
This is mandatory to have support for the error codes defined
in the asn1write.h header file.
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-01-24 16:14:37 +01:00
Valerio Setti
bda440f82d
test_suite_psa_crypto_util: increase the size of tested integers
...
- Replace 192 case with 256
- Replace 256 case with 512
- Add 521 case
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-01-24 16:14:37 +01:00
Valerio Setti
5713c8a5ac
psa_util: minor code improvements
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-01-24 16:14:37 +01:00
Valerio Setti
84890c9be2
psa_util: improve description for ECDSA conversion functions
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-01-24 16:14:37 +01:00
Valerio Setti
aed21640bd
test_suite_psa_crypto_util: add test function and data for ECDSA conversion functions
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-01-24 16:14:37 +01:00
Valerio Setti
bd5b9c61fe
pk_wrap: use PSA util functions for ECDSA conversion instead of PK ones
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-01-24 16:14:37 +01:00
Valerio Setti
75501f5ede
psa_util: add raw<->DER ECDSA conversion functions
...
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
2024-01-24 16:14:37 +01:00
Janos Follath
aa3fa98bc4
Merge pull request #8726 from v1gnesh/patch-1
...
Update entropy_poll.c to allow build in z/OS
2024-01-23 12:43:18 +00:00
v1gnesh
468c02cf61
Update ChangeLog.d/8726.txt
...
Co-authored-by: Janos Follath <janos.follath@arm.com>
Signed-off-by: v1gnesh <v1gnesh@users.noreply.github.com>
2024-01-23 15:29:40 +05:30
v1gnesh
d0b55edea3
Create 8726.txt changelog entry
...
Signed-off-by: v1gnesh <v1gnesh@users.noreply.github.com>
2024-01-22 17:13:56 +05:30
v1gnesh
3c129dd6aa
Update entropy_poll.c
...
Signed-off-by: v1gnesh <v1gnesh@users.noreply.github.com>
2024-01-22 15:59:49 +05:30
Manuel Pégourié-Gonnard
34c6e8a770
Merge pull request #8700 from valeriosetti/issue8461
...
psa_asymmetric_encrypt() doesn't work with opaque driver
2024-01-22 08:43:08 +00:00
Janos Follath
fb12d9204d
Merge pull request #8693 from Ryan-Everett-arm/implement-key-slot-mutex
...
Implement the key slot mutex
2024-01-19 20:49:18 +00:00
Ryan Everett
63952b7de5
Fix typo
...
Signed-off-by: Ryan Everett <ryan.everett@arm.com>
2024-01-19 13:45:19 +00:00
Ryan Everett
7aeacc1ec4
Add empty line in register_read comment
...
Signed-off-by: Ryan Everett <ryan.everett@arm.com>
2024-01-19 13:02:58 +00:00
Ryan Everett
558da2ffd3
Move key_slot_mutex to threading.h
...
Make this a global mutex so that we don't have to init and free it.
Also rename the mutex to follow the convention
Signed-off-by: Ryan Everett <ryan.everett@arm.com>
2024-01-19 12:59:28 +00:00
Gilles Peskine
4d4891e18a
Merge pull request #8666 from valeriosetti/issue8340
...
Export the mbedtls_md_psa_alg_from_type function
2024-01-18 13:58:55 +00:00
Ryan Everett
fb02d57de7
Document the thread safety of the primitive key slot functions
...
Signed-off-by: Ryan Everett <ryan.everett@arm.com>
2024-01-18 10:54:42 +00:00
Ryan Everett
0e3b677cf4
Support PSA_ERROR_SERVICE_FAILURE
...
To be returned in the case where mbedtls_mutex_lock and
mbedtls_mutex_unlock fail.
Signed-off-by: Ryan Everett <ryan.everett@arm.com>
2024-01-18 10:47:29 +00:00
Ryan Everett
846889355c
Initialize and free the key slot mutex
...
Signed-off-by: Ryan Everett <ryan.everett@arm.com>
2024-01-18 10:47:05 +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
Gilles Peskine
c9077cccd3
Merge pull request #8664 from valeriosetti/issue7764
...
Conversion function from ecp group to PSA curve
2024-01-18 10:28:55 +00:00
Ryan Everett
491f7e5ac3
Define key_slot_mutex
...
Signed-off-by: Ryan Everett <ryan.everett@arm.com>
2024-01-18 10:21:38 +00:00