Function esp_idf_svc::sys::psa_generate_key_ext

source ·
pub unsafe extern "C" fn psa_generate_key_ext(
    attributes: *const psa_key_attributes_s,
    params: *const psa_key_production_parameters_s,
    params_data_length: usize,
    key: *mut u32,
) -> i32
Expand description

\brief Generate a key or key pair using custom production parameters.

See the description of psa_generate_key() for the operation of this function with the default production parameters. In addition, this function supports the following production customizations, described in more detail in the documentation of ::psa_key_production_parameters_t:

  • RSA keys: generation with a custom public exponent.

\note This function is experimental and may change in future minor versions of Mbed TLS.

\param[in] attributes The attributes for the new key. \param[in] params Customization parameters for the key generation. When this is #PSA_KEY_PRODUCTION_PARAMETERS_INIT with \p params_data_length = 0, this function is equivalent to psa_generate_key(). \param params_data_length Length of params->data in bytes. \param[out] key On success, an identifier for the newly created key. For persistent keys, this is the key identifier defined in \p attributes. \c 0 on failure.

\retval #PSA_SUCCESS Success. If the key is persistent, the key material and the key’s metadata have been saved to persistent storage. \retval #PSA_ERROR_ALREADY_EXISTS This is an attempt to create a persistent key, and there is already a persistent key with the given identifier. \retval #PSA_ERROR_NOT_SUPPORTED \emptydescription \retval #PSA_ERROR_INVALID_ARGUMENT \emptydescription \retval #PSA_ERROR_INSUFFICIENT_MEMORY \emptydescription \retval #PSA_ERROR_INSUFFICIENT_ENTROPY \emptydescription \retval #PSA_ERROR_COMMUNICATION_FAILURE \emptydescription \retval #PSA_ERROR_HARDWARE_FAILURE \emptydescription \retval #PSA_ERROR_CORRUPTION_DETECTED \emptydescription \retval #PSA_ERROR_INSUFFICIENT_STORAGE \emptydescription \retval #PSA_ERROR_DATA_INVALID \emptydescription \retval #PSA_ERROR_DATA_CORRUPT \emptydescription \retval #PSA_ERROR_STORAGE_FAILURE \emptydescription \retval #PSA_ERROR_BAD_STATE The library has not been previously initialized by psa_crypto_init(). It is implementation-dependent whether a failure to initialize results in this error code.