mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-04-18 05:42:35 +00:00
x509: Added mbedtls_x509_crt_get_ca_istrue()
API accessor.
Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
This commit is contained in:
parent
e33b349c90
commit
2abbac74dc
@ -916,6 +916,18 @@ static inline int mbedtls_x509_crt_has_ext_type(const mbedtls_x509_crt *ctx,
|
|||||||
return ctx->MBEDTLS_PRIVATE(ext_types) & ext_type;
|
return ctx->MBEDTLS_PRIVATE(ext_types) & ext_type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Access the ca_istrue field
|
||||||
|
*
|
||||||
|
* \param[in] crt Certificate to be queried, must not be \c NULL
|
||||||
|
*
|
||||||
|
* \return \c 1 if this a CA certificate \c 0 otherwise.
|
||||||
|
* \return MBEDTLS_ERR_X509_INVALID_EXTENSIONS if the certificate does not support
|
||||||
|
* the Optional Basic Constraint extension.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
int mbedtls_x509_crt_get_ca_istrue(const mbedtls_x509_crt *crt);
|
||||||
|
|
||||||
/** \} name Structures and functions for parsing and writing X.509 certificates */
|
/** \} name Structures and functions for parsing and writing X.509 certificates */
|
||||||
|
|
||||||
#if defined(MBEDTLS_X509_CRT_WRITE_C)
|
#if defined(MBEDTLS_X509_CRT_WRITE_C)
|
||||||
|
@ -3290,4 +3290,12 @@ void mbedtls_x509_crt_restart_free(mbedtls_x509_crt_restart_ctx *ctx)
|
|||||||
}
|
}
|
||||||
#endif /* MBEDTLS_ECDSA_C && MBEDTLS_ECP_RESTARTABLE */
|
#endif /* MBEDTLS_ECDSA_C && MBEDTLS_ECP_RESTARTABLE */
|
||||||
|
|
||||||
|
int mbedtls_x509_crt_get_ca_istrue(const mbedtls_x509_crt *crt)
|
||||||
|
{
|
||||||
|
if ((crt->ext_types & MBEDTLS_X509_EXT_BASIC_CONSTRAINTS) != 0) {
|
||||||
|
return crt->MBEDTLS_PRIVATE(ca_istrue);
|
||||||
|
}
|
||||||
|
return MBEDTLS_ERR_X509_INVALID_EXTENSIONS;
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* MBEDTLS_X509_CRT_PARSE_C */
|
#endif /* MBEDTLS_X509_CRT_PARSE_C */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user