diff options
author | Glenn Strauss <gstrauss@gluelogic.com> | 2021-06-10 08:27:20 -0400 |
---|---|---|
committer | Glenn Strauss <gstrauss@gluelogic.com> | 2021-08-27 02:16:53 -0400 |
commit | c987bec18e0661b5a99d7ea2f8c54a08e7776ff6 (patch) | |
tree | 9d33d9dabfe087c5b0325c70e650f32be76d3ba1 /src/algo_hmac.c | |
parent | 396a92306648266e1df60d1d12d07b7f4d01b9d9 (diff) | |
download | lighttpd-git-c987bec18e0661b5a99d7ea2f8c54a08e7776ff6.tar.gz |
[multiple] use <algo>_iov() digest funcs
reduce code duplication
make it easier to add new algos
mod_authn_file:
- leverage r->tmp_buf instead of temporary allocating buffer_init()
- mod_authn_file_htpasswd_basic()
- compare binary SHA1 (shorter) rather than base64 (longer)
- split crypt() from mod_authn_file_htpasswd_basic() to separate func
- apr_md5_encode() modifications for slightly better performance
Diffstat (limited to 'src/algo_hmac.c')
-rw-r--r-- | src/algo_hmac.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/src/algo_hmac.c b/src/algo_hmac.c index e7fd2c09..c9259b8a 100644 --- a/src/algo_hmac.c +++ b/src/algo_hmac.c @@ -65,11 +65,8 @@ li_hmac_md5 (unsigned char digest[MD5_DIGEST_LENGTH], const void * const secret, const uint32_t slen, const unsigned char * const msg, const uint32_t mlen) { - li_MD5_CTX Md5Ctx; - li_MD5_Init(&Md5Ctx); - li_MD5_Update(&Md5Ctx, secret, slen); - li_MD5_Update(&Md5Ctx, msg, mlen); - li_MD5_Final(digest, &Md5Ctx); + struct const_iovec iov[] = { { secret, slen }, { msg, mlen } }; + MD5_iov(digest, iov, sizeof(iov)/sizeof(*iov)); return 1; } |