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.
@@ -1851,9 +1851,12 @@ 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 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 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);
/**@}*/
