Function esp_idf_svc::hal::sys::mbedtls_rsa_gen_key

source ·
pub unsafe extern "C" fn mbedtls_rsa_gen_key(
    ctx: *mut mbedtls_rsa_context,
    f_rng: Option<unsafe extern "C" fn(_: *mut c_void, _: *mut u8, _: usize) -> i32>,
    p_rng: *mut c_void,
    nbits: u32,
    exponent: i32,
) -> i32
Expand description

\brief This function generates an RSA keypair.

\note mbedtls_rsa_init() must be called before this function, to set up the RSA context.

\param ctx The initialized RSA context used to hold the key. \param f_rng The RNG function to be used for key generation. This is mandatory and 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. \param nbits The size of the public key in bits. \param exponent The public exponent to use. For example, \c 65537. This must be odd and greater than \c 1.

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