diff options
63 files changed, 162 insertions, 216 deletions
@@ -2379,7 +2379,7 @@ static char *make_revocation_str(REVINFO_TYPE rev_type, const char *rev_arg) case REV_CRL_REASON: for (i = 0; i < 8; i++) { - if (strcasecmp(rev_arg, crl_reasons[i]) == 0) { + if (OPENSSL_strcasecmp(rev_arg, crl_reasons[i]) == 0) { reason = crl_reasons[i]; break; } @@ -2596,7 +2596,7 @@ int unpack_revinfo(ASN1_TIME **prevtm, int *preason, ASN1_OBJECT **phold, } if (reason_str) { for (i = 0; i < NUM_REASONS; i++) { - if (strcasecmp(reason_str, crl_reasons[i]) == 0) { + if (OPENSSL_strcasecmp(reason_str, crl_reasons[i]) == 0) { reason_code = i; break; } diff --git a/apps/ecparam.c b/apps/ecparam.c index 9910d8c17e..4fdae06a92 100644 --- a/apps/ecparam.c +++ b/apps/ecparam.c @@ -228,7 +228,7 @@ int ecparam_main(int argc, char **argv) point_format, 0); *p = OSSL_PARAM_construct_end(); - if (strcasecmp(curve_name, "SM2") == 0) + if (OPENSSL_strcasecmp(curve_name, "SM2") == 0) gctx_params = EVP_PKEY_CTX_new_from_name(NULL, "sm2", NULL); else gctx_params = EVP_PKEY_CTX_new_from_name(NULL, "ec", NULL); diff --git a/apps/lib/apps.c b/apps/lib/apps.c index e3afc57be5..317a000868 100644 --- a/apps/lib/apps.c +++ b/apps/lib/apps.c @@ -1145,20 +1145,20 @@ int set_name_ex(unsigned long *flags, const char *arg) int set_dateopt(unsigned long *dateopt, const char *arg) { - if (strcasecmp(arg, "rfc_822") == 0) + if (OPENSSL_strcasecmp(arg, "rfc_822") == 0) *dateopt = ASN1_DTFLGS_RFC822; - else if (strcasecmp(arg, "iso_8601") == 0) + else if (OPENSSL_strcasecmp(arg, "iso_8601") == 0) *dateopt = ASN1_DTFLGS_ISO8601; return 0; } int set_ext_copy(int *copy_type, const char *arg) { - if (strcasecmp(arg, "none") == 0) + if (OPENSSL_strcasecmp(arg, "none") == 0) *copy_type = EXT_COPY_NONE; - else if (strcasecmp(arg, "copy") == 0) + else if (OPENSSL_strcasecmp(arg, "copy") == 0) *copy_type = EXT_COPY_ADD; - else if (strcasecmp(arg, "copyall") == 0) + else if (OPENSSL_strcasecmp(arg, "copyall") == 0) *copy_type = EXT_COPY_ALL; else return 0; @@ -1239,7 +1239,7 @@ static int set_table_opts(unsigned long *flags, const char *arg, } for (ptbl = in_tbl; ptbl->name; ptbl++) { - if (strcasecmp(arg, ptbl->name) == 0) { + if (OPENSSL_strcasecmp(arg, ptbl->name) == 0) { *flags &= ~ptbl->mask; if (c) *flags |= ptbl->flag; diff --git a/apps/lib/http_server.c b/apps/lib/http_server.c index e531201d17..36ea7a3bdc 100644 --- a/apps/lib/http_server.c +++ b/apps/lib/http_server.c @@ -468,10 +468,11 @@ int http_server_get_asn1_req(const ASN1_ITEM *it, ASN1_VALUE **preq, } *line_end = '\0'; /* https://tools.ietf.org/html/rfc7230#section-6.3 Persistence */ - if (found_keep_alive != NULL && strcasecmp(key, "Connection") == 0) { - if (strcasecmp(value, "keep-alive") == 0) + if (found_keep_alive != NULL + && OPENSSL_strcasecmp(key, "Connection") == 0) { + if (OPENSSL_strcasecmp(value, "keep-alive") == 0) *found_keep_alive = 1; - else if (strcasecmp(value, "close") == 0) + else if (OPENSSL_strcasecmp(value, "close") == 0) *found_keep_alive = 0; } } diff --git a/apps/lib/names.c b/apps/lib/names.c index 5e2e7e147c..d42de5a0e7 100644 --- a/apps/lib/names.c +++ b/apps/lib/names.c @@ -11,14 +11,11 @@ #include <openssl/bio.h> #include <openssl/safestack.h> #include "names.h" - -#ifdef _WIN32 -# define strcasecmp _stricmp -#endif +#include "internal/e_os.h" int name_cmp(const char * const *a, const char * const *b) { - return strcasecmp(*a, *b); + return OPENSSL_strcasecmp(*a, *b); } void collect_names(const char *name, void *vdata) diff --git a/apps/lib/vms_term_sock.c b/apps/lib/vms_term_sock.c index a1aeb6df06..e4bf0f626f 100644 --- a/apps/lib/vms_term_sock.c +++ b/apps/lib/vms_term_sock.c @@ -132,7 +132,7 @@ int main (int argc, char *argv[], char *envp[]) len; LogMessage ("Enter 'q' or 'Q' to quit ..."); - while (strcasecmp (TermBuff, "Q")) { + while (OPENSSL_strcasecmp (TermBuff, "Q")) { /* ** Create the terminal socket */ diff --git a/apps/list.c b/apps/list.c index 30bf2be919..c6ff7dd580 100644 --- a/apps/list.c +++ b/apps/list.c @@ -71,7 +71,7 @@ static void legacy_cipher_fn(const EVP_CIPHER *c, { if (select_name != NULL && (c == NULL - || strcasecmp(select_name, EVP_CIPHER_get0_name(c)) != 0)) + || OPENSSL_strcasecmp(select_name, EVP_CIPHER_get0_name(c)) != 0)) return; if (c != NULL) { BIO_printf(arg, " %s\n", EVP_CIPHER_get0_name(c)); @@ -370,7 +370,7 @@ DEFINE_STACK_OF(EVP_RAND) static int rand_cmp(const EVP_RAND * const *a, const EVP_RAND * const *b) { - int ret = strcasecmp(EVP_RAND_get0_name(*a), EVP_RAND_get0_name(*b)); + int ret = OPENSSL_strcasecmp(EVP_RAND_get0_name(*a), EVP_RAND_get0_name(*b)); if (ret == 0) ret = strcmp(OSSL_PROVIDER_get0_name(EVP_RAND_get0_provider(*a)), @@ -404,7 +404,7 @@ static void list_random_generators(void) const EVP_RAND *m = sk_EVP_RAND_value(rands, i); if (select_name != NULL - && strcasecmp(EVP_RAND_get0_name(m), select_name) != 0) + && OPENSSL_strcasecmp(EVP_RAND_get0_name(m), select_name) != 0) continue; BIO_printf(bio_out, " %s", EVP_RAND_get0_name(m)); BIO_printf(bio_out, " @ %s\n", @@ -463,7 +463,7 @@ static void display_random(const char *name, EVP_RAND_CTX *drbg) if (gettables != NULL) for (; gettables->key != NULL; gettables++) { /* State has been dealt with already, so ignore */ - if (strcasecmp(gettables->key, OSSL_RAND_PARAM_STATE) == 0) + if (OPENSSL_strcasecmp(gettables->key, OSSL_RAND_PARAM_STATE) == 0) continue; /* Outside of verbose mode, we skip non-string values */ if (gettables->data_type != OSSL_PARAM_UTF8_STRING diff --git a/apps/rehash.c b/apps/rehash.c index e0b7954607..eb538bf8f9 100644 --- a/apps/rehash.c +++ b/apps/rehash.c @@ -213,9 +213,10 @@ static int handle_symlink(const char *filename, const char *fullpath) if (filename[i++] != '.') return -1; for (type = OSSL_NELEM(suffixes) - 1; type > 0; type--) - if (strncasecmp(&filename[i], - suffixes[type], strlen(suffixes[type])) == 0) + if (OPENSSL_strncasecmp(&filename[i], + suffixes[type], strlen(suffixes[type])) == 0) break; + i += strlen(suffixes[type]); id = strtoul(&filename[i], &endptr, 10); @@ -248,7 +249,7 @@ static int do_file(const char *filename, const char *fullpath, enum Hash h) if ((ext = strrchr(filename, '.')) == NULL) goto end; for (i = 0; i < OSSL_NELEM(extensions); i++) { - if (strcasecmp(extensions[i], ext + 1) == 0) + if (OPENSSL_strcasecmp(extensions[i], ext + 1) == 0) break; } if (i >= OSSL_NELEM(extensions)) diff --git a/apps/s_server.c b/apps/s_server.c index 736d8498d1..cdcec47f42 100644 --- a/apps/s_server.c +++ b/apps/s_server.c @@ -432,7 +432,7 @@ static int ssl_servername_cb(SSL *s, int *ad, void *arg) return SSL_TLSEXT_ERR_NOACK; if (servername != NULL) { - if (strcasecmp(servername, p->servername)) + if (OPENSSL_strcasecmp(servername, p->servername)) return p->extension_error; if (ctx2 != NULL) { BIO_printf(p->biodebug, "Switching server context.\n"); diff --git a/crypto/LPdir_unix.c b/crypto/LPdir_unix.c index 4151d1bd85..38f5356747 100644 --- a/crypto/LPdir_unix.c +++ b/crypto/LPdir_unix.c @@ -141,7 +141,8 @@ const char *LP_find_file(LP_DIR_CTX **ctx, const char *directory) p--; if (p > (*ctx)->entry_name && p[-1] == ';') p[-1] = '\0'; - if (strcasecmp((*ctx)->entry_name, (*ctx)->previous_entry_name) == 0) + if (OPENSSL_strcasecmp((*ctx)->entry_name, + (*ctx)->previous_entry_name) == 0) goto again; } #endif diff --git a/crypto/asn1/ameth_lib.c b/crypto/asn1/ameth_lib.c index 9704492607..0de5785c27 100644 --- a/crypto/asn1/ameth_lib.c +++ b/crypto/asn1/ameth_lib.c @@ -10,7 +10,6 @@ /* We need to use some engine deprecated APIs */ #define OPENSSL_SUPPRESS_DEPRECATED -#include "internal/e_os.h" /* for strncasecmp */ #include "internal/cryptlib.h" #include <stdio.h> #include <openssl/asn1t.h> @@ -134,7 +133,7 @@ const EVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_find_str(ENGINE **pe, if (ameth->pkey_flags & ASN1_PKEY_ALIAS) continue; if ((int)strlen(ameth->pem_str) == len - && strncasecmp(ameth->pem_str, str, len) == 0) + && OPENSSL_strncasecmp(ameth->pem_str, str, len) == 0) return ameth; } return NULL; diff --git a/crypto/asn1/asn1_gen.c b/crypto/asn1/asn1_gen.c index a112f7de9e..ef5b7010bb 100644 --- a/crypto/asn1/asn1_gen.c +++ b/crypto/asn1/asn1_gen.c @@ -10,7 +10,6 @@ #include "internal/cryptlib.h" #include <openssl/asn1.h> #include <openssl/x509v3.h> -#include "internal/e_os.h" /* strncasecmp() */ #define ASN1_GEN_FLAG 0x10000 #define ASN1_GEN_FLAG_IMP (ASN1_GEN_FLAG|1) @@ -565,7 +564,8 @@ static int asn1_str2tag(const char *tagstr, int len) tntmp = tnst; for (i = 0; i < OSSL_NELEM(tnst); i++, tntmp++) { - if ((len == tntmp->len) && (strncasecmp(tntmp->strnam, tagstr, len) == 0)) + if ((len == tntmp->len) + && (OPENSSL_strncasecmp(tntmp->strnam, tagstr, len) == 0)) return tntmp->tag; } diff --git a/crypto/conf/conf_def.c b/crypto/conf/conf_def.c index 9d79a900c8..ef45e7d38e 100644 --- a/crypto/conf/conf_def.c +++ b/crypto/conf/conf_def.c @@ -11,7 +11,7 @@ #include <stdio.h> #include <string.h> -#include "internal/e_os.h" /* strcasecmp and struct stat */ +#include "internal/e_os.h" /* struct stat */ #ifdef __TANDEM # include <sys/types.h> /* needed for stat.h */ # include <sys/stat.h> /* struct stat */ @@ -192,11 +192,11 @@ static int def_load(CONF *conf, const char *name, long *line) /* Parse a boolean value and fill in *flag. Return 0 on error. */ static int parsebool(const char *pval, int *flag) { - if (strcasecmp(pval, "on") == 0 - || strcasecmp(pval, "true") == 0) { + if (OPENSSL_strcasecmp(pval, "on") == 0 + || OPENSSL_strcasecmp(pval, "true") == 0) { *flag = 1; - } else if (strcasecmp(pval, "off") == 0 - || strcasecmp(pval, "false") == 0) { + } else if (OPENSSL_strcasecmp(pval, "off") == 0 + || OPENSSL_strcasecmp(pval, "false") == 0) { *flag = 0; } else { ERR_raise(ERR_LIB_CONF, CONF_R_INVALID_PRAGMA); @@ -839,8 +839,10 @@ static BIO *get_next_file(const char *path, OPENSSL_DIR_CTX **dirctx) namelen = strlen(filename); - if ((namelen > 5 && strcasecmp(filename + namelen - 5, ".conf") == 0) - || (namelen > 4 && strcasecmp(filename + namelen - 4, ".cnf") == 0)) { + if ((namelen > 5 + && OPENSSL_strcasecmp(filename + namelen - 5, ".conf") == 0) + || (namelen > 4 + && OPENSSL_strcasecmp(filename + namelen - 4, ".cnf") == 0)) { size_t newlen; char *newpath; BIO *bio; diff --git a/crypto/core_namemap.c b/crypto/core_namemap.c index d8de0af3ff..e4be318314 100644 --- a/crypto/core_namemap.c +++ b/crypto/core_namemap.c @@ -7,7 +7,6 @@ * https://www.openssl.org/source/license.html */ -#include "internal/e_os.h" /* strcasecmp */ #include "internal/namemap.h" #include <openssl/lhash.h> #include "crypto/lhash.h" /* ossl_lh_strcasehash */ @@ -50,7 +49,7 @@ static unsigned long namenum_hash(const NAMENUM_ENTRY *n) static int namenum_cmp(const NAMENUM_ENTRY *a, const NAMENUM_ENTRY *b) { - return strcasecmp(a->name, b->name); + return OPENSSL_strcasecmp(a->name, b->name); } static void namenum_free(NAMENUM_ENTRY *n) diff --git a/crypto/dh/dh_group_params.c b/crypto/dh/dh_group_params.c index dec50caf66..7608cbae5a 100644 --- a/crypto/dh/dh_group_params.c +++ b/crypto/dh/dh_group_params.c @@ -23,7 +23,6 @@ #include <openssl/objects.h> #include "internal/nelem.h" #include "crypto/dh.h" -#include "internal/e_os.h" /* strcasecmp */ static DH *dh_param_init(OSSL_LIB_CTX *libctx, const DH_NAMED_GROUP *group) { diff --git a/crypto/ec/ec_backend.c b/crypto/ec/ec_backend.c index d2fff0657d..935e5cf5f9 100644 --- a/crypto/ec/ec_backend.c +++ b/crypto/ec/ec_backend.c @@ -54,7 +54,7 @@ int ossl_ec_encoding_name2id(const char *name) return OPENSSL_EC_NAMED_CURVE; for (i = 0, sz = OSSL_NELEM(encoding_nameid_map); i < sz; i++) { - if (strcasecmp(name, encoding_nameid_map[i].ptr) == 0) + if (OPENSSL_strcasecmp(name, encoding_nameid_map[i].ptr) == 0) return encoding_nameid_map[i].id; } return -1; @@ -91,7 +91,7 @@ static int ec_check_group_type_name2id(const char *name) return 0; for (i = 0, sz = OSSL_NELEM(check_group_type_nameid_map); i < sz; i++) { - if (strcasecmp(name, check_group_type_nameid_map[i].ptr) == 0) + if (OPENSSL_strcasecmp(name, check_group_type_nameid_map[i].ptr) == 0) return check_group_type_nameid_map[i].id; } return -1; @@ -136,7 +136,7 @@ int ossl_ec_pt_format_name2id(const char *name) return (int)POINT_CONVERSION_UNCOMPRESSED; for (i = 0, sz = OSSL_NELEM(format_nameid_map); i < sz; i++) { - if (strcasecmp(name, format_nameid_map[i].ptr) == 0) + if (OPENSSL_strcasecmp(name, format_nameid_map[i].ptr) == 0) return format_nameid_map[i].id; } return -1; diff --git a/crypto/ec/ec_lib.c b/crypto/ec/ec_lib.c index f686e45f89..f22ba67fe3 100644 --- a/crypto/ec/ec_lib.c +++ b/crypto/ec/ec_lib.c @@ -22,7 +22,6 @@ #include "crypto/ec.h" #include "internal/nelem.h" #include "ec_local.h" -#include "internal/e_os.h" /* strcasecmp */ /* functions for EC_GROUP objects */ @@ -1592,9 +1591,10 @@ EC_GROUP *EC_GROUP_new_from_params(const OSSL_PARAM params[], ERR_raise(ERR_LIB_EC, EC_R_INVALID_FIELD); goto err; } - if (strcasecmp(ptmp->data, SN_X9_62_prime_field) == 0) { + if (OPENSSL_strcasecmp(ptmp->data, SN_X9_62_prime_field) == 0) { is_prime_field = 1; - } else if (strcasecmp(ptmp->data, SN_X9_62_characteristic_two_field) == 0) { + } else if (OPENSSL_strcasecmp(ptmp->data, + SN_X9_62_characteristic_two_field) == 0) { is_prime_field = 0; } else { /* Invalid field */ diff --git a/crypto/encode_decode/decoder_lib.c b/crypto/encode_decode/decoder_lib.c index 6781c61c6c..768c58c310 100644 --- a/crypto/encode_decode/decoder_lib.c +++ b/crypto/encode_decode/decoder_lib.c @@ -796,7 +796,7 @@ static int decoder_process(const OSSL_PARAM params[], void *arg) */ trace_data_structure = data_structure; if (data_type != NULL && data_structure != NULL - && strcasecmp(data_structure, "type-specific") == 0) + && OPENSSL_strcasecmp(data_structure, "type-specific") == 0) data_structure = NULL; OSSL_TRACE_BEGIN(DECODER) { @@ -857,7 +857,7 @@ static int decoder_process(const OSSL_PARAM params[], void *arg) * that's the case, we do this extra check. */ if (decoder == NULL && ctx->start_input_type != NULL - && strcasecmp(ctx->start_input_type, new_input_type) != 0) { + && OPENSSL_strcasecmp(ctx->start_input_type, new_input_type) != 0) { OSSL_TRACE_BEGIN(DECODER) { BIO_printf(trc_out, "(ctx %p) %s [%u] the start input type '%s' doesn't match the input type of the considered decoder, skipping...\n", @@ -904,7 +904,8 @@ static int decoder_process(const OSSL_PARAM params[], void *arg) */ if (data_structure != NULL && (new_input_structure == NULL - || strcasecmp(data_structure, new_input_structure) != 0)) { + || OPENSSL_strcasecmp(data_structure, + new_input_structure) != 0)) { OSSL_TRACE_BEGIN(DECODER) { BIO_printf(trc_out, "(ctx %p) %s [%u] the previous decoder's data structure doesn't match the input structure of the considered decoder, skipping...\n", @@ -923,7 +924,8 @@ static int decoder_process(const OSSL_PARAM params[], void *arg) && ctx->input_structure != NULL && new_input_structure != NULL) { data->flag_input_structure_checked = 1; - if (strcasecmp(new_input_structure, ctx->input_structure) != 0) { + if (OPENSSL_strcasecmp(new_input_structure, + ctx->input_structure) != 0) { OSSL_TRACE_BEGIN(DECODER) { BIO_printf(trc_out, "(ctx %p) %s [%u] the previous decoder's data structure doesn't match the input structure given by the user, skipping...\n", diff --git a/crypto/encode_decode/decoder_pkey.c b/crypto/encode_decode/decoder_pkey.c index 8cb320a5ce..268c05ce2d 100644 --- a/crypto/encode_decode/decoder_pkey.c +++ b/crypto/encode_decode/decoder_pkey.c |