1
0
mirror of https://github.com/Mbed-TLS/mbedtls.git synced 2025-07-29 11:41:15 +03:00

Rename "key generation method" to "key production parameters"

"Key generation method" was misleading since it also applies to key
derivation. Change "key generation" to "key production", which we aren't
using yet and has roughly the right intuition. Change "method" to
"parameters" which there seems to be a slight preference for. Discussion
thread: https://github.com/Mbed-TLS/mbedtls/pull/8815#discussion_r1486524295

Identifiers renamed:
psa_key_generation_method_t → psa_key_production_parameters_t
psa_key_generation_method_s → psa_key_production_parameters_s
PSA_KEY_GENERATION_METHOD_INIT → PSA_KEY_PRODUCTION_PARAMETERS_INIT
method → params
method_data_length → params_data_length
default_method → default_production_parameters
psa_key_generation_method_is_default → psa_key_production_parameters_are_default
setup_key_generation_method → setup_key_production_parameters
key_generation_method_init → key_production_parameters_init

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
This commit is contained in:
Gilles Peskine
2024-02-20 12:31:24 +01:00
parent e7a7013910
commit 092ce51c47
8 changed files with 113 additions and 109 deletions

View File

@ -731,7 +731,7 @@ static inline psa_status_t psa_driver_wrapper_get_key_buffer_size_from_key_data(
static inline psa_status_t psa_driver_wrapper_generate_key(
const psa_key_attributes_t *attributes,
const psa_key_generation_method_t *method, size_t method_data_length,
const psa_key_production_parameters_t *params, size_t params_data_length,
uint8_t *key_buffer, size_t key_buffer_size, size_t *key_buffer_length )
{
psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
@ -739,16 +739,17 @@ static inline psa_status_t psa_driver_wrapper_generate_key(
PSA_KEY_LIFETIME_GET_LOCATION(attributes->core.lifetime);
#if defined(PSA_WANT_KEY_TYPE_RSA_KEY_PAIR_GENERATE)
int is_default_method =
psa_key_generation_method_is_default(method, method_data_length);
if( location != PSA_KEY_LOCATION_LOCAL_STORAGE && !is_default_method )
int is_default_production =
psa_key_production_parameters_are_default(params, params_data_length);
if( location != PSA_KEY_LOCATION_LOCAL_STORAGE && !is_default_production )
{
/* We don't support passing a custom method to drivers yet. */
/* We don't support passing custom production parameters
* to drivers yet. */
return PSA_ERROR_NOT_SUPPORTED;
}
#else
int is_default_method = 1;
(void) is_default_method;
int is_default_production = 1;
(void) is_default_production;
#endif
/* Try dynamically-registered SE interface first */
@ -777,9 +778,10 @@ static inline psa_status_t psa_driver_wrapper_generate_key(
case PSA_KEY_LOCATION_LOCAL_STORAGE:
#if defined(PSA_CRYPTO_ACCELERATOR_DRIVER_PRESENT)
/* Transparent drivers are limited to generating asymmetric keys. */
/* We don't support passing a custom method to drivers yet. */
/* We don't support passing custom production parameters
* to drivers yet. */
if( PSA_KEY_TYPE_IS_ASYMMETRIC( attributes->core.type ) &&
is_default_method )
is_default_production )
{
/* Cycle through all known transparent accelerators */
#if defined(PSA_CRYPTO_DRIVER_TEST)
@ -809,7 +811,7 @@ static inline psa_status_t psa_driver_wrapper_generate_key(
/* Software fallback */
status = psa_generate_key_internal(
attributes, method, method_data_length,
attributes, params, params_data_length,
key_buffer, key_buffer_size, key_buffer_length );
break;