1
0
mirror of https://github.com/Mbed-TLS/mbedtls.git synced 2025-08-01 10:06:53 +03:00

Merge pull request #5887 from tom-daubney-arm/mbedtls_x509_crt_ext_types_accessor

Add accessor for x509 certificate extension types
This commit is contained in:
Dave Rodgman
2022-06-06 21:51:38 +01:00
committed by GitHub
4 changed files with 44 additions and 0 deletions

View File

@ -957,6 +957,23 @@ void mbedtls_x509_crt_restart_free( mbedtls_x509_crt_restart_ctx *ctx );
#endif /* MBEDTLS_ECDSA_C && MBEDTLS_ECP_RESTARTABLE */
#endif /* MBEDTLS_X509_CRT_PARSE_C */
/**
* \brief Query certificate for given extension type
*
* \param[in] ctx Certificate context to be queried, must not be \c NULL
* \param ext_type Extension type being queried for, must be a valid
* extension type. Must be one of the MBEDTLS_X509_EXT_XXX
* values
*
* \return 0 if the given extension type is not present,
* non-zero otherwise
*/
static inline int mbedtls_x509_crt_has_ext_type( const mbedtls_x509_crt *ctx,
int ext_type )
{
return ctx->MBEDTLS_PRIVATE(ext_types) & ext_type;
}
/** \} name Structures and functions for parsing and writing X.509 certificates */
#if defined(MBEDTLS_X509_CRT_WRITE_C)