Function esp_idf_svc::sys::mbedtls_ecdsa_read_signature

source ยท
pub unsafe extern "C" fn mbedtls_ecdsa_read_signature(
    ctx: *mut mbedtls_ecp_keypair,
    hash: *const u8,
    hlen: usize,
    sig: *const u8,
    slen: usize,
) -> i32
Expand description

\brief This function reads and verifies an ECDSA signature.

\note If the bitlength of the message hash is larger than the bitlength of the group order, then the hash is truncated as defined in Standards for Efficient Cryptography Group (SECG): SEC1 Elliptic Curve Cryptography, section 4.1.4, step 3.

\see ecp.h

\param ctx The ECDSA context to use. This must be initialized and have a group and public key bound to it. \param hash The message hash that was signed. This must be a readable buffer of length \p hlen Bytes. \param hlen The size of the hash \p hash. \param sig The signature to read and verify. This must be a readable buffer of length \p slen Bytes. \param slen The size of \p sig in Bytes.

\return \c 0 on success. \return #MBEDTLS_ERR_ECP_BAD_INPUT_DATA if signature is invalid. \return #MBEDTLS_ERR_ECP_SIG_LEN_MISMATCH if there is a valid signature in \p sig, but its length is less than \p siglen. \return An \c MBEDTLS_ERR_ECP_XXX or \c MBEDTLS_ERR_MPI_XXX error code on failure for any other reason.