Function esp_idf_svc::sys::mbedtls_rsa_rsaes_oaep_encrypt

source ·
pub unsafe extern "C" fn mbedtls_rsa_rsaes_oaep_encrypt(
    ctx: *mut mbedtls_rsa_context,
    f_rng: Option<unsafe extern "C" fn(_: *mut c_void, _: *mut u8, _: usize) -> i32>,
    p_rng: *mut c_void,
    label: *const u8,
    label_len: usize,
    ilen: usize,
    input: *const u8,
    output: *mut u8,
) -> i32
Expand description

\brief This function performs a PKCS#1 v2.1 OAEP encryption operation (RSAES-OAEP-ENCRYPT).

\note The output buffer must be as large as the size of ctx->N. For example, 128 Bytes if RSA-1024 is used.

\param ctx The initialized RSA context to use. \param f_rng The RNG function to use. This is needed for padding generation and is mandatory. \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. \param label The buffer holding the custom label to use. This must be a readable buffer of length \p label_len Bytes. It may be \c NULL if \p label_len is \c 0. \param label_len The length of the label in Bytes. \param ilen The length of the plaintext buffer \p input in Bytes. \param input The input data to encrypt. This must be a readable buffer of size \p ilen Bytes. It may be \c NULL if ilen == 0. \param output The output buffer. This must be a writable buffer of length \c ctx->len Bytes. For example, \c 256 Bytes for an 2048-bit RSA modulus.

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