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 /apps | |
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 'apps')
-rw-r--r-- | apps/ca.c | 4 | ||||
-rw-r--r-- | apps/ecparam.c | 2 | ||||
-rw-r--r-- | apps/lib/apps.c | 12 | ||||
-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 | 7 | ||||
-rw-r--r-- | apps/s_server.c | 2 |
9 files changed, 25 insertions, 26 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"); |