mbedtls_rsa_rsassa_pkcs1_v15_sign() function
This function performs a PKCS#1 v1.5 signature operation (RSASSA-PKCS1-v1_5-SIGN). \deprecated It is deprecated and discouraged to call this function in #MBEDTLS_RSA_PUBLIC mode. Future versions of the library are likely to remove the \p mode argument and have it implicitly set to #MBEDTLS_RSA_PRIVATE.
Arguments
ctx
The initialized RSA context to use.
f_rng
The RNG function. If \p mode is #MBEDTLS_RSA_PRIVATE, this is used for blinding and should be provided; see mbedtls_rsa_private() for more. If \p mode is #MBEDTLS_RSA_PUBLIC, it is ignored.
p_rng
The RNG context to be passed to \p f_rng. This may be \c NULL if \p f_rng is \c NULL or doesn't need a context argument.
mode
The mode of operation. This must be either #MBEDTLS_RSA_PRIVATE or #MBEDTLS_RSA_PUBLIC (deprecated).
md_alg
The message-digest algorithm used to hash the original data. Use #MBEDTLS_MD_NONE for signing raw data.
hashlen
The length of the message digest. Ths is only used if \p md_alg is #MBEDTLS_MD_NONE.
hash
The buffer holding the message digest or raw data. If \p md_alg is #MBEDTLS_MD_NONE, this must be a readable buffer of length \p hashlen Bytes. If \p md_alg is not #MBEDTLS_MD_NONE, it must be a readable buffer of length the size of the hash corresponding to \p md_alg.
sig
The buffer to hold the signature. This must be a writable buffer of length \c ctx->len Bytes. For example, \c 256 Bytes for an 2048-bit RSA modulus.
Return value
\c 0 if the signing operation was successful. An \c MBEDTLS_ERR_RSA_XXX error code on failure.
Notes
Alternative implementations of RSA need not support mode being set to #MBEDTLS_RSA_PUBLIC and might instead return #MBEDTLS_ERR_PLATFORM_FEATURE_UNSUPPORTED.