Added check for nettle < 3.0

This commit is contained in:
Nikos Mavrogiannopoulos
2015-10-30 23:53:57 +01:00
parent faf83871b4
commit 30c75df77f
2 changed files with 15 additions and 0 deletions
+5
View File
@@ -50,6 +50,11 @@ AC_CHECK_LIB(gnutls, gnutls_pkcs11_reinit, [
AC_DEFINE([HAVE_PKCS11], [], [PKCS11 detected in gnutls])
])
if ! $PKG_CONFIG --atleast-version=3.0 nettle; then
AC_DEFINE([NETTLE_OLD_BASE64_API], [1],
[nettle uses the pre-3.x base64 API])
fi
AC_ARG_WITH(protobuf,
AS_HELP_STRING([--without-protobuf], [use the included protobuf library]),
test_for_protobuf=$withval,
+10
View File
@@ -44,7 +44,17 @@ oc_base64_decode(const uint8_t *src, unsigned src_length,
base64_decode_init(&ctx);
#ifdef NETTLE_OLD_BASE64_API
{
unsigned int len = *dst_length;
ret = base64_decode_update(&ctx, &len, dst, src_length, src);
if (ret != 0)
*dst_length = len;
}
#else
ret = base64_decode_update(&ctx, dst_length, dst, src_length, src);
#endif
if (ret == 0)
return 0;