Function esp_idf_sys::mbedtls_rsa_set_padding
source ยท pub unsafe extern "C" fn mbedtls_rsa_set_padding(
ctx: *mut mbedtls_rsa_context,
padding: c_int,
hash_id: mbedtls_md_type_t,
) -> c_int
Expand description
\brief This function sets padding for an already initialized RSA context.
\note Set padding to #MBEDTLS_RSA_PKCS_V21 for the RSAES-OAEP encryption scheme and the RSASSA-PSS signature scheme.
\note The \p hash_id parameter is ignored when using #MBEDTLS_RSA_PKCS_V15 padding.
\note The choice of padding mode is strictly enforced for private key operations, since there might be security concerns in mixing padding modes. For public key operations it is a default value, which can be overridden by calling specific \c mbedtls_rsa_rsaes_xxx or \c mbedtls_rsa_rsassa_xxx functions.
\note The hash selected in \p hash_id is always used for OEAP encryption. For PSS signatures, it is always used for making signatures, but can be overridden for verifying them. If set to #MBEDTLS_MD_NONE, it is always overridden.
\param ctx The initialized RSA context to be configured. \param padding The padding mode to use. This must be either #MBEDTLS_RSA_PKCS_V15 or #MBEDTLS_RSA_PKCS_V21. \param hash_id The hash identifier for PSS or OAEP, if \p padding is #MBEDTLS_RSA_PKCS_V21. #MBEDTLS_MD_NONE is accepted by this function but may be not suitable for some operations. Ignored if \p padding is #MBEDTLS_RSA_PKCS_V15.
\return \c 0 on success. \return #MBEDTLS_ERR_RSA_INVALID_PADDING failure: \p padding or \p hash_id is invalid.