Skip to main content

mbedtls_dhm_make_public

Function mbedtls_dhm_make_public 

Source
pub unsafe extern "C" fn mbedtls_dhm_make_public(
    ctx: *mut mbedtls_dhm_context,
    x_size: c_int,
    output: *mut c_uchar,
    olen: usize,
    f_rng: mbedtls_f_rng_t,
    p_rng: *mut c_void,
) -> c_int
Expand description

\brief This function creates a DHM key pair and exports the raw public key in big-endian format.

\note The destination buffer is always fully written so as to contain a big-endian representation of G^X mod P. If it is larger than \c ctx->len, it is padded accordingly with zero-bytes at the beginning.

\param ctx The DHM context to use. This must be initialized and have the DHM parameters set. It may or may not already have imported the peer’s public key. \param x_size The private key size in Bytes. \param output The destination buffer. This must be a writable buffer of size \p olen Bytes. \param olen The length of the destination buffer. This must be at least equal to ctx->len (the size of \c P). \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 argument.

\return \c 0 on success. \return An \c MBEDTLS_ERR_DHM_XXX error code on failure.