mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-07-30 22:43:08 +03:00
version_check_feature() added to check for compile-time options at run-time
This commit is contained in:
@ -955,6 +955,19 @@
|
||||
*/
|
||||
//#define POLARSSL_THREADING_PTHREAD
|
||||
|
||||
/**
|
||||
* \def POLARSSL_VERSION_FEATURES
|
||||
*
|
||||
* Allow run-time checking of compile-time enabled features. Thus allowing users
|
||||
* to check at run-time if the library is for instance compiled with threading
|
||||
* support via version_check_feature().
|
||||
*
|
||||
* Requires: POLARSSL_VERSION_C
|
||||
*
|
||||
* Comment this to disable run-time checking and save ROM space
|
||||
*/
|
||||
#define POLARSSL_VERSION_FEATURES
|
||||
|
||||
/**
|
||||
* \def POLARSSL_X509_ALLOW_EXTENSIONS_NON_V3
|
||||
*
|
||||
@ -2100,9 +2113,11 @@
|
||||
/* Debug options */
|
||||
//#define POLARSSL_DEBUG_DFL_MODE POLARSSL_DEBUG_LOG_FULL /**< Default log: Full or Raw */
|
||||
|
||||
/* \} name */
|
||||
/* \} name SECTION: Module configuration options */
|
||||
|
||||
/*
|
||||
/**
|
||||
* \name SECTION: Sanity checks
|
||||
*
|
||||
* Sanity checks on defines and dependencies
|
||||
*/
|
||||
#if defined(POLARSSL_AESNI_C) && !defined(POLARSSL_HAVE_ASM)
|
||||
@ -2355,6 +2370,10 @@
|
||||
#endif
|
||||
#undef POLARSSL_THREADING_IMPL
|
||||
|
||||
#if defined(POLARSSL_VERSION_FEATURES) && !defined(POLARSSL_VERSION_C)
|
||||
#error "POLARSSL_VERSION_FEATURES defined, but not all prerequisites"
|
||||
#endif
|
||||
|
||||
#if defined(POLARSSL_X509_USE_C) && ( !defined(POLARSSL_BIGNUM_C) || \
|
||||
!defined(POLARSSL_OID_C) || !defined(POLARSSL_ASN1_PARSE_C) || \
|
||||
!defined(POLARSSL_PK_PARSE_C) )
|
||||
@ -2387,4 +2406,6 @@
|
||||
#error "POLARSSL_X509_CSR_WRITE_C defined, but not all prerequisites"
|
||||
#endif
|
||||
|
||||
/* \} name SECTION: Sanity checks */
|
||||
|
||||
#endif /* config.h */
|
||||
|
@ -3,7 +3,7 @@
|
||||
*
|
||||
* \brief Run-time version information
|
||||
*
|
||||
* Copyright (C) 2006-2013, Brainspark B.V.
|
||||
* Copyright (C) 2006-2014, Brainspark B.V.
|
||||
*
|
||||
* This file is part of PolarSSL (http://www.polarssl.org)
|
||||
* Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org>
|
||||
@ -83,6 +83,22 @@ void version_get_string( char *string );
|
||||
*/
|
||||
void version_get_string_full( char *string );
|
||||
|
||||
/**
|
||||
* \brief Check if support for a feature was compiled into this
|
||||
* PolarSSL binary. This allows you to see at runtime if the
|
||||
* library was for instance compiled with or without
|
||||
* Multi-threading support.
|
||||
*
|
||||
* Note: only checks against defines in the sections "System
|
||||
* support", "PolarSSL modules" and "PolarSSL feature
|
||||
* support" in config.h
|
||||
*
|
||||
* \param feature The string for the define to check (e.g. "POLARSSL_AES_C")
|
||||
*
|
||||
* \return 0 if the feature is present, -1 if not.
|
||||
*/
|
||||
int version_check_feature( const char *feature );
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user