Avoid non-standard strcasecmp()

parent 2a84dfd7
......@@ -124,6 +124,12 @@ Default behavior changes
custom config.h
* Default DHM parameters server-side upgraded from 1024 to 2048 bits.
* Negotiation of truncated HMAC is now disabled by default on server too.
* The following functions are now case-sensitive:
mbedtls_cipher_info_from_string()
mbedtls_ecp_curve_info_from_name()
mbedtls_md_info_from_string()
mbedtls_ssl_ciphersuite_from_string()
mbedtls_version_check_feature()
Requirement changes
* The minimum MSVC version required is now 2010 (better C99 support).
......
......@@ -50,11 +50,6 @@
#define MBEDTLS_CIPHER_MODE_STREAM
#endif
#if defined(_MSC_VER) && !defined strcasecmp && !defined(EFIX64) && \
!defined(EFI32)
#define strcasecmp _stricmp
#endif
/* Implementation that should never be optimized out by the compiler */
static void mbedtls_zeroize( void *v, size_t n ) {
volatile unsigned char *p = v; while( n-- ) *p++ = 0;
......@@ -102,7 +97,7 @@ const mbedtls_cipher_info_t *mbedtls_cipher_info_from_string( const char *cipher
return( NULL );
for( def = mbedtls_cipher_definitions; def->info != NULL; def++ )
if( ! strcasecmp( def->info->name, cipher_name ) )
if( ! strcmp( def->info->name, cipher_name ) )
return( def->info );
return( NULL );
......
......@@ -63,11 +63,6 @@
#define mbedtls_free free
#endif
#if defined(_MSC_VER) && !defined strcasecmp && !defined(EFIX64) && \
!defined(EFI32)
#define strcasecmp _stricmp
#endif
#if defined(_MSC_VER) && !defined(inline)
#define inline _inline
#else
......@@ -254,7 +249,7 @@ const mbedtls_ecp_curve_info *mbedtls_ecp_curve_info_from_name( const char *name
curve_info->grp_id != MBEDTLS_ECP_DP_NONE;
curve_info++ )
{
if( strcasecmp( curve_info->name, name ) == 0 )
if( strcmp( curve_info->name, name ) == 0 )
return( curve_info );
}
......
......@@ -101,35 +101,35 @@ const mbedtls_md_info_t *mbedtls_md_info_from_string( const char *md_name )
/* Get the appropriate digest information */
#if defined(MBEDTLS_MD2_C)
if( !strcasecmp( "MD2", md_name ) )
if( !strcmp( "MD2", md_name ) )
return mbedtls_md_info_from_type( MBEDTLS_MD_MD2 );
#endif
#if defined(MBEDTLS_MD4_C)
if( !strcasecmp( "MD4", md_name ) )
if( !strcmp( "MD4", md_name ) )
return mbedtls_md_info_from_type( MBEDTLS_MD_MD4 );
#endif
#if defined(MBEDTLS_MD5_C)
if( !strcasecmp( "MD5", md_name ) )
if( !strcmp( "MD5", md_name ) )
return mbedtls_md_info_from_type( MBEDTLS_MD_MD5 );
#endif
#if defined(MBEDTLS_RIPEMD160_C)
if( !strcasecmp( "RIPEMD160", md_name ) )
if( !strcmp( "RIPEMD160", md_name ) )
return mbedtls_md_info_from_type( MBEDTLS_MD_RIPEMD160 );
#endif
#if defined(MBEDTLS_SHA1_C)
if( !strcasecmp( "SHA1", md_name ) || !strcasecmp( "SHA", md_name ) )
if( !strcmp( "SHA1", md_name ) || !strcmp( "SHA", md_name ) )
return mbedtls_md_info_from_type( MBEDTLS_MD_SHA1 );
#endif
#if defined(MBEDTLS_SHA256_C)
if( !strcasecmp( "SHA224", md_name ) )
if( !strcmp( "SHA224", md_name ) )
return mbedtls_md_info_from_type( MBEDTLS_MD_SHA224 );
if( !strcasecmp( "SHA256", md_name ) )
if( !strcmp( "SHA256", md_name ) )
return mbedtls_md_info_from_type( MBEDTLS_MD_SHA256 );
#endif
#if defined(MBEDTLS_SHA512_C)
if( !strcasecmp( "SHA384", md_name ) )
if( !strcmp( "SHA384", md_name ) )
return mbedtls_md_info_from_type( MBEDTLS_MD_SHA384 );
if( !strcasecmp( "SHA512", md_name ) )
if( !strcmp( "SHA512", md_name ) )
return mbedtls_md_info_from_type( MBEDTLS_MD_SHA512 );
#endif
return( NULL );
......
......@@ -36,11 +36,6 @@
// #include <stdlib.h>
#include <string.h>
#if defined(_MSC_VER) && !defined strcasecmp && !defined(EFIX64) && \
!defined(EFI32)
#define strcasecmp _stricmp
#endif
/*
* Ordered from most preferred to least preferred in terms of security.
*
......@@ -1733,7 +1728,7 @@ const mbedtls_ssl_ciphersuite_t *mbedtls_ssl_ciphersuite_from_string(
while( cur->id != 0 )
{
if( 0 == strcasecmp( cur->name, ciphersuite_name ) )
if( 0 == strcmp( cur->name, ciphersuite_name ) )
return( cur );
cur++;
......
......@@ -55,11 +55,6 @@
#define mbedtls_free free
#endif
#if defined(_MSC_VER) && !defined strcasecmp && !defined(EFIX64) && \
!defined(EFI32)
#define strcasecmp _stricmp
#endif
/* Implementation that should never be optimized out by the compiler */
static void mbedtls_zeroize( void *v, size_t n ) {
volatile unsigned char *p = v; while( n-- ) *p++ = 0;
......
......@@ -32,11 +32,6 @@
#include <string.h>
#if defined(_MSC_VER) && !defined strcasecmp && !defined(EFIX64) && \
!defined(EFI32)
#define strcasecmp _stricmp
#endif
static const char *features[] = {
#if defined(MBEDTLS_VERSION_FEATURES)
#if defined(MBEDTLS_HAVE_ASM)
......@@ -625,7 +620,7 @@ int mbedtls_version_check_feature( const char *feature )
while( *idx != NULL )
{
if( !strcasecmp( *idx, feature ) )
if( !strcmp( *idx, feature ) )
return( 0 );
idx++;
}
......
......@@ -34,11 +34,6 @@
#include <string.h>
#if defined(_MSC_VER) && !defined strncasecmp && !defined(EFIX64) && \
!defined(EFI32)
#define strncasecmp _strnicmp
#endif
typedef struct {
const char *name;
size_t name_len;
......@@ -86,7 +81,7 @@ static const char *x509_at_oid_from_name( const char *name, size_t name_len )
for( cur = x509_attrs; cur->name != NULL; cur++ )
if( cur->name_len == name_len &&
strncasecmp( cur->name, name, name_len ) == 0 )
strncmp( cur->name, name, name_len ) == 0 )
break;
return( cur->oid );
......
......@@ -32,11 +32,6 @@
#include <string.h>
#if defined(_MSC_VER) && !defined strcasecmp && !defined(EFIX64) && \
!defined(EFI32)
#define strcasecmp _stricmp
#endif
static const char *features[] = {
#if defined(MBEDTLS_VERSION_FEATURES)
FEATURE_DEFINES
......@@ -56,7 +51,7 @@ int mbedtls_version_check_feature( const char *feature )
while( *idx != NULL )
{
if( !strcasecmp( *idx, feature ) )
if( !strcmp( *idx, feature ) )
return( 0 );
idx++;
}
......
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment