From 9e667c15c7c42b000843c61b42633cd76f14a2c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Moise=CC=81s=20Guimara=CC=83es?= Date: Mon, 19 Jan 2015 14:53:54 -0300 Subject: [PATCH] fix tolower typecast on CYGWIN, gcc-arm-none-eabi (gnuarmeclipse toolchain) and possible future ports. --- src/internal.c | 9 +++++---- wolfcrypt/src/asn.c | 3 ++- wolfssl/wolfcrypt/types.h | 5 ----- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/src/internal.c b/src/internal.c index 067a0e75c..e43d35820 100644 --- a/src/internal.c +++ b/src/internal.c @@ -3837,18 +3837,19 @@ static int MatchDomainName(const char* pattern, int len, const char* str) while (len > 0) { - p = (char)XTOLOWER(*pattern++); + p = (char)XTOLOWER((unsigned char)*pattern++); if (p == 0) break; if (p == '*') { - while (--len > 0 && (p = (char)XTOLOWER(*pattern++)) == '*') + while (--len > 0 && + (p = (char)XTOLOWER((unsigned char)*pattern++)) == '*') ; if (len == 0) p = '\0'; - while ( (s = (char)XTOLOWER(*str)) != '\0') { + while ( (s = (char)XTOLOWER((unsigned char) *str)) != '\0') { if (s == p) break; if (s == '.') @@ -3857,7 +3858,7 @@ static int MatchDomainName(const char* pattern, int len, const char* str) } } else { - if (p != (char)XTOLOWER(*str)) + if (p != (char)XTOLOWER((unsigned char) *str)) return 0; } diff --git a/wolfcrypt/src/asn.c b/wolfcrypt/src/asn.c index 9c79e13de..094629c6d 100644 --- a/wolfcrypt/src/asn.c +++ b/wolfcrypt/src/asn.c @@ -3238,7 +3238,8 @@ static int MatchBaseName(int type, const char* name, int nameSz, } while (nameSz > 0) { - if (XTOLOWER(*name++) != XTOLOWER(*base++)) + if (XTOLOWER((unsigned char)*name++) != + XTOLOWER((unsigned char)*base++)) return 0; nameSz--; } diff --git a/wolfssl/wolfcrypt/types.h b/wolfssl/wolfcrypt/types.h index 51a8d5f63..d729ce31b 100644 --- a/wolfssl/wolfcrypt/types.h +++ b/wolfssl/wolfcrypt/types.h @@ -217,11 +217,6 @@ #define XISALPHA(c) isalpha((c)) #endif /* needed by wolfSSL_check_domain_name() */ - #ifdef __CYGWIN__ - /* Cygwin uses a macro version of tolower() by default, use the - * function version. */ - #undef tolower - #endif #define XTOLOWER(c) tolower((c)) #endif