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 /providers | |
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 'providers')
-rw-r--r-- | providers/common/capabilities.c | 2 | ||||
-rw-r--r-- | providers/implementations/ciphers/cipher_cts.c | 3 | ||||
-rw-r--r-- | providers/implementations/kdfs/hkdf.c | 6 | ||||
-rw-r--r-- | providers/implementations/kdfs/kbkdf.c | 5 | ||||
-rw-r--r-- | providers/implementations/kdfs/tls1_prf.c | 2 | ||||
-rw-r--r-- | providers/implementations/kem/rsa_kem.c | 4 | ||||
-rw-r--r-- | providers/implementations/keymgmt/dsa_kmgmt.c | 3 | ||||
-rw-r--r-- | providers/implementations/keymgmt/ec_kmgmt.c | 1 | ||||
-rw-r--r-- | providers/implementations/keymgmt/ecx_kmgmt.c | 4 | ||||
-rw-r--r-- | providers/implementations/keymgmt/mac_legacy_kmgmt.c | 1 | ||||
-rw-r--r-- | providers/implementations/rands/drbg_ctr.c | 3 | ||||
-rw-r--r-- | providers/implementations/signature/rsa_sig.c | 3 | ||||
-rw-r--r-- | providers/implementations/storemgmt/file_store.c | 9 |
13 files changed, 19 insertions, 27 deletions
diff --git a/providers/common/capabilities.c b/providers/common/capabilities.c index f6d95197f0..e1e1961b23 100644 --- a/providers/common/capabilities.c +++ b/providers/common/capabilities.c @@ -217,7 +217,7 @@ static int tls_group_capability(OSSL_CALLBACK *cb, void *arg) int ossl_prov_get_capabilities(void *provctx, const char *capability, OSSL_CALLBACK *cb, void *arg) { - if (strcasecmp(capability, "TLS-GROUP") == 0) + if (OPENSSL_strcasecmp(capability, "TLS-GROUP") == 0) return tls_group_capability(cb, arg); /* We don't support this capability */ diff --git a/providers/implementations/ciphers/cipher_cts.c b/providers/implementations/ciphers/cipher_cts.c index cb3372c646..5c48f37c95 100644 --- a/providers/implementations/ciphers/cipher_cts.c +++ b/providers/implementations/ciphers/cipher_cts.c @@ -46,7 +46,6 @@ * Otherwise it is the same as CS2. */ -#include "e_os.h" /* strcasecmp */ #include <openssl/core_names.h> #include "prov/ciphercommon.h" #include "internal/nelem.h" @@ -92,7 +91,7 @@ int ossl_cipher_cbc_cts_mode_name2id(const char *name) size_t i; for (i = 0; i < OSSL_NELEM(cts_modes); ++i) { - if (strcasecmp(name, cts_modes[i].name) == 0) + if (OPENSSL_strcasecmp(name, cts_modes[i].name) == 0) return (int)cts_modes[i].id; } return -1; diff --git a/providers/implementations/kdfs/hkdf.c b/providers/implementations/kdfs/hkdf.c index 667d5e9619..89f304b418 100644 --- a/providers/implementations/kdfs/hkdf.c +++ b/providers/implementations/kdfs/hkdf.c @@ -199,11 +199,11 @@ static int hkdf_common_set_ctx_params(KDF_HKDF *ctx, const OSSL_PARAM params[]) if ((p = OSSL_PARAM_locate_const(params, OSSL_KDF_PARAM_MODE)) != NULL) { if (p->data_type == OSSL_PARAM_UTF8_STRING) { - if (strcasecmp(p->data, "EXTRACT_AND_EXPAND") == 0) { + if (OPENSSL_strcasecmp(p->data, "EXTRACT_AND_EXPAND") == 0) { ctx->mode = EVP_KDF_HKDF_MODE_EXTRACT_AND_EXPAND; - } else if (strcasecmp(p->data, "EXTRACT_ONLY") == 0) { + } else if (OPENSSL_strcasecmp(p->data, "EXTRACT_ONLY") == 0) { ctx->mode = EVP_KDF_HKDF_MODE_EXTRACT_ONLY; - } else if (strcasecmp(p->data, "EXPAND_ONLY") == 0) { + } else if (OPENSSL_strcasecmp(p->data, "EXPAND_ONLY") == 0) { ctx->mode = EVP_KDF_HKDF_MODE_EXPAND_ONLY; } else { ERR_raise(ERR_LIB_PROV, PROV_R_INVALID_MODE); diff --git a/providers/implementations/kdfs/kbkdf.c b/providers/implementations/kdfs/kbkdf.c index 5f30b037d9..6be7f45fc5 100644 --- a/providers/implementations/kdfs/kbkdf.c +++ b/providers/implementations/kdfs/kbkdf.c @@ -298,10 +298,11 @@ static int kbkdf_set_ctx_params(void *vctx, const OSSL_PARAM params[]) } p = OSSL_PARAM_locate_const(params, OSSL_KDF_PARAM_MODE); - if (p != NULL && strncasecmp("counter", p->data, p->data_size) == 0) { + if (p != NULL + && OPENSSL_strncasecmp("counter", p->data, p->data_size) == 0) { ctx->mode = COUNTER; } else if (p != NULL - && strncasecmp("feedback", p->data, p->data_size) == 0) { + && OPENSSL_strncasecmp("feedback", p->data, p->data_size) == 0) { ctx->mode = FEEDBACK; } else if (p != NULL) { ERR_raise(ERR_LIB_PROV, PROV_R_INVALID_MODE); diff --git a/providers/implementations/kdfs/tls1_prf.c b/providers/implementations/kdfs/tls1_prf.c index 74a0f7e1f3..e0b5971a3b 100644 --- a/providers/implementations/kdfs/tls1_prf.c +++ b/providers/implementations/kdfs/tls1_prf.c @@ -172,7 +172,7 @@ static int kdf_tls1_prf_set_ctx_params(void *vctx, const OSSL_PARAM params[]) return 1; if ((p = OSSL_PARAM_locate_const(params, OSSL_KDF_PARAM_DIGEST)) != NULL) { - if (strcasecmp(p->data, SN_md5_sha1) == 0) { + if (OPENSSL_strcasecmp(p->data, SN_md5_sha1) == 0) { if (!ossl_prov_macctx_load_from_params(&ctx->P_hash, params, OSSL_MAC_NAME_HMAC, NULL, SN_md5, libctx) diff --git a/providers/implementations/kem/rsa_kem.c b/providers/implementations/kem/rsa_kem.c index 313ab133b3..bfc3da6908 100644 --- a/providers/implementations/kem/rsa_kem.c +++ b/providers/implementations/kem/rsa_kem.c @@ -12,8 +12,8 @@ * internal use. */ #include "internal/deprecated.h" +#include "internal/nelem.h" -#include "e_os.h" /* strcasecmp */ #include <openssl/crypto.h> #include <openssl/evp.h> #include <openssl/core_dispatch.h> @@ -69,7 +69,7 @@ static int name2id(const char *name, const OSSL_ITEM *map, size_t sz) return -1; for (i = 0; i < sz; ++i) { - if (strcasecmp(map[i].ptr, name) == 0) + if (OPENSSL_strcasecmp(map[i].ptr, name) == 0) return map[i].id; } return -1; diff --git a/providers/implementations/keymgmt/dsa_kmgmt.c b/providers/implementations/keymgmt/dsa_kmgmt.c index 885bd62eea..2ab69f5f32 100644 --- a/providers/implementations/keymgmt/dsa_kmgmt.c +++ b/providers/implementations/keymgmt/dsa_kmgmt.c @@ -13,7 +13,6 @@ */ #include "internal/deprecated.h" -#include "e_os.h" /* strcasecmp */ #include <openssl/core_dispatch.h> #include <openssl/core_names.h> #include <openssl/bn.h> @@ -90,7 +89,7 @@ static int dsa_gen_type_name2id(const char *name) size_t i; for (i = 0; i < OSSL_NELEM(dsatype2id); ++i) { - if (strcasecmp(dsatype2id[i].name, name) == 0) + if (OPENSSL_strcasecmp(dsatype2id[i].name, name) == 0) return dsatype2id[i].id; } return -1; diff --git a/providers/implementations/keymgmt/ec_kmgmt.c b/providers/implementations/keymgmt/ec_kmgmt.c index f564a470ac..68bb35e4cb 100644 --- a/providers/implementations/keymgmt/ec_kmgmt.c +++ b/providers/implementations/keymgmt/ec_kmgmt.c @@ -13,7 +13,6 @@ */ #include "internal/deprecated.h" -#include "e_os.h" /* strcasecmp */ #include <string.h> #include <openssl/core_dispatch.h> #include <openssl/core_names.h> diff --git a/providers/implementations/keymgmt/ecx_kmgmt.c b/providers/implementations/keymgmt/ecx_kmgmt.c index 99d685735e..2a7f867aa5 100644 --- a/providers/implementations/keymgmt/ecx_kmgmt.c +++ b/providers/implementations/keymgmt/ecx_kmgmt.c @@ -9,8 +9,6 @@ #include <assert.h> #include <string.h> -/* For strcasecmp on Windows */ -#include "e_os.h" #include <openssl/core_dispatch.h> #include <openssl/core_names.h> #include <openssl/params.h> @@ -546,7 +544,7 @@ static int ecx_gen_set_params(void *genctx, const OSSL_PARAM params[]) } if (p->data_type != OSSL_PARAM_UTF8_STRING || groupname == NULL - || strcasecmp(p->data, groupname) != 0) { + || OPENSSL_strcasecmp(p->data, groupname) != 0) { ERR_raise(ERR_LIB_PROV, ERR_R_PASSED_INVALID_ARGUMENT); return 0; } diff --git a/providers/implementations/keymgmt/mac_legacy_kmgmt.c b/providers/implementations/keymgmt/mac_legacy_kmgmt.c index ec34a3ee71..ecfd2eaaa5 100644 --- a/providers/implementations/keymgmt/mac_legacy_kmgmt.c +++ b/providers/implementations/keymgmt/mac_legacy_kmgmt.c @@ -26,7 +26,6 @@ #include "prov/providercommon.h" #include "prov/provider_ctx.h" #include "prov/macsignature.h" -#include "e_os.h" /* strcasecmp */ static OSSL_FUNC_keymgmt_new_fn mac_new; static OSSL_FUNC_keymgmt_free_fn mac_free; diff --git a/providers/implementations/rands/drbg_ctr.c b/providers/implementations/rands/drbg_ctr.c index dbe57b0d28..c51eb4b4e5 100644 --- a/providers/implementations/rands/drbg_ctr.c +++ b/providers/implementations/rands/drbg_ctr.c @@ -14,7 +14,6 @@ #include <openssl/rand.h> #include <openssl/aes.h> #include <openssl/proverr.h> -#include "e_os.h" /* strcasecmp */ #include "crypto/modes.h" #include "internal/thread_once.h" #include "prov/implementations.h" @@ -690,7 +689,7 @@ static int drbg_ctr_set_ctx_params(void *vctx, const OSSL_PARAM params[]) if (p->data_type != OSSL_PARAM_UTF8_STRING || p->data_size < ctr_str_len) return 0; - if (strcasecmp("CTR", base + p->data_size - ctr_str_len) != 0) { + if (OPENSSL_strcasecmp("CTR", base + p->data_size - ctr_str_len) != 0) { ERR_raise(ERR_LIB_PROV, PROV_R_REQUIRE_CTR_MODE_CIPHER); return 0; } diff --git a/providers/implementations/signature/rsa_sig.c b/providers/implementations/signature/rsa_sig.c index 325e855333..9460136bca 100644 --- a/providers/implementations/signature/rsa_sig.c +++ b/providers/implementations/signature/rsa_sig.c @@ -13,7 +13,6 @@ */ #include "internal/deprecated.h" -#include "e_os.h" /* strcasecmp */ #include <string.h> #include <openssl/crypto.h> #include <openssl/core_dispatch.h> @@ -854,7 +853,7 @@ static int rsa_digest_signverify_init(void *vprsactx, const char *mdname, if (mdname != NULL /* was rsa_setup_md already called in rsa_signverify_init()? */ - && (mdname[0] == '\0' || strcasecmp(prsactx->mdname, mdname) != 0) + && (mdname[0] == '\0' || OPENSSL_strcasecmp(prsactx->mdname, mdname) != 0) && !rsa_setup_md(prsactx, mdname, prsactx->propq)) return 0; diff --git a/providers/implementations/storemgmt/file_store.c b/providers/implementations/storemgmt/file_store.c index fef2b1d290..fceef73b7c 100644 --- a/providers/implementations/storemgmt/file_store.c +++ b/providers/implementations/storemgmt/file_store.c @@ -9,8 +9,6 @@ /* This file has quite some overlap with engines/e_loader_attic.c */ -#include "e_os.h" /* To get strncasecmp() on Windows */ - #include <string.h> #include <sys/stat.h> #include <ctype.h> /* isdigit */ @@ -220,12 +218,12 @@ static void *file_open(void *provctx, const char *uri) * There's a special case if the URI also contains an authority, then * the full URI shouldn't be used as a path anywhere. */ - if (strncasecmp(uri, "file:", 5) == 0) { + if (OPENSSL_strncasecmp(uri, "file:", 5) == 0) { const char *p = &uri[5]; if (strncmp(&uri[5], "//", 2) == 0) { path_data_n--; /* Invalidate using the full URI */ - if (strncasecmp(&uri[7], "localhost/", 10) == 0) { + if (OPENSSL_strncasecmp(&uri[7], "localhost/", 10) == 0) { p = &uri[16]; } else if (uri[7] == '/') { p = &uri[7]; @@ -592,7 +590,8 @@ static int file_name_check(struct file_ctx_st *ctx, const char *name) /* * First, check the basename */ - if (strncasecmp(name, ctx->_.dir.search_name, len) != 0 || name[len] != '.') + if (OPENSSL_strncasecmp(name, ctx->_.dir.search_name, len) != 0 + || name[len] != '.') return 0; p = &name[len + 1]; |