Function esp_idf_sys::mbedtls_ecp_read_key
source ยท pub unsafe extern "C" fn mbedtls_ecp_read_key(
grp_id: mbedtls_ecp_group_id,
key: *mut mbedtls_ecp_keypair,
buf: *const c_uchar,
buflen: usize,
) -> c_int
Expand description
\brief This function reads an elliptic curve private key.
\note This function does not set the public key in the key pair object. Without a public key, the key pair object cannot be used with operations that require the public key. Call mbedtls_ecp_keypair_calc_public() to set the public key from the private key. Alternatively, you can call mbedtls_ecp_set_public_key() to set the public key part, and then optionally mbedtls_ecp_check_pub_priv() to check that the private and public parts are consistent.
\note If a public key has already been set in the key pair object, this function does not check that it is consistent with the private key. Call mbedtls_ecp_check_pub_priv() after setting both the public key and the private key to make that check.
\param grp_id The ECP group identifier. \param key The destination key. \param buf The buffer containing the binary representation of the key. (Big endian integer for Weierstrass curves, byte string for Montgomery curves.) \param buflen The length of the buffer in bytes.
\return \c 0 on success. \return #MBEDTLS_ERR_ECP_INVALID_KEY error if the key is invalid. \return #MBEDTLS_ERR_MPI_ALLOC_FAILED if memory allocation failed. \return #MBEDTLS_ERR_ECP_FEATURE_UNAVAILABLE if the operation for the group is not implemented. \return Another negative error code on different kinds of failure.