diff options
author | Dmitry Belyavskiy <beldmit@gmail.com> | 2022-04-12 12:30:08 +0200 |
---|---|---|
committer | Dmitry Belyavskiy <beldmit@gmail.com> | 2022-04-22 11:34:41 +0200 |
commit | fba140c73541c03e22b4fdb219a05d129bf0406d (patch) | |
tree | b5c692f73ff063c2f071ef2383979fb8aa572164 /providers | |
parent | 4b2bd2722b8294a6b27c9e1fcf7d76f7d9de9b44 (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/18069)
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 | 5 |
13 files changed, 17 insertions, 25 deletions
diff --git a/providers/common/capabilities.c b/providers/common/capabilities.c index edf7c9f768..63d531b056 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 aced2021f9..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 "internal/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 2238c321a7..1223d95757 100644 --- a/providers/implementations/kdfs/hkdf.c +++ b/providers/implementations/kdfs/hkdf.c @@ -230,11 +230,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 7462eb6e94..c9ad0de886 100644 --- a/providers/implementations/kdfs/kbkdf.c +++ b/providers/implementations/kdfs/kbkdf.c @@ -341,10 +341,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 eba4da50e1..e194ecca64 100644 --- a/providers/implementations/kdfs/tls1_prf.c +++ b/providers/implementations/kdfs/tls1_prf.c @@ -198,7 +198,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 201c80e648..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 "internal/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 3ddafbd4c1..ec5cb5f443 100644 --- a/providers/implementations/keymgmt/dsa_kmgmt.c +++ b/providers/implementations/keymgmt/dsa_kmgmt.c @@ -13,7 +13,6 @@ */ #include "internal/deprecated.h" -#include "internal/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 8a86c9108d..e72b0c3312 100644 --- a/providers/implementations/keymgmt/ec_kmgmt.c +++ b/providers/implementations/keymgmt/ec_kmgmt.c @@ -13,7 +13,6 @@ */ #include "internal/deprecated.h" -#include "internal/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 9afcb6dc0a..333f2b7afa 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 "internal/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 73af2071bf..653d9c6dc4 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 "internal/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 1384a43390..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 "internal/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 f543bdb17a..54051be25f 100644 --- a/providers/implementations/signature/rsa_sig.c +++ b/providers/implementations/signature/rsa_sig.c @@ -13,7 +13,6 @@ */ #include "internal/deprecated.h" -#include "internal/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 461b7e468d..68c75a008e 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 "internal/e_os.h" /* To get strncasecmp() on Windows */ - #include <string.h> #include <sys/stat.h> #include <ctype.h> /* isdigit */ @@ -590,7 +588,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]; |