Function esp_idf_hal::sys::mbedtls_rsa_rsaes_oaep_decrypt
source · pub unsafe extern "C" fn mbedtls_rsa_rsaes_oaep_decrypt(
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,
olen: *mut usize,
input: *const u8,
output: *mut u8,
output_max_len: usize,
) -> i32
Expand description
\brief This function performs a PKCS#1 v2.1 OAEP decryption operation (RSAES-OAEP-DECRYPT).
\note The output buffer length \c output_max_len should be as large as the size \p ctx->len of \p ctx->N, for example, 128 Bytes if RSA-1024 is used, to be able to hold an arbitrary decrypted message. If it is not large enough to hold the decryption of the particular ciphertext provided, the function returns #MBEDTLS_ERR_RSA_OUTPUT_TOO_LARGE.
\param ctx The initialized RSA context to use. \param f_rng The RNG function. This is used for blinding 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. \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 olen The address at which to store the length of the plaintext. This must not be \c NULL. \param input The ciphertext buffer. This must be a readable buffer of length \c ctx->len Bytes. For example, \c 256 Bytes for an 2048-bit RSA modulus. \param output The buffer used to hold the plaintext. This must be a writable buffer of length \p output_max_len Bytes. \param output_max_len The length in Bytes of the output buffer \p output.
\return \c 0 on success. \return An \c MBEDTLS_ERR_RSA_XXX error code on failure.