Function esp_idf_svc::hal::sys::mbedtls_ecdsa_sign_restartable
source · pub unsafe extern "C" fn mbedtls_ecdsa_sign_restartable(
grp: *mut mbedtls_ecp_group,
r: *mut mbedtls_mpi,
s: *mut mbedtls_mpi,
d: *const mbedtls_mpi,
buf: *const u8,
blen: usize,
f_rng: Option<unsafe extern "C" fn(_: *mut c_void, _: *mut u8, _: usize) -> i32>,
p_rng: *mut c_void,
f_rng_blind: Option<unsafe extern "C" fn(_: *mut c_void, _: *mut u8, _: usize) -> i32>,
p_rng_blind: *mut c_void,
rs_ctx: *mut c_void,
) -> i32
Expand description
\brief This function computes the ECDSA signature of a previously-hashed message, in a restartable way.
\note The deterministic version implemented in mbedtls_ecdsa_sign_det_restartable() is usually preferred.
\note This function is like \c mbedtls_ecdsa_sign() but it can return early and restart according to the limit set with \c mbedtls_ecp_set_max_ops() to reduce blocking.
\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.3, step 5.
\see ecp.h
\param grp The context for the elliptic curve to use. This must be initialized and have group parameters set, for example through mbedtls_ecp_group_load(). \param r The MPI context in which to store the first part the signature. This must be initialized. \param s The MPI context in which to store the second part the signature. This must be initialized. \param d The private signing key. This must be initialized and setup, for example through mbedtls_ecp_gen_privkey(). \param buf The hashed content to be signed. This must be a readable buffer of length \p blen Bytes. It may be \c NULL if \p blen is zero. \param blen The length of \p buf in Bytes. \param f_rng The RNG function. This must not be \c NULL. \param p_rng The RNG context to be passed to \p f_rng. This may be \c NULL if \p f_rng doesn’t need a context parameter. \param f_rng_blind The RNG function used for blinding. This must not be \c NULL. \param p_rng_blind The RNG context to be passed to \p f_rng. This may be \c NULL if \p f_rng doesn’t need a context parameter. \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.