diff options
author | Pauli <paul.dale@oracle.com> | 2018-09-04 07:35:45 +1000 |
---|---|---|
committer | Pauli <paul.dale@oracle.com> | 2018-09-04 07:35:45 +1000 |
commit | fc196a5eb97dc3a5465c37a6761428ddd81b023d (patch) | |
tree | 47b5116217bcab42d2b3e6fa1084cd67d7332480 /crypto/lhash | |
parent | 2d28a42f899c2f5e03b0e49a660ed3c1f744e7a3 (diff) |
Make OBJ_NAME case insensitive.
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/7089)
Diffstat (limited to 'crypto/lhash')
-rw-r--r-- | crypto/lhash/lhash.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/crypto/lhash/lhash.c b/crypto/lhash/lhash.c index f7ac9d02f5..8d9f933df3 100644 --- a/crypto/lhash/lhash.c +++ b/crypto/lhash/lhash.c @@ -13,6 +13,8 @@ #include <openssl/crypto.h> #include <openssl/lhash.h> #include <openssl/err.h> +#include "internal/ctype.h" +#include "internal/lhash.h" #include "lhash_lcl.h" /* @@ -349,6 +351,27 @@ unsigned long OPENSSL_LH_strhash(const char *c) return (ret >> 16) ^ ret; } +unsigned long openssl_lh_strcasehash(const char *c) +{ + unsigned long ret = 0; + long n; + unsigned long v; + int r; + + if (c == NULL || *c == '\0') + return ret; + + for (n = 0x100; *c != '\0'; n += 0x100) { + v = n | ossl_tolower(*c); + r = (int)((v >> 2) ^ v) & 0x0f; + ret = (ret << r) | (ret >> (32 - r)); + ret &= 0xFFFFFFFFL; + ret ^= v * v; + c++; + } + return (ret >> 16) ^ ret; +} + unsigned long OPENSSL_LH_num_items(const OPENSSL_LHASH *lh) { return lh ? lh->num_items : 0; |