krb5 commit: Make siphash24 available internally
Greg Hudson <[email protected]>
| Newsgroups | gmane.comp.encryption.kerberos.cvs |
|---|---|
| Message-ID | <[email protected]> |
https://github.com/krb5/krb5/commit/4662f94c7d51e3d262381c142eccd55759a89e46 commit 4662f94c7d51e3d262381c142eccd55759a89e46 Author: Greg Hudson <[email protected]> Date: Sat Feb 23 15:03:34 2019 -0500 Make siphash24 available internally src/include/k5-hashtab.h | 3 +++ src/util/support/hashtab.c | 9 +++++++++ src/util/support/libkrb5support-fixed.exports | 1 + 3 files changed, 13 insertions(+), 0 deletions(-) diff --git a/src/include/k5-hashtab.h b/src/include/k5-hashtab.h index dc0ef36..e68970b 100644 --- a/src/include/k5-hashtab.h +++ b/src/include/k5-hashtab.h @@ -76,4 +76,7 @@ int k5_hashtab_remove(struct k5_hashtab *ht, const void *key, size_t klen); /* Retrieve a value from a hash table by key. */ void *k5_hashtab_get(struct k5_hashtab *ht, const void *key, size_t klen); +uint64_t k5_siphash24(const uint8_t *data, size_t len, + const uint8_t seed[K5_HASH_SEED_LEN]); + #endif /* K5_HASH_H */ diff --git a/src/util/support/hashtab.c b/src/util/support/hashtab.c index e04e491..a66b8cb 100644 --- a/src/util/support/hashtab.c +++ b/src/util/support/hashtab.c @@ -111,6 +111,15 @@ siphash24(const uint8_t *data, size_t len, uint64_t k0, uint64_t k1) return v0 ^ v1 ^ v2 ^ v3; } +uint64_t +k5_siphash24(const uint8_t *data, size_t len, + const uint8_t seed[K5_HASH_SEED_LEN]) +{ + uint64_t k0 = load_64_le(seed), k1 = load_64_le(seed + 8); + + return siphash24(data, len, k0, k1); +} + int k5_hashtab_create(const uint8_t seed[K5_HASH_SEED_LEN], size_t initial_buckets, struct k5_hashtab **ht_out) diff --git a/src/util/support/libkrb5support-fixed.exports b/src/util/support/libkrb5support-fixed.exports index ff46656..df3c78f 100644 --- a/src/util/support/libkrb5support-fixed.exports +++ b/src/util/support/libkrb5support-fixed.exports @@ -60,6 +60,7 @@ k5_once k5_path_isabs k5_path_join k5_path_split +k5_siphash24 k5_strerror_r k5_utf8_to_utf16le k5_utf16le_to_utf8