diff options
author | Bob Beck <bbe@google.com> | 2023-02-01 12:41:49 -0700 |
---|---|---|
committer | Boringssl LUCI CQ <boringssl-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2023-02-01 19:57:04 +0000 |
commit | 00c70b8d698650e5836049def714b92d622bc4a6 (patch) | |
tree | 0169d2e7dfc20525e941a604f08b5b92af0ec481 /crypto/asn1 | |
parent | 67bb28c0fe17286b0b31864e91e70b9555887e53 (diff) | |
download | boringssl-00c70b8d698650e5836049def714b92d622bc4a6.zip boringssl-00c70b8d698650e5836049def714b92d622bc4a6.tar.gz boringssl-00c70b8d698650e5836049def714b92d622bc4a6.tar.bz2 |
Add locale independent implementations of isalpha, isalnum, isdigit,
and isxdigit.
All of these can be affected by locale, and although we weren't using
them directly (except for isxdigit) we instead had manual versions inline
everywhere.
While I am here add OPENSSL_fromxdigit and deduplicate a bunch of code
in hex decoders pulling out a hex value.
Change-Id: Ie75a4fba0f043208c50b0bb14174516462c89673
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/56648
Reviewed-by: David Benjamin <davidben@google.com>
Commit-Queue: Bob Beck <bbe@google.com>
Diffstat (limited to 'crypto/asn1')
-rw-r--r-- | crypto/asn1/a_mbstr.c | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/crypto/asn1/a_mbstr.c b/crypto/asn1/a_mbstr.c index c53d6d5..ef74d0d 100644 --- a/crypto/asn1/a_mbstr.c +++ b/crypto/asn1/a_mbstr.c @@ -283,10 +283,7 @@ int asn1_is_printable(uint32_t value) { if (value > 0x7f) { return 0; } - // Note we cannot use |isalnum| because it is locale-dependent. - return ('a' <= value && value <= 'z') || // - ('A' <= value && value <= 'Z') || // - ('0' <= value && value <= '9') || // + return OPENSSL_isalnum(value) || // value == ' ' || value == '\'' || value == '(' || value == ')' || value == '+' || value == ',' || value == '-' || value == '.' || value == '/' || value == ':' || value == '=' || value == '?'; |