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.
diff --git a/include/psa/crypto.h b/include/psa/crypto.h
index 28103c7..204ac26 100644
--- a/include/psa/crypto.h
+++ b/include/psa/crypto.h
@@ -1846,14 +1846,17 @@
/**
* \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_key(psa_key_slot_t key,
psa_key_type_t type,
size_t bits,
- const void *parameters);
+ const void *parameters,
+ size_t parameters_size);
/**@}*/