generate_key: rename \p parameters to \p extra

\p parameters is a confusing name for a function parameter. Rename it
to \p extra.
This commit is contained in:
Gilles Peskine 2018-07-12 01:14:59 +02:00 committed by itayzafrir
parent edd11a14aa
commit 53d991e655
2 changed files with 15 additions and 14 deletions

View file

@ -2415,21 +2415,22 @@ psa_status_t psa_generate_random(uint8_t *output,
* be unoccupied.
* \param type Key type (a \c PSA_KEY_TYPE_XXX value).
* \param bits Key size in bits.
* \param[in] parameters Extra parameters for key generation. The
* \param[in] extra Extra parameters for key generation. The
* interpretation of this parameter depends on
* \c type. All types support \c NULL to use
* the default parameters specified below.
* \param parameters_size Size of the buffer that \p parameters
* points to, in bytes.
* \param extra_size Size of the buffer that \p extra
* points to, in bytes. Note that if \p extra is
* \c NULL then \p extra_size must be zero.
*
* For any symmetric key type (a type such that
* #PSA_KEY_TYPE_IS_ASYMMETRIC(\p type) is false), \c parameters must be
* #PSA_KEY_TYPE_IS_ASYMMETRIC(\p type) is false), \p extra must be
* \c NULL. For asymmetric key types defined by this specification,
* the parameter type and the default parameters are defined by the
* table below. For vendor-defined key types, the vendor documentation
* shall define the parameter type and the default parameters.
*
* Type | Parameter type | Meaning | Parameters used if `parameters == NULL`
* Type | Parameter type | Meaning | Parameters used if `extra == NULL`
* ---- | -------------- | ------- | ---------------------------------------
* `PSA_KEY_TYPE_RSA_KEYPAIR` | `unsigned int` | Public exponent | 65537
*
@ -2445,8 +2446,8 @@ psa_status_t psa_generate_random(uint8_t *output,
psa_status_t psa_generate_key(psa_key_slot_t key,
psa_key_type_t type,
size_t bits,
const void *parameters,
size_t parameters_size);
const void *extra,
size_t extra_size);
/**@}*/

View file

@ -2964,13 +2964,13 @@ psa_status_t psa_generate_random( uint8_t *output,
psa_status_t psa_generate_key( psa_key_slot_t key,
psa_key_type_t type,
size_t bits,
const void *parameters,
size_t parameters_size )
const void *extra,
size_t extra_size )
{
key_slot_t *slot;
psa_status_t status;
if( parameters == NULL && parameters_size != 0 )
if( extra == NULL && extra_size != 0 )
return( PSA_ERROR_INVALID_ARGUMENT );
status = psa_get_empty_key_slot( key, &slot );
@ -3010,10 +3010,10 @@ psa_status_t psa_generate_key( psa_key_slot_t key,
int exponent = 65537;
if( bits > PSA_VENDOR_RSA_MAX_KEY_BITS )
return( PSA_ERROR_NOT_SUPPORTED );
if( parameters != NULL )
if( extra != NULL )
{
const unsigned *p = parameters;
if( parameters_size != sizeof( *p ) )
const unsigned *p = extra;
if( extra_size != sizeof( *p ) )
return( PSA_ERROR_INVALID_ARGUMENT );
if( *p > INT_MAX )
return( PSA_ERROR_INVALID_ARGUMENT );
@ -3048,7 +3048,7 @@ psa_status_t psa_generate_key( psa_key_slot_t key,
mbedtls_ecp_curve_info_from_grp_id( grp_id );
mbedtls_ecp_keypair *ecp;
int ret;
if( parameters != NULL )
if( extra != NULL )
return( PSA_ERROR_NOT_SUPPORTED );
if( grp_id == MBEDTLS_ECP_DP_NONE || curve_info == NULL )
return( PSA_ERROR_NOT_SUPPORTED );