diff options
author | Kazuki Yamaguchi <k@rhe.jp> | 2016-04-09 01:22:13 +0900 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2016-04-08 11:45:47 -0700 |
commit | 1ed2c7b11570f5d16bdc70d151fa78c3dccf6d38 (patch) | |
tree | 9fb56716945fd446dea3bb37401559766c3816cf /imap-send.c | |
parent | e46579643d56162299b1756b70d418005351b256 (diff) | |
download | git-1ed2c7b11570f5d16bdc70d151fa78c3dccf6d38.tar.gz |
imap-send: use HMAC() function provided by OpenSSL
Fix compile errors with OpenSSL 1.1.0.
HMAC_CTX is made opaque and HMAC_CTX_cleanup is removed in OpenSSL
1.1.0. But since we just want to calculate one HMAC, we can use HMAC()
here, which exists since OpenSSL 0.9.6 at least.
Signed-off-by: Kazuki Yamaguchi <k@rhe.jp>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'imap-send.c')
-rw-r--r-- | imap-send.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/imap-send.c b/imap-send.c index 8c3fc212ba..8bf363bbdf 100644 --- a/imap-send.c +++ b/imap-send.c @@ -862,7 +862,6 @@ static char hexchar(unsigned int b) static char *cram(const char *challenge_64, const char *user, const char *pass) { int i, resp_len, encoded_len, decoded_len; - HMAC_CTX hmac; unsigned char hash[16]; char hex[33]; char *response, *response_64, *challenge; @@ -877,10 +876,8 @@ static char *cram(const char *challenge_64, const char *user, const char *pass) (unsigned char *)challenge_64, encoded_len); if (decoded_len < 0) die("invalid challenge %s", challenge_64); - HMAC_Init(&hmac, (unsigned char *)pass, strlen(pass), EVP_md5()); - HMAC_Update(&hmac, (unsigned char *)challenge, decoded_len); - HMAC_Final(&hmac, hash, NULL); - HMAC_CTX_cleanup(&hmac); + if (!HMAC(EVP_md5(), pass, strlen(pass), (unsigned char *)challenge, decoded_len, hash, NULL)) + die("HMAC error"); hex[32] = 0; for (i = 0; i < 16; i++) { |