mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-12-24 17:15:35 +00:00
psa_generate_key: pass parameters_size argument
When calling psa_generate_key, pass the size of the parameters buffer explicitly. This makes calls more verbose but less error-prone. This also has the benefit that in an implementation with separation, the frontend knows how many bytes to send to the backend without needing to know about each key type.
This commit is contained in:
parent
e3b07d81d6
commit
4e69d7a9a7
|
@ -1846,14 +1846,17 @@ psa_status_t psa_generate_random(uint8_t *output,
|
|||
/**
|
||||
* \brief Generate a key or key pair.
|
||||
*
|
||||
* \param key Slot where the key will be stored. This must be a
|
||||
* valid slot for a key of the chosen type. It must
|
||||
* be unoccupied.
|
||||
* \param type Key type (a \c PSA_KEY_TYPE_XXX value).
|
||||
* \param bits Key size in bits.
|
||||
* \param parameters Extra parameters for key generation. The interpretation
|
||||
* of this parameter depends on \c type. All types support
|
||||
* \c NULL to use default parameters specified below.
|
||||
* \param key Slot where the key will be stored. This must be a
|
||||
* valid slot for a key of the chosen type. It must
|
||||
* be unoccupied.
|
||||
* \param type Key type (a \c PSA_KEY_TYPE_XXX value).
|
||||
* \param bits Key size in bits.
|
||||
* \param parameters 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 \param parameters
|
||||
* points to, in bytes.
|
||||
*
|
||||
* For any symmetric key type (type such that
|
||||
* `PSA_KEY_TYPE_IS_ASYMMETRIC(type)` is false), \c parameters must be
|
||||
|
@ -1878,7 +1881,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);
|
||||
const void *parameters,
|
||||
size_t parameters_size);
|
||||
|
||||
/**@}*/
|
||||
|
||||
|
|
Loading…
Reference in a new issue