1/* 2 * Version feature information 3 * 4 * Copyright The Mbed TLS Contributors 5 * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later 6 */ 7 8#include "common.h" 9 10#if defined(MBEDTLS_VERSION_C) 11 12#include "mbedtls/version.h" 13 14#include <string.h> 15 16static const char * const features[] = { 17#if defined(MBEDTLS_VERSION_FEATURES) 18 FEATURE_DEFINES 19#endif /* MBEDTLS_VERSION_FEATURES */ 20 NULL 21}; 22 23int mbedtls_version_check_feature(const char *feature) 24{ 25 const char * const *idx = features; 26 27 if (*idx == NULL) { 28 return -2; 29 } 30 31 if (feature == NULL) { 32 return -1; 33 } 34 35 while (*idx != NULL) { 36 if (!strcmp(*idx, feature)) { 37 return 0; 38 } 39 idx++; 40 } 41 return -1; 42} 43 44#endif /* MBEDTLS_VERSION_C */ 45