diff options
author | Dmitry Belyavskiy <beldmit@gmail.com> | 2022-04-12 12:30:08 +0200 |
---|---|---|
committer | Dmitry Belyavskiy <beldmit@gmail.com> | 2022-04-21 17:12:32 +0200 |
commit | 2c31d942af28a20e87979cbc76c3dd8d162c1a9c (patch) | |
tree | a7927f89d19ef4c9604eb80fbefc4fa1ac2d4734 /crypto | |
parent | a8e4ddc6d15b6e6b308428753bc22b12422adacf (diff) |
str[n]casecmp => OPENSSL_strncasecmp
Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/18103)
Diffstat (limited to 'crypto')
30 files changed, 76 insertions, 104 deletions
diff --git a/crypto/LPdir_unix.c b/crypto/LPdir_unix.c index ddf68b576f..fe9fc0dd43 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 031a6c936a..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 "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 ecff2be02e..59d42daf4a 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 "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 c05c3c6b10..6fe8427dc5 100644 --- a/crypto/conf/conf_def.c +++ b/crypto/conf/conf_def.c @@ -11,7 +11,7 @@ #include <stdio.h> #include <string.h> -#include "e_os.h" /* strcasecmp and struct stat */ +#include "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 55248affc6..7e11ab1c88 100644 --- a/crypto/core_namemap.c +++ b/crypto/core_namemap.c @@ -7,7 +7,6 @@ * https://www.openssl.org/source/license.html */ -#include "e_os.h" /* strcasecmp */ #include "internal/namemap.h" #include <openssl/lhash.h> #include "crypto/lhash.h" /* ossl_lh_strcasehash */ @@ -49,7 +48,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 c71f4053da..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 "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 381da71f33..0d84a33322 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 745e014d8f..6b0591c6c8 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 "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 10a38b6f82..de6d3def31 100644 --- a/crypto/encode_decode/decoder_lib.c +++ b/crypto/encode_decode/decoder_lib.c @@ -789,7 +789,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) { @@ -850,7 +850,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", @@ -896,7 +896,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", @@ -915,7 +916,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 475117a463..833061d873 100644 --- a/crypto/encode_decode/decoder_pkey.c +++ b/crypto/encode_decode/decoder_pkey.c @@ -18,7 +18,6 @@ #include "crypto/evp.h" #include "crypto/decoder.h" #include "encoder_local.h" -#include "e_os.h" /* strcasecmp on Windows */ int OSSL_DECODER_CTX_set_passphrase(OSSL_DECODER_CTX *ctx, const unsigned char *kstr, diff --git a/crypto/encode_decode/encoder_lib.c b/crypto/encode_decode/encoder_lib.c index cfd9275172..2a83af825c 100644 --- a/crypto/encode_decode/encoder_lib.c +++ b/crypto/encode_decode/encoder_lib.c @@ -7,7 +7,6 @@ * https://www.openssl.org/source/license.html */ -#include "e_os.h" /* strcasecmp on Windows */ #include <openssl/core_names.h> #include <openssl/bio.h> #include <openssl/encoder.h> @@ -453,8 +452,8 @@ static int encoder_process(struct encoder_process_data_st *data) */ if (top) { if (data->ctx->output_type != NULL - && strcasecmp(current_output_type, - data->ctx->output_type) != 0) { + && OPENSSL_strcasecmp(current_output_type, + data->ctx->output_type) != 0) { OSSL_TRACE_BEGIN(ENCODER) { BIO_printf(trc_out, "[%d] Skipping because current encoder output type (%s) != desired output type (%s)\n", @@ -482,8 +481,8 @@ static int encoder_process(struct encoder_process_data_st *data) */ if (data->ctx->output_structure != NULL && current_output_structure != NULL) { - if (strcasecmp(data->ctx->output_structure, - current_output_structure) != 0) { + if (OPENSSL_strcasecmp(data->ctx->output_structure, + current_output_structure) != 0) { OSSL_TRACE_BEGIN(ENCODER) { BIO_printf(trc_out, "[%d] Skipping because current encoder output structure (%s) != ctx output structure (%s)\n", diff --git a/crypto/encode_decode/encoder_pkey.c b/crypto/encode_decode/encoder_pkey.c index c37edf966d..3a24317cf4 100644 --- a/crypto/encode_decode/encoder_pkey.c +++ b/crypto/encode_decode/encoder_pkey.c @@ -7,7 +7,6 @@ * https://www.openssl.org/source/license.html */ -#include "e_os.h" /* strcasecmp on Windows */ #include <openssl/err.h> #include <openssl/ui.h> #include <openssl/params.h> diff --git a/crypto/engine/tb_asnmth.c b/crypto/engine/tb_asnmth.c index e3a5c82e99..09d0ed9d3a 100644 --- a/crypto/engine/tb_asnmth.c +++ b/crypto/engine/tb_asnmth.c @@ -152,7 +152,7 @@ const EVP_PKEY_ASN1_METHOD *ENGINE_get_pkey_asn1_meth_str(ENGINE *e, e->pkey_asn1_meths(e, &ameth, NULL, nids[i]); if (ameth != NULL && ((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; @@ -177,7 +177,7 @@ static void look_str_cb(int nid, STACK_OF(ENGINE) *sk, ENGINE *def, void *arg) e->pkey_asn1_meths(e, &ameth, NULL, nid); if (ameth != NULL && ((int)strlen(ameth->pem_str) == lk->len) - && strncasecmp(ameth->pem_str, lk->str, lk->len) == 0) { + && OPENSSL_strncasecmp(ameth->pem_str, lk->str, lk->len) == 0) { lk->e = e; lk->ameth = ameth; return; diff --git a/crypto/evp/ctrl_params_translate.c b/crypto/evp/ctrl_params_translate.c index 961ca116b3..0aa1c23bee 100644 --- a/crypto/evp/ctrl_params_translate.c +++ b/crypto/evp/ctrl_params_translate.c @@ -37,8 +37,6 @@ #include "crypto/dh.h" #include "crypto/ec.h" -#include "e_os.h" /* strcasecmp() for Windows */ - struct translation_ctx_st; /* Forwarding */ struct translation_st; /* Forwarding */ @@ -905,7 +903,7 @@ static int fix_kdf_type(enum state state, /* Convert KDF type strings to numbers */ for (; kdf_type_map->kdf_type_str != NULL; kdf_type_map++) - if (strcasecmp(ctx->p2, kdf_type_map->kdf_type_str) == 0) { + if (OPENSSL_strcasecmp(ctx->p2, kdf_type_map->kdf_type_str) == 0) { ctx->p1 = kdf_type_map->kdf_type_num; ret = 1; break; @@ -2469,10 +2467,11 @@ lookup_translation(struct translation_st *tmpl, * cmd name in the template. */ if (item->ctrl_str != NULL - && strcasecmp(tmpl->ctrl_str, item->ctrl_str) == 0) + && OPENSSL_strcasecmp(tmpl->ctrl_str, item->ctrl_str) == 0) ctrl_str = tmpl->ctrl_str; else if (item->ctrl_hexstr != NULL - && strcasecmp(tmpl->ctrl_hexstr, item->ctrl_hexstr) == 0) + && OPENSSL_strcasecmp(tmpl->ctrl_hexstr, + item->ctrl_hexstr) == 0) ctrl_hexstr = tmpl->ctrl_hexstr; else continue; @@ -2500,7 +2499,8 @@ lookup_translation(struct translation_st *tmpl, if ((item->action_type != NONE && tmpl->action_type != item->action_type) || (item->param_key != NULL - && strcasecmp(tmpl->param_key, item->param_key) != 0)) + && OPENSSL_strcasecmp(tmpl->param_key, + item->param_key) != 0)) continue; } else { return NULL; diff --git a/crypto/evp/ec_support.c b/crypto/evp/ec_support.c index 8550be65e7..aa3c7fa4ef 100644 --- a/crypto/evp/ec_support.c +++ b/crypto/evp/ec_support.c @@ -10,7 +10,7 @@ #include <string.h> #include <openssl/ec.h> #include "crypto/ec.h" -#include "e_os.h" /* strcasecmp required by windows */ +#include "internal/nelem.h" typedef struct ec_name2nid_st { const char *name; @@ -139,7 +139,7 @@ int ossl_ec_curve_name2nid(const char *name) return nid; for (i = 0; i < OSSL_NELEM(curve_list); i++) { - if (strcasecmp(curve_list[i].name, name) == 0) + if (OPENSSL_strcasecmp(curve_list[i].name, name) == 0) return curve_list[i].nid; } } diff --git a/crypto/evp/evp_lib.c b/crypto/evp/evp_lib.c index 24092cfd5b..da3ef28b3d 100644 --- a/crypto/evp/evp_lib.c +++ b/crypto/evp/evp_lib.c @@ -15,7 +15,6 @@ #include <stdio.h> #include <string.h> -#include "e_os.h" /* strcasecmp */ #include "internal/cryptlib.h" #include <openssl/evp.h> #include <openssl/objects.h> @@ -1170,17 +1169,17 @@ EVP_PKEY *EVP_PKEY_Q_keygen(OSSL_LIB_CTX *libctx, const char *propq, va_start(args, type); - if (strcasecmp(type, "RSA") == 0) { + if (OPENSSL_strcasecmp(type, "RSA") == 0) { bits = va_arg(args, size_t); params[0] = OSSL_PARAM_construct_size_t(OSSL_PKEY_PARAM_RSA_BITS, &bits); - } else if (strcasecmp(type, "EC") == 0) { + } else if (OPENSSL_strcasecmp(type, "EC") == 0) { name = va_arg(args, char *); params[0] = OSSL_PARAM_construct_utf8_string(OSSL_PKEY_PARAM_GROUP_NAME, name, 0); - } else if (strcasecmp(type, "ED25519") != 0 - && strcasecmp(type, "X25519") != 0 - && strcasecmp(type, "ED448") != 0 - && strcasecmp(type, "X448") != 0) { + } else if (OPENSSL_strcasecmp(type, "ED25519") != 0 + && OPENSSL_strcasecmp(type, "X25519") != 0 + && OPENSSL_strcasecmp(type, "ED448") != 0 + && OPENSSL_strcasecmp(type, "X448") != 0) { ERR_raise(ERR_LIB_EVP, ERR_R_PASSED_INVALID_ARGUMENT); goto end; } diff --git a/crypto/evp/p_lib.c b/crypto/evp/p_lib.c index 27138af564..668607a723 100644 --- a/crypto/evp/p_lib.c +++ b/crypto/evp/p_lib.c @@ -50,8 +50,6 @@ #include "internal/provider.h" #include "evp_local.h" -#include "e_os.h" /* strcasecmp on Windows */ - static int pkey_set_type(EVP_PKEY *pkey, ENGINE *e, int type, const char *str, int len, EVP_KEYMGMT *keymgmt); static void evp_pkey_free_it(EVP_PKEY *key); @@ -1018,7 +1016,7 @@ int evp_pkey_name2type(const char *name) size_t i; for (i = 0; i < OSSL_NELEM(standard_name2type); i++) { - if (strcasecmp(name, standard_name2type[i].ptr) == 0) + if (OPENSSL_strcasecmp(name, standard_name2type[i].ptr) == 0) return (int)standard_name2type[i].id; } diff --git a/crypto/ffc/ffc_dh.c b/crypto/ffc/ffc_dh.c index e9f597c46c..266cb30bc2 100644 --- a/crypto/ffc/ffc_dh.c +++ b/crypto/ffc/ffc_dh.c @@ -10,7 +10,6 @@ #include "internal/ffc.h" #include "internal/nelem.h" #include "crypto/bn_dh.h" -#include "e_os.h" /* strcasecmp */ #ifndef OPENSSL_NO_DH @@ -84,7 +83,7 @@ const DH_NAMED_GROUP *ossl_ffc_name_to_dh_named_group(const char *name) size_t i; for (i = 0; i < OSSL_NELEM(dh_named_groups); ++i) { - if (strcasecmp(dh_named_groups[i].name, name) == 0) + if (OPENSSL_strcasecmp(dh_named_groups[i].name, name) == 0) return &dh_named_groups[i]; } return NULL; diff --git a/crypto/ffc/ffc_params.c b/crypto/ffc/ffc_params.c index 6e025a06be..500189e49f 100644 --- a/crypto/ffc/ffc_params.c +++ b/crypto/ffc/ffc_params.c @@ -12,7 +12,6 @@ #include "internal/ffc.h" #include "internal/param_build_set.h" #include "internal/nelem.h" -#include "e_os.h" /* strcasecmp */ #ifndef FIPS_MODULE # include <openssl/asn1.h> /* ossl_ffc_params_print */ diff --git a/crypto/http/http_client.c b/crypto/http/http_client.c index 33e7b82b9e..8133a04936 100644 --- a/crypto/http/http_client.c +++ b/crypto/http/http_client.c @@ -322,7 +322,7 @@ static int add1_headers(OSSL_HTTP_REQ_CTX *rctx, for (i = 0; i < sk_CONF_VALUE_num(headers); i++) { hdr = sk_CONF_VALUE_value(headers, i); - if (add_host && strcasecmp("host", hdr->name) == 0) + if (add_host && OPENSSL_strcasecmp("host", hdr->name) == 0) add_host = 0; if (!OSSL_HTTP_REQ_CTX_add1_header(rctx, hdr->name, hdr->value)) return 0; @@ -666,13 +666,13 @@ int OSSL_HTTP_REQ_CTX_nbio(OSSL_HTTP_REQ_CTX *rctx) } if (value != NULL && line_end != NULL) { if (rctx->state == OHS_REDIRECT - && strcasecmp(key, "Location") == 0) { + && OPENSSL_strcasecmp(key, "Location") == 0) { rctx->redirection_url = value; return 0; } if (rctx->expected_ct != NULL - && strcasecmp(key, "Content-Type") == 0) { - if (strcasecmp(rctx->expected_ct, value) != 0) { + && OPENSSL_strcasecmp(key, "Content-Type") == 0) { + if (OPENSSL_strcasecmp(rctx->expected_ct, value) != 0) { ERR_raise_data(ERR_LIB_HTTP, HTTP_R_UNEXPECTED_CONTENT_TYPE, "expected=%s, actual=%s", rctx->expected_ct, value); @@ -682,12 +682,12 @@ int OSSL_HTTP_REQ_CTX_nbio(OSSL_HTTP_REQ_CTX *rctx) } /* https://tools.ietf.org/html/rfc7230#section-6.3 Persistence */ - if (strcasecmp(key, "Connection") == 0) { - if (strcasecmp(value, "keep-alive") == 0) + if (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; - } else if (strcasecmp(key, "Content-Length") == 0) { + } else if (OPENSSL_strcasecmp(key, "Content-Length") == 0) { resp_len = (size_t)strtoul(value, &line_end, 10); if (line_end == value || *line_end != '\0') { ERR_raise_data(ERR_LIB_HTTP, diff --git a/crypto/objects/o_names.c b/crypto/objects/o_names.c index 92152eeb66..7596d720e9 100644 --- a/crypto/objects/o_names.c +++ b/crypto/objects/o_names.c @@ -22,23 +22,6 @@ #include "e_os.h" /* - * We define this wrapper for two reasons. Firstly, later versions of - * DEC C add linkage information to certain functions, which makes it - * tricky to use them as values to regular function pointers. - * Secondly, in the EDK2 build environment, the strcasecmp function is - * actually an external function with the Microsoft ABI, so we can't - * transparently assign function pointers to it. - */ -#if defined(OPENSSL_SYS_VMS_DECC) || defined(OPENSSL_SYS_UEFI) -static int obj_strcasecmp(const char *a, const char *b) -{ - return strcasecmp(a, b); -} -#else -#define obj_strcasecmp strcasecmp -#endif - -/* * I use the ex_data stuff to manage the identifiers for the obj_name_types * that applications may define. I only really use the free function field. */ @@ -111,7 +94,7 @@ int OBJ_NAME_new_index(unsigned long (*hash_func) (const char *), goto out; } name_funcs->hash_func = ossl_lh_strcasehash; - name_funcs->cmp_func = obj_strcasecmp; + name_funcs->cmp_func = OPENSSL_strcasecmp; push = sk_NAME_FUNCS_push(name_funcs_stack, name_funcs); if (!push) { @@ -145,7 +128,7 @@ static int obj_name_cmp(const OBJ_NAME *a, const OBJ_NAME *b) ret = sk_NAME_FUNCS_value(name_funcs_stack, a->type)->cmp_func(a->name, b->name); } else - ret = strcasecmp(a->name, b->name); + ret = OPENSSL_strcasecmp(a->name, b->name); } return ret; } diff --git a/crypto/params_dup.c b/crypto/params_dup.c index 6a58b52f65..d92176da46 100644 --- a/crypto/params_dup.c +++ b/crypto/params_dup.c @@ -11,7 +11,6 @@ #include <openssl/params.h> #include <openssl/param_build.h> #include "internal/param_build_set.h" -#include "e_os.h" /* strcasecmp */ #define OSSL_PARAM_ALLOCATED_END 127 #define OSSL_PARAM_MERGE_LIST_MAX 128 @@ -142,7 +141,7 @@ static int compare_params(const void *left, const void *right) const OSSL_PARAM *l = *(const OSSL_PARAM **)left; const OSSL_PARAM *r = *(const OSSL_PARAM **)right; - return strcasecmp(l->key, r->key); + return OPENSSL_strcasecmp(l->key, r->key); } OSSL_PARAM *OSSL_PARAM_merge(const OSSL_PARAM *p1, const OSSL_PARAM *p2) @@ -205,7 +204,7 @@ OSSL_PARAM *OSSL_PARAM_merge(const OSSL_PARAM *p1, const OSSL_PARAM *p2) break; } /* consume the list element with the smaller key */ - diff = strcasecmp((*p1cur)->key, (*p2cur)->key); + diff = OPENSSL_strcasecmp((*p1cur)->key, (*p2cur)->key); if (diff == 0) { /* If the keys are the same then throw away the list1 element */ *dst++ = **p2cur; diff --git a/crypto/property/property_parse.c b/crypto/property/property_parse.c index 8954ec7246..c5691395c4 100644 --- a/crypto/property/property_parse.c +++ b/crypto/property/property_parse.c @@ -45,7 +45,7 @@ static int match(const char *t[], const char m[], size_t m_len) { const char *s = *t; - if (strncasecmp(s, m, m_len) == 0) { + if (OPENSSL_strncasecmp(s, m, m_len) == 0) { *t = skip_space(s + m_len); return 1; } |