mbedtls_x509_crt_verify_with_profile() function
Verify a chain of certificates with respect to a configurable security profile.
Syntax
int mbedtls_x509_crt_verify_with_profile(mbedtls_x509_crt *crt,
mbedtls_x509_crt *trust_ca,
mbedtls_x509_crl *ca_crl,
const mbedtls_x509_crt_profile *profile,
const char *cn,
uint32_t *flags,
int (*f_vrfy)(void *, mbedtls_x509_crt *, int, uint32_t *),
void *p_vrfy);
Arguments
crt
The certificate chain to be verified.
trust_ca
The list of trusted CAs.
ca_crl
The list of CRLs for trusted CAs.
profile
The security profile to use for the verification.
cn
The expected Common Name. This may be \c NULL if the CN need not be verified.
flags
The address at which to store the result of the verification. If the verification couldn't be completed, the flag value is set to (uint32_t) -1.
f_vrfy
The verification callback to use. See the documentation of mbedtls_x509_crt_verify() for more information.
p_vrfy
The context to be passed to \p f_vrfy.
Return value
\c 0 if the chain is valid with respect to the passed CN, CAs, CRLs and security profile. #MBEDTLS_ERR_X509_CERT_VERIFY_FAILED in case the certificate chain verification failed. In this case, \c *flags will have one or more \c MBEDTLS_X509_BADCERT_XXX or \c MBEDTLS_X509_BADCRL_XXX flags set. Another negative error code in case of a fatal error encountered during the verification process.
Notes
Same as \c mbedtls_x509_crt_verify(), but with explicit security profile. The restrictions on keys (RSA minimum size, allowed curves for ECDSA) apply to all certificates: trusted root, intermediate CAs if any, and end entity certificate.