#endif
#if !defined(HAS_SHA512_256_IMPLEMENTATION) && defined(USE_GNUTLS)
-# include <nettle/sha.h>
+# include <nettle/sha2.h>
+# include <nettle/version.h>
# ifdef SHA512_256_DIGEST_SIZE
# define USE_GNUTLS_SHA512_256 1
# endif
{
Curl_sha512_256_ctx * const ctx = (Curl_sha512_256_ctx *)context;
+#if NETTLE_VERSION_MAJOR >= 4
+ sha512_256_digest(ctx, (uint8_t *)digest);
+#else
sha512_256_digest(ctx,
(size_t)CURL_SHA512_256_DIGEST_SIZE, (uint8_t *)digest);
+#endif
return CURLE_OK;
}
#ifdef USE_GNUTLS
#include <nettle/md5.h>
+#include <nettle/version.h>
typedef struct md5_ctx my_md5_ctx;
static void my_md5_final(unsigned char *digest, void *ctx)
{
+#if NETTLE_VERSION_MAJOR >= 4
+ md5_digest(ctx, digest);
+#else
md5_digest(ctx, 16, digest);
+#endif
}
#elif defined(USE_OPENSSL) && \
}
#elif defined(USE_GNUTLS)
-#include <nettle/sha.h>
+#include <nettle/sha2.h>
+#include <nettle/version.h>
typedef struct sha256_ctx my_sha256_ctx;
static void my_sha256_final(unsigned char *digest, void *ctx)
{
+#if NETTLE_VERSION_MAJOR >= 4
+ sha256_digest(ctx, digest);
+#else
sha256_digest(ctx, SHA256_DIGEST_SIZE, digest);
+#endif
}
#elif defined(USE_MBEDTLS) && \
#include <gnutls/x509.h>
#include <gnutls/crypto.h>
#include <nettle/sha2.h>
+#include <nettle/version.h>
#include "urldata.h"
#include "curl_trc.h"
struct sha256_ctx SHA256pw;
sha256_init(&SHA256pw);
sha256_update(&SHA256pw, (unsigned int)tmplen, tmp);
+#if NETTLE_VERSION_MAJOR >= 4
+ sha256_digest(&SHA256pw, sha256sum);
+#else
sha256_digest(&SHA256pw, (unsigned int)sha256len, sha256sum);
+#endif
return CURLE_OK;
}
if test "$GNUTLS_ENABLED" = "1"; then
USE_GNUTLS_NETTLE=
dnl First check if we can detect either crypto library via transitive linking
- AC_CHECK_LIB(gnutls, nettle_MD5Init, [ USE_GNUTLS_NETTLE=1 ])
+ AC_CHECK_LIB(gnutls, nettle_md5_init, [ USE_GNUTLS_NETTLE=1 ])
dnl If not, try linking directly to both of them to see if they are available
if test -z "$USE_GNUTLS_NETTLE"; then
CPPFLAGS="$CPPFLAGS $addcflags"
fi
- AC_CHECK_LIB(nettle, nettle_MD5Init,
+ AC_CHECK_LIB(nettle, nettle_md5_init,
[
USE_GNUTLS_NETTLE=1
],