The ECDSA context to use. This must be initialized and have a group and public key bound to it.
hash
constunsignedchar*
The message hash that was signed. This must be a readable buffer of length \p hlen Bytes.
hlen
size_t
The size of the hash \p hash.
sig
constunsignedchar*
The signature to read and verify. This must be a readable buffer of length \p slen Bytes.
slen
size_t
The size of \p sig in Bytes.
Return value
\c 0 on success. #MBEDTLS_ERR_ECP_BAD_INPUT_DATA if signature is invalid. #MBEDTLS_ERR_ECP_SIG_LEN_MISMATCH if there is a valid signature in \p sig, but its length is less than \p siglen. An \c MBEDTLS_ERR_ECP_XXX or \c MBEDTLS_ERR_MPI_XXX error code on failure for any other reason.
Notes
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.
This function sets up an ECDH context from an EC key. It is used by clients and servers in place of the ServerKeyExchange for static ECDH, and imports ECDH parameters from the EC key information of a certificate. \see ecp.h
This function computes the ECDSA signature and writes it to a buffer, serialized as defined in RFC-4492: Elliptic Curve Cryptography (ECC) Cipher Suites for Transport Layer Security (TLS). \warning It is not thread-safe to use the same context in multiple threads. \see ecp.h
This function checks that the keypair objects \p pub and \p prv have the same group and the same public point, and that the private key in \p prv is consistent with the public key.
This function sets up an x25519 context from an EC key. It is used by clients and servers in place of the ServerKeyEchange for static ECDH, and imports ECDH parameters from the EC key information of a certificate. \see ecp.h
This function sets up an ECDH context from an EC key. It is used by clients and servers in place of the ServerKeyEchange for static ECDH, and imports ECDH parameters from the EC key information of a certificate. \see ecp.h
Examples
mbedtls_ecdsa_read_signature() is referenced by 1 libraries and example projects: