diff options
author | Kim Alvefur <zash@zash.se> | 2019-04-19 13:24:32 +0200 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2019-04-19 13:24:32 +0200 |
commit | 2a2cdcecdf15dc13f939cf9b83959e9929a94eb4 (patch) | |
tree | 6aa3af8eb212f915ca7ef35f50bf7ddf64681807 /util-src/hashes.c | |
parent | 3f3280d0c0bf789ecace5e3024ab24a9dc7fd339 (diff) | |
download | prosody-2a2cdcecdf15dc13f939cf9b83959e9929a94eb4.tar.gz prosody-2a2cdcecdf15dc13f939cf9b83959e9929a94eb4.zip |
util.hashes: Remove now unused hmac() function
Diffstat (limited to 'util-src/hashes.c')
-rw-r--r-- | util-src/hashes.c | 38 |
1 files changed, 0 insertions, 38 deletions
diff --git a/util-src/hashes.c b/util-src/hashes.c index ac6cac7e..75eb116d 100644 --- a/util-src/hashes.c +++ b/util-src/hashes.c @@ -76,44 +76,6 @@ struct hash_desc { void *ctx, *ctxo; }; -static void hmac(struct hash_desc *desc, const char *key, size_t key_len, - const char *msg, size_t msg_len, unsigned char *result) { - union xory { - unsigned char bytes[64]; - uint32_t quadbytes[16]; - }; - - int i; - unsigned char hashedKey[64]; /* Maximum used digest length */ - union xory k_ipad, k_opad; - - if(key_len > 64) { - desc->Init(desc->ctx); - desc->Update(desc->ctx, key, key_len); - desc->Final(hashedKey, desc->ctx); - key = (const char *)hashedKey; - key_len = desc->digestLength; - } - - memcpy(k_ipad.bytes, key, key_len); - memset(k_ipad.bytes + key_len, 0, 64 - key_len); - memcpy(k_opad.bytes, k_ipad.bytes, 64); - - for(i = 0; i < 16; i++) { - k_ipad.quadbytes[i] ^= HMAC_IPAD; - k_opad.quadbytes[i] ^= HMAC_OPAD; - } - - desc->Init(desc->ctx); - desc->Update(desc->ctx, k_ipad.bytes, 64); - desc->Init(desc->ctxo); - desc->Update(desc->ctxo, k_opad.bytes, 64); - desc->Update(desc->ctx, msg, msg_len); - desc->Final(result, desc->ctx); - desc->Update(desc->ctxo, result, desc->digestLength); - desc->Final(result, desc->ctxo); -} - #define MAKE_HMAC_FUNCTION(myFunc, evp, size, type) \ static int myFunc(lua_State *L) { \ unsigned char hash[size], result[2*size]; \ |