pub unsafe extern "C" fn mbedtls_ecdsa_write_signature_restartable(
ctx: *mut mbedtls_ecp_keypair,
md_alg: u32,
hash: *const u8,
hlen: usize,
sig: *mut u8,
sig_size: usize,
slen: *mut usize,
f_rng: Option<unsafe extern "C" fn(_: *mut c_void, _: *mut u8, _: usize) -> i32>,
p_rng: *mut c_void,
rs_ctx: *mut c_void,
) -> i32
Expand description
\brief This function computes the ECDSA signature and writes it to a buffer, in a restartable way.
\see \c mbedtls_ecdsa_write_signature()
\note This function is like \c mbedtls_ecdsa_write_signature() but it can return early and restart according to the limit set with \c mbedtls_ecp_set_max_ops() to reduce blocking.
\param ctx The ECDSA context to use. This must be initialized and have a group and private key bound to it, for example via mbedtls_ecdsa_genkey() or mbedtls_ecdsa_from_keypair(). \param md_alg The message digest that was used to hash the message. \param hash The message hash to be signed. This must be a readable buffer of length \p hlen Bytes. \param hlen The length of the hash \p hash in Bytes. \param sig The buffer to which to write the signature. This must be a writable buffer of length at least twice as large as the size of the curve used, plus 9. For example, 73 Bytes if a 256-bit curve is used. A buffer length of #MBEDTLS_ECDSA_MAX_LEN is always safe. \param sig_size The size of the \p sig buffer in bytes. \param slen The address at which to store the actual length of the signature written. Must not be \c NULL. \param f_rng The RNG function. This must not be \c NULL if #MBEDTLS_ECDSA_DETERMINISTIC is unset. Otherwise, it is unused and may be set to \c NULL. \param p_rng The RNG context to be passed to \p f_rng. This may be \c NULL if \p f_rng is \c NULL or doesn’t use a context. \param rs_ctx The restart context to use. This may be \c NULL to disable restarting. If it is not \c NULL, it must point to an initialized restart context.
\return \c 0 on success. \return #MBEDTLS_ERR_ECP_IN_PROGRESS if maximum number of operations was reached: see \c mbedtls_ecp_set_max_ops(). \return Another \c MBEDTLS_ERR_ECP_XXX, \c MBEDTLS_ERR_MPI_XXX or \c MBEDTLS_ERR_ASN1_XXX error code on failure.