Function esp_idf_sys::mbedtls_ecp_mul
source · pub unsafe extern "C" fn mbedtls_ecp_mul(
grp: *mut mbedtls_ecp_group,
R: *mut mbedtls_ecp_point,
m: *const mbedtls_mpi,
P: *const mbedtls_ecp_point,
f_rng: Option<unsafe extern "C" fn(arg1: *mut c_void, arg2: *mut c_uchar, arg3: usize) -> c_int>,
p_rng: *mut c_void,
) -> c_int
Expand description
\brief This function performs a scalar multiplication of a point by an integer: \p R = \p m * \p P.
It is not thread-safe to use same group in multiple threads.
\note To prevent timing attacks, this function executes the exact same sequence of base-field operations for any valid \p m. It avoids any if-branch or array index depending on the value of \p m. It also uses \p f_rng to randomize some intermediate results.
\param grp The ECP group to use. This must be initialized and have group parameters set, for example through mbedtls_ecp_group_load(). \param R The point in which to store the result of the calculation. This must be initialized. \param m The integer by which to multiply. This must be initialized. \param P The point to multiply. This must be initialized. \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.
\return \c 0 on success. \return #MBEDTLS_ERR_ECP_INVALID_KEY if \p m is not a valid private key, or \p P is not a valid public key. \return #MBEDTLS_ERR_MPI_ALLOC_FAILED on memory-allocation failure. \return Another negative error code on other kinds of failure.