Paul Bakker | 0f90d7d | 2014-04-30 11:49:44 +0200 | [diff] [blame] | 1 | /* |
| 2 | * Version feature information |
| 3 | * |
Manuel Pégourié-Gonnard | a658a40 | 2015-01-23 09:45:19 +0000 | [diff] [blame] | 4 | * Copyright (C) 2006-2014, ARM Limited, All Rights Reserved |
Paul Bakker | 0f90d7d | 2014-04-30 11:49:44 +0200 | [diff] [blame] | 5 | * |
Manuel Pégourié-Gonnard | 860b516 | 2015-01-28 17:12:07 +0000 | [diff] [blame] | 6 | * This file is part of mbed TLS (https://polarssl.org) |
Paul Bakker | 0f90d7d | 2014-04-30 11:49:44 +0200 | [diff] [blame] | 7 | * |
Paul Bakker | 0f90d7d | 2014-04-30 11:49:44 +0200 | [diff] [blame] | 8 | * This program is free software; you can redistribute it and/or modify |
| 9 | * it under the terms of the GNU General Public License as published by |
| 10 | * the Free Software Foundation; either version 2 of the License, or |
| 11 | * (at your option) any later version. |
| 12 | * |
| 13 | * This program is distributed in the hope that it will be useful, |
| 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 | * GNU General Public License for more details. |
| 17 | * |
| 18 | * You should have received a copy of the GNU General Public License along |
| 19 | * with this program; if not, write to the Free Software Foundation, Inc., |
| 20 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
| 21 | */ |
| 22 | |
Manuel Pégourié-Gonnard | cef4ad2 | 2014-04-29 12:39:06 +0200 | [diff] [blame] | 23 | #if !defined(POLARSSL_CONFIG_FILE) |
Paul Bakker | 0f90d7d | 2014-04-30 11:49:44 +0200 | [diff] [blame] | 24 | #include "polarssl/config.h" |
Manuel Pégourié-Gonnard | cef4ad2 | 2014-04-29 12:39:06 +0200 | [diff] [blame] | 25 | #else |
| 26 | #include POLARSSL_CONFIG_FILE |
| 27 | #endif |
Paul Bakker | 0f90d7d | 2014-04-30 11:49:44 +0200 | [diff] [blame] | 28 | |
| 29 | #if defined(POLARSSL_VERSION_C) |
| 30 | |
| 31 | #include "polarssl/version.h" |
| 32 | |
| 33 | #include <string.h> |
| 34 | |
Paul Bakker | 2ca1dc8 | 2014-04-30 17:01:25 +0200 | [diff] [blame] | 35 | #if defined(_MSC_VER) && !defined strcasecmp && !defined(EFIX64) && \ |
Paul Bakker | 0f90d7d | 2014-04-30 11:49:44 +0200 | [diff] [blame] | 36 | !defined(EFI32) |
Paul Bakker | 2ca1dc8 | 2014-04-30 17:01:25 +0200 | [diff] [blame] | 37 | #define strcasecmp _stricmp |
Paul Bakker | 0f90d7d | 2014-04-30 11:49:44 +0200 | [diff] [blame] | 38 | #endif |
| 39 | |
Manuel Pégourié-Gonnard | 385069f | 2015-03-05 15:47:55 +0000 | [diff] [blame^] | 40 | static const char *features[] = { |
Paul Bakker | 790e395 | 2014-04-30 16:48:32 +0200 | [diff] [blame] | 41 | #if defined(POLARSSL_VERSION_FEATURES) |
Paul Bakker | 0f90d7d | 2014-04-30 11:49:44 +0200 | [diff] [blame] | 42 | FEATURE_DEFINES |
Paul Bakker | 9af723c | 2014-05-01 13:03:14 +0200 | [diff] [blame] | 43 | #endif /* POLARSSL_VERSION_FEATURES */ |
Paul Bakker | 0f90d7d | 2014-04-30 11:49:44 +0200 | [diff] [blame] | 44 | NULL |
| 45 | }; |
| 46 | |
| 47 | int version_check_feature( const char *feature ) |
| 48 | { |
| 49 | const char **idx = features; |
| 50 | |
Paul Bakker | 790e395 | 2014-04-30 16:48:32 +0200 | [diff] [blame] | 51 | if( *idx == NULL ) |
| 52 | return( -2 ); |
| 53 | |
Paul Bakker | 0f90d7d | 2014-04-30 11:49:44 +0200 | [diff] [blame] | 54 | if( feature == NULL ) |
| 55 | return( -1 ); |
| 56 | |
| 57 | while( *idx != NULL ) |
| 58 | { |
| 59 | if( !strcasecmp( *idx, feature ) ) |
| 60 | return( 0 ); |
| 61 | idx++; |
| 62 | } |
| 63 | return( -1 ); |
| 64 | } |
| 65 | |
| 66 | #endif /* POLARSSL_VERSION_C */ |