mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2025-01-11 23:36:07 +00:00
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:
parent
edd11a14aa
commit
53d991e655
|
@ -2415,21 +2415,22 @@ psa_status_t psa_generate_random(uint8_t *output,
|
||||||
* be unoccupied.
|
* be unoccupied.
|
||||||
* \param type Key type (a \c PSA_KEY_TYPE_XXX value).
|
* \param type Key type (a \c PSA_KEY_TYPE_XXX value).
|
||||||
* \param bits Key size in bits.
|
* \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
|
* interpretation of this parameter depends on
|
||||||
* \c type. All types support \c NULL to use
|
* \c type. All types support \c NULL to use
|
||||||
* the default parameters specified below.
|
* the default parameters specified below.
|
||||||
* \param parameters_size Size of the buffer that \p parameters
|
* \param extra_size Size of the buffer that \p extra
|
||||||
* points to, in bytes.
|
* 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
|
* 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,
|
* \c NULL. For asymmetric key types defined by this specification,
|
||||||
* the parameter type and the default parameters are defined by the
|
* the parameter type and the default parameters are defined by the
|
||||||
* table below. For vendor-defined key types, the vendor documentation
|
* table below. For vendor-defined key types, the vendor documentation
|
||||||
* shall define the parameter type and the default parameters.
|
* 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
|
* `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_status_t psa_generate_key(psa_key_slot_t key,
|
||||||
psa_key_type_t type,
|
psa_key_type_t type,
|
||||||
size_t bits,
|
size_t bits,
|
||||||
const void *parameters,
|
const void *extra,
|
||||||
size_t parameters_size);
|
size_t extra_size);
|
||||||
|
|
||||||
/**@}*/
|
/**@}*/
|
||||||
|
|
||||||
|
|
|
@ -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_status_t psa_generate_key( psa_key_slot_t key,
|
||||||
psa_key_type_t type,
|
psa_key_type_t type,
|
||||||
size_t bits,
|
size_t bits,
|
||||||
const void *parameters,
|
const void *extra,
|
||||||
size_t parameters_size )
|
size_t extra_size )
|
||||||
{
|
{
|
||||||
key_slot_t *slot;
|
key_slot_t *slot;
|
||||||
psa_status_t status;
|
psa_status_t status;
|
||||||
|
|
||||||
if( parameters == NULL && parameters_size != 0 )
|
if( extra == NULL && extra_size != 0 )
|
||||||
return( PSA_ERROR_INVALID_ARGUMENT );
|
return( PSA_ERROR_INVALID_ARGUMENT );
|
||||||
|
|
||||||
status = psa_get_empty_key_slot( key, &slot );
|
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;
|
int exponent = 65537;
|
||||||
if( bits > PSA_VENDOR_RSA_MAX_KEY_BITS )
|
if( bits > PSA_VENDOR_RSA_MAX_KEY_BITS )
|
||||||
return( PSA_ERROR_NOT_SUPPORTED );
|
return( PSA_ERROR_NOT_SUPPORTED );
|
||||||
if( parameters != NULL )
|
if( extra != NULL )
|
||||||
{
|
{
|
||||||
const unsigned *p = parameters;
|
const unsigned *p = extra;
|
||||||
if( parameters_size != sizeof( *p ) )
|
if( extra_size != sizeof( *p ) )
|
||||||
return( PSA_ERROR_INVALID_ARGUMENT );
|
return( PSA_ERROR_INVALID_ARGUMENT );
|
||||||
if( *p > INT_MAX )
|
if( *p > INT_MAX )
|
||||||
return( PSA_ERROR_INVALID_ARGUMENT );
|
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_curve_info_from_grp_id( grp_id );
|
||||||
mbedtls_ecp_keypair *ecp;
|
mbedtls_ecp_keypair *ecp;
|
||||||
int ret;
|
int ret;
|
||||||
if( parameters != NULL )
|
if( extra != NULL )
|
||||||
return( PSA_ERROR_NOT_SUPPORTED );
|
return( PSA_ERROR_NOT_SUPPORTED );
|
||||||
if( grp_id == MBEDTLS_ECP_DP_NONE || curve_info == NULL )
|
if( grp_id == MBEDTLS_ECP_DP_NONE || curve_info == NULL )
|
||||||
return( PSA_ERROR_NOT_SUPPORTED );
|
return( PSA_ERROR_NOT_SUPPORTED );
|
||||||
|
|
Loading…
Reference in a new issue