mbedtls_dhm_make_public() function
This function creates a DHM key pair and exports the raw public key in big-endian format.
Arguments
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.
x_size
The private key size in Bytes.
output
The destination buffer. This must be a writable buffer of size \p olen Bytes.
olen
The length of the destination buffer. This must be at least equal to `ctx->len` (the size of \c P).
f_rng
The RNG function. This must not be \c NULL.
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 value
\c 0 on success. An \c MBEDTLS_ERR_DHM_XXX error code on failure.
Notes
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.
mbedtls_dhm_make_public() is called by 1 function and calls 4 functions:
![]()
mbedtls_dhm_make_public()
mbedtls_dhm_make_public():
![]()
mbedtls_dhm_make_public()