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 /apps | |
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 'apps')
-rw-r--r-- | apps/ca.c | 4 | ||||
-rw-r--r-- | apps/cmp.c | 2 | ||||
-rw-r--r-- | apps/ecparam.c | 2 | ||||
-rw-r--r-- | apps/lib/apps.c | 16 | ||||
-rw-r--r-- | apps/lib/engine_loader.c | 2 | ||||
-rw-r--r-- | apps/lib/http_server.c | 7 | ||||
-rw-r--r-- | apps/lib/names.c | 7 | ||||
-rw-r--r-- | apps/lib/vms_term_sock.c | 2 | ||||
-rw-r--r-- | apps/list.c | 8 | ||||
-rw-r--r-- | apps/rehash.c | 4 | ||||
-rw-r--r-- | apps/s_server.c | 2 |
11 files changed, 27 insertions, 29 deletions
@@ -2367,7 +2367,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; } @@ -2584,7 +2584,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/cmp.c b/apps/cmp.c index 9ea5cee412..5c6bcdad0a 100644 --- a/apps/cmp.c +++ b/apps/cmp.c @@ -1745,7 +1745,7 @@ static int handle_opt_geninfo(OSSL_CMP_CTX *ctx) valptr[0] = '\0'; valptr++; - if (strncasecmp(valptr, "int:", 4) != 0) { + if (OPENSSL_strncasecmp(valptr, "int:", 4) != 0) { CMP_err("missing 'int:' in -geninfo option"); return 0; } diff --git a/apps/ecparam.c b/apps/ecparam.c index 12eed703de..ecce36be71 100644 --- a/apps/ecparam.c +++ b/apps/ecparam.c @@ -229,7 +229,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 30da6e8a8c..227da4982d 100644 --- a/apps/lib/apps.c +++ b/apps/lib/apps.c @@ -688,8 +688,8 @@ int load_cert_certs(const char *uri, int ret = 0; char *pass_string; - if (exclude_http && (strncasecmp(uri, "http://", 7) == 0 - || strncasecmp(uri, "https://", 8) == 0)) { + if (exclude_http && (OPENSSL_strncasecmp(uri, "http://", 7) == 0 + || OPENSSL_strncasecmp(uri, "https://", 8) == 0)) { BIO_printf(bio_err, "error: HTTP retrieval not allowed for %s\n", desc); return ret; } @@ -1182,20 +1182,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; @@ -1275,7 +1275,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/engine_loader.c b/apps/lib/engine_loader.c index c093f31e1b..42775a89f3 100644 --- a/apps/lib/engine_loader.c +++ b/apps/lib/engine_loader.c @@ -71,7 +71,7 @@ static OSSL_STORE_LOADER_CTX *engine_open(const OSSL_STORE_LOADER *loader, char *keyid = NULL; OSSL_STORE_LOADER_CTX *ctx = NULL; - if (strncasecmp(p, ENGINE_SCHEME_COLON, sizeof(ENGINE_SCHEME_COLON) - 1) + if (OPENSSL_strncasecmp(p, ENGINE_SCHEME_COLON, sizeof(ENGINE_SCHEME_COLON) - 1) != 0) return NULL; p += sizeof(ENGINE_SCHEME_COLON) - 1; diff --git a/apps/lib/http_server.c b/apps/lib/http_server.c index 03faac7707..df9575e2cd 100644 --- a/apps/lib/http_server.c +++ b/apps/lib/http_server.c @@ -453,10 +453,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..462703c646 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 "openssl/crypto.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 1b27699b9d..4d9a69b29e 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 9732d6625a..620ce00831 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 fb6c08c420..e4a4e14fd4 100644 --- a/apps/rehash.c +++ b/apps/rehash.c @@ -214,7 +214,7 @@ static int handle_symlink(const char *filename, const char *fullpath) return -1; for (type = OSSL_NELEM(suffixes) - 1; type > 0; type--) { const char *suffix = suffixes[type]; - if (strncasecmp(suffix, &filename[i], strlen(suffix)) == 0) + if (OPENSSL_strncasecmp(suffix, &filename[i], strlen(suffix)) == 0) break; } i += strlen(suffixes[type]); @@ -249,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 ccaec3124b..e93cfa1e2c 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"); |