pub unsafe extern "C" fn mbedtls_ecdh_calc_secret(
    ctx: *mut mbedtls_ecdh_context,
    olen: *mut usize,
    buf: *mut u8,
    blen: usize,
    f_rng: Option<unsafe extern "C" fn(_: *mut c_void, _: *mut u8, _: usize) -> i32>,
    p_rng: *mut c_void
) -> i32
Expand description

\brief This function derives and exports the shared secret.

             This is the last function used by both TLS client
             and servers.

\note If \p f_rng is not NULL, it is used to implement countermeasures against side-channel attacks. For more information, see mbedtls_ecp_mul().

\see ecp.h

\param ctx The ECDH context to use. This must be initialized and have its own private key generated and the peer’s public key imported. \param olen The address at which to store the total number of Bytes written on success. This must not be \c NULL. \param buf The buffer to write the generated shared key to. This must be a writable buffer of size \p blen Bytes. \param blen The length of the destination buffer \p buf in Bytes. \param f_rng The RNG function to use. This must not be \c NULL. \param p_rng The RNG context. This may be \c NULL if \p f_rng doesn’t need a context argument.

\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 error code on failure.