mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-02-11 00:40:05 +00:00
Add a test for the built-in key range
Restricting the built-in key range would be an API break since applications can hard-code a built-in key value and expect that it won't clash with anything else. Make it harder to accidentally break the API. Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
This commit is contained in:
parent
d72ad738bd
commit
543909d894
@ -487,7 +487,7 @@ psa_status_t mbedtls_psa_external_get_random(
|
||||
* #PSA_KEY_ID_VENDOR_MIN and #PSA_KEY_ID_VENDOR_MAX and must not intersect
|
||||
* with any other set of implementation-chosen key identifiers.
|
||||
*
|
||||
* This value is part of the library's ABI since changing it would invalidate
|
||||
* This value is part of the library's API since changing it would invalidate
|
||||
* the values of built-in key identifiers in applications.
|
||||
*/
|
||||
#define MBEDTLS_PSA_KEY_ID_BUILTIN_MIN ((psa_key_id_t) 0x7fff0000)
|
||||
|
@ -1,3 +1,6 @@
|
||||
Built-in key range
|
||||
builtin_key_id_stability:
|
||||
|
||||
sign_hash transparent driver: in driver ECDSA SECP256R1 SHA-256
|
||||
depends_on:PSA_WANT_ALG_DETERMINISTIC_ECDSA:PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_BASIC:PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_IMPORT:PSA_WANT_KEY_TYPE_ECC_KEY_PAIR_EXPORT:PSA_WANT_ECC_SECP_R1_256:PSA_WANT_ALG_SHA_256
|
||||
sign_hash:PSA_KEY_TYPE_ECC_KEY_PAIR( PSA_ECC_FAMILY_SECP_R1 ):PSA_ALG_DETERMINISTIC_ECDSA( PSA_ALG_SHA_256 ):PSA_SUCCESS:"ab45435712649cb30bbddac49197eebf2740ffc7f874d9244c3460f54f322d3a":"9ac4335b469bbd791439248504dd0d49c71349a295fee5a1c68507f45a9e1c7b":"6a3399f69421ffe1490377adf2ea1f117d81a63cf5bf22e918d51175eb259151ce95d7c26cc04e25503e2f7a1ec3573e3c2412534bb4a19b3a7811742f49f50f":0:PSA_SUCCESS
|
||||
|
@ -489,6 +489,21 @@ exit:
|
||||
* END_DEPENDENCIES
|
||||
*/
|
||||
|
||||
/* BEGIN_CASE */
|
||||
void builtin_key_id_stability()
|
||||
{
|
||||
/* If the range of built-in keys is reduced, it's an API break, since
|
||||
* it breaks user code that hard-codes the key id of built-in keys.
|
||||
* It's ok to expand this range, but not to shrink it. That is, you
|
||||
* may make the MIN smaller or the MAX larger at any time, but
|
||||
* making the MIN larger or the MAX smaller can only be done in
|
||||
* a new major version of the library.
|
||||
*/
|
||||
TEST_EQUAL(MBEDTLS_PSA_KEY_ID_BUILTIN_MIN, 0x7fff0000);
|
||||
TEST_EQUAL(MBEDTLS_PSA_KEY_ID_BUILTIN_MAX, 0x7fffefff);
|
||||
}
|
||||
/* END_CASE */
|
||||
|
||||
/* BEGIN_CASE */
|
||||
void sign_hash(int key_type_arg,
|
||||
int alg_arg,
|
||||
|
Loading…
x
Reference in New Issue
Block a user