# Function esp_idf_svc::hal::sys::mbedtls_rsa_complete

source ยท ```
pub unsafe extern "C" fn mbedtls_rsa_complete(
ctx: *mut mbedtls_rsa_context,
) -> i32
```

## Expand description

\brief This function completes an RSA context from a set of imported core parameters.

```
To setup an RSA public key, precisely \c N and \c E
must have been imported.
To setup an RSA private key, sufficient information must
be present for the other parameters to be derivable.
The default implementation supports the following:
<ul><li>Derive \c P, \c Q from \c N, \c D, \c E.</li>
<li>Derive \c N, \c D from \c P, \c Q, \c E.</li></ul>
Alternative implementations need not support these.
If this function runs successfully, it guarantees that
the RSA context can be used for RSA operations without
the risk of failure or crash.
```

\warning This function need not perform consistency checks for the imported parameters. In particular, parameters that are not needed by the implementation might be silently discarded and left unchecked. To check the consistency of the key material, see mbedtls_rsa_check_privkey().

\param ctx The initialized RSA context holding imported parameters.

\return \c 0 on success. \return #MBEDTLS_ERR_RSA_BAD_INPUT_DATA if the attempted derivations failed.