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