mbedtls_pk_sign_ext() function
Make signature given a signature type.
Syntax
int mbedtls_pk_sign_ext(mbedtls_pk_type_t pk_type,
mbedtls_pk_context *ctx,
mbedtls_md_type_t md_alg,
const unsigned char *hash,
size_t hash_len,
unsigned char *sig,
size_t sig_size,
size_t *sig_len,
int (*f_rng)(void *, unsigned char *, size_t),
void *p_rng);
Arguments
ctx
The PK context to use. It must have been set up with a private key.
md_alg
Hash algorithm used (see notes)
hash
Hash of the message to sign
sig
Place to write the signature. It must have enough room for the signature. #MBEDTLS_PK_SIGNATURE_MAX_SIZE is always enough. You may use a smaller buffer if it is large enough given the key type.
sig_size
The size of the \p sig buffer in bytes.
sig_len
On successful return, the number of bytes written to \p sig.
f_rng
RNG function, must not be \c NULL.
Return value
0 on success, or a specific error code.
Notes
When \p pk_type is #MBEDTLS_PK_RSASSA_PSS, see #PSA_ALG_RSA_PSS for a description of PSS options used. For RSA, md_alg may be MBEDTLS_MD_NONE if hash_len != 0. For ECDSA, md_alg may never be MBEDTLS_MD_NONE.
mbedtls_pk_sign_ext() calls 6 functions:
![]()
mbedtls_pk_sign_ext()
mbedtls_pk_sign_ext() reads 3 variables:
![]()
mbedtls_pk_sign_ext()