Function esp_idf_hal::sys::mbedtls_rsa_export_raw

source ยท
pub unsafe extern "C" fn mbedtls_rsa_export_raw(
    ctx: *const mbedtls_rsa_context,
    N: *mut u8,
    N_len: usize,
    P: *mut u8,
    P_len: usize,
    Q: *mut u8,
    Q_len: usize,
    D: *mut u8,
    D_len: usize,
    E: *mut u8,
    E_len: usize,
) -> i32
Expand description

\brief This function exports core parameters of an RSA key in raw big-endian binary format.

            If this function runs successfully, the non-NULL buffers
            pointed to by \p N, \p P, \p Q, \p D, and \p E are fully
            written, with additional unused space filled leading by
            zero Bytes.

            Possible reasons for returning
            #MBEDTLS_ERR_PLATFORM_FEATURE_UNSUPPORTED:<ul>
            <li>An alternative RSA implementation is in use, which
            stores the key externally, and either cannot or should
            not export it into RAM.</li>
            <li>A SW or HW implementation might not support a certain
            deduction. For example, \p P, \p Q from \p N, \p D,
            and \p E if the former are not part of the
            implementation.</li></ul>
            If the function fails due to an unsupported operation,
            the RSA context stays intact and remains usable.

\note The length parameters are ignored if the corresponding buffer pointers are NULL.

\param ctx The initialized RSA context. \param N The Byte array to store the RSA modulus, or \c NULL if this field need not be exported. \param N_len The size of the buffer for the modulus. \param P The Byte array to hold the first prime factor of \p N, or \c NULL if this field need not be exported. \param P_len The size of the buffer for the first prime factor. \param Q The Byte array to hold the second prime factor of \p N, or \c NULL if this field need not be exported. \param Q_len The size of the buffer for the second prime factor. \param D The Byte array to hold the private exponent, or \c NULL if this field need not be exported. \param D_len The size of the buffer for the private exponent. \param E The Byte array to hold the public exponent, or \c NULL if this field need not be exported. \param E_len The size of the buffer for the public exponent.

\return \c 0 on success. \return #MBEDTLS_ERR_PLATFORM_FEATURE_UNSUPPORTED if exporting the requested parameters cannot be done due to missing functionality or because of security policies. \return A non-zero return code on any other failure.