blob: 500e026c7e4176ec502e63aeabc171c6ad8de3ef [file] [log] [blame]
Paul Bakker0f90d7d2014-04-30 11:49:44 +02001/*
2 * Version feature information
3 *
Manuel Pégourié-Gonnarda658a402015-01-23 09:45:19 +00004 * Copyright (C) 2006-2014, ARM Limited, All Rights Reserved
Paul Bakker0f90d7d2014-04-30 11:49:44 +02005 *
Manuel Pégourié-Gonnardfe446432015-03-06 13:17:10 +00006 * This file is part of mbed TLS (https://tls.mbed.org)
Paul Bakker0f90d7d2014-04-30 11:49:44 +02007 *
Paul Bakker0f90d7d2014-04-30 11:49:44 +02008 * 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é-Gonnardcef4ad22014-04-29 12:39:06 +020023#if !defined(POLARSSL_CONFIG_FILE)
Paul Bakker0f90d7d2014-04-30 11:49:44 +020024#include "polarssl/config.h"
Manuel Pégourié-Gonnardcef4ad22014-04-29 12:39:06 +020025#else
26#include POLARSSL_CONFIG_FILE
27#endif
Paul Bakker0f90d7d2014-04-30 11:49:44 +020028
29#if defined(POLARSSL_VERSION_C)
30
31#include "polarssl/version.h"
32
33#include <string.h>
34
Paul Bakker2ca1dc82014-04-30 17:01:25 +020035#if defined(_MSC_VER) && !defined strcasecmp && !defined(EFIX64) && \
Paul Bakker0f90d7d2014-04-30 11:49:44 +020036 !defined(EFI32)
Paul Bakker2ca1dc82014-04-30 17:01:25 +020037#define strcasecmp _stricmp
Paul Bakker0f90d7d2014-04-30 11:49:44 +020038#endif
39
Manuel Pégourié-Gonnard385069f2015-03-05 15:47:55 +000040static const char *features[] = {
Paul Bakker790e3952014-04-30 16:48:32 +020041#if defined(POLARSSL_VERSION_FEATURES)
Paul Bakker0f90d7d2014-04-30 11:49:44 +020042FEATURE_DEFINES
Paul Bakker9af723c2014-05-01 13:03:14 +020043#endif /* POLARSSL_VERSION_FEATURES */
Paul Bakker0f90d7d2014-04-30 11:49:44 +020044 NULL
45};
46
47int version_check_feature( const char *feature )
48{
49 const char **idx = features;
50
Paul Bakker790e3952014-04-30 16:48:32 +020051 if( *idx == NULL )
52 return( -2 );
53
Paul Bakker0f90d7d2014-04-30 11:49:44 +020054 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 */