aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ssh-agent-filter.C5
1 files changed, 5 insertions, 0 deletions
diff --git a/ssh-agent-filter.C b/ssh-agent-filter.C
index 3fe4801..8a2772d 100644
--- a/ssh-agent-filter.C
+++ b/ssh-agent-filter.C
@@ -77,6 +77,7 @@ using std::pair;
#include <sys/un.h>
#include <sys/wait.h>
#include <sysexits.h>
+#include <nettle/version.h>
#include <nettle/md5.h>
#include <nettle/base64.h>
#include <nettle/base16.h>
@@ -112,7 +113,11 @@ string md5_hex (string const & s) {
md5_init(&ctx);
md5_update(&ctx, s.size(), reinterpret_cast<uint8_t const *>(s.data()));
std::array<uint8_t, MD5_DIGEST_SIZE> bin;
+#if (NETTLE_VERSION_MAJOR >= 4)
+ md5_digest(&ctx, bin.data());
+#else
md5_digest(&ctx, MD5_DIGEST_SIZE, bin.data());
+#endif
std::array<char, BASE16_ENCODE_LENGTH(MD5_DIGEST_SIZE)> hex;
base16_encode_update(hex.data(), MD5_DIGEST_SIZE, bin.data());
return {begin(hex), end(hex)};