summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@gnutls.org>2013-04-13 13:35:26 +0200
committerNikos Mavrogiannopoulos <nmav@gnutls.org>2013-04-13 13:35:26 +0200
commit97726aa26eef02b192b8f571beca02f954b9b4e2 (patch)
tree9e9ce7713370882af1f77fbefe5d3f8a62188edf
parent6cfa3b4dab16a1040c07fda6ca4041e0dca32904 (diff)
downloadgnutls-97726aa26eef02b192b8f571beca02f954b9b4e2.tar.gz
nettle 2.7 is required
-rw-r--r--lib/algorithms/mac.c2
-rw-r--r--lib/nettle/cipher.c4
-rw-r--r--lib/nettle/mac.c14
-rw-r--r--m4/hooks.m48
4 files changed, 4 insertions, 24 deletions
diff --git a/lib/algorithms/mac.c b/lib/algorithms/mac.c
index e33c826381..81e038acdf 100644
--- a/lib/algorithms/mac.c
+++ b/lib/algorithms/mac.c
@@ -45,9 +45,7 @@ static const gnutls_hash_entry hash_algorithms[] = {
{"SHA384", HASH_OID_SHA384, GNUTLS_MAC_SHA384, 48, 48, 0, 0, 1},
{"SHA512", HASH_OID_SHA512, GNUTLS_MAC_SHA512, 64, 64, 0, 0, 1},
{"SHA224", HASH_OID_SHA224, GNUTLS_MAC_SHA224, 28, 28, 0, 0, 1},
-#ifdef HAVE_NETTLE27
{"UMAC-96", NULL, GNUTLS_MAC_UMAC_96, 12, 16, 8, 0, 1},
-#endif
{"AEAD", NULL, GNUTLS_MAC_AEAD, 0, 0, 0, 1, 1},
{"MD2", HASH_OID_MD2, GNUTLS_MAC_MD2, 0, 0, 0, 0, 0}, /* not used as MAC */
{"RIPEMD160", HASH_OID_RMD160, GNUTLS_MAC_RMD160, 20, 20, 0, 0, 1},
diff --git a/lib/nettle/cipher.c b/lib/nettle/cipher.c
index ccfe87b806..57aa15901a 100644
--- a/lib/nettle/cipher.c
+++ b/lib/nettle/cipher.c
@@ -119,9 +119,7 @@ static int wrap_nettle_cipher_exists(gnutls_cipher_algorithm_t algo)
case GNUTLS_CIPHER_DES_CBC:
case GNUTLS_CIPHER_ARCFOUR_128:
case GNUTLS_CIPHER_SALSA20_256:
-#ifdef HAVE_NETTLE27
case GNUTLS_CIPHER_ESTREAM_SALSA20_256:
-#endif
case GNUTLS_CIPHER_ARCFOUR_40:
case GNUTLS_CIPHER_RC2_40_CBC:
return 1;
@@ -210,7 +208,6 @@ wrap_nettle_cipher_init (gnutls_cipher_algorithm_t algo, void **_ctx, int enc)
ctx->ctx_ptr = &ctx->ctx.salsa20;
ctx->block_size = 1;
break;
-#ifdef HAVE_NETTLE27
case GNUTLS_CIPHER_ESTREAM_SALSA20_256:
ctx->encrypt = stream_encrypt;
ctx->decrypt = stream_encrypt;
@@ -219,7 +216,6 @@ wrap_nettle_cipher_init (gnutls_cipher_algorithm_t algo, void **_ctx, int enc)
ctx->ctx_ptr = &ctx->ctx.salsa20;
ctx->block_size = 1;
break;
-#endif
case GNUTLS_CIPHER_RC2_40_CBC:
ctx->encrypt = cbc_encrypt;
ctx->decrypt = cbc_decrypt;
diff --git a/lib/nettle/mac.c b/lib/nettle/mac.c
index 856ff5a75e..6a52e5917c 100644
--- a/lib/nettle/mac.c
+++ b/lib/nettle/mac.c
@@ -30,9 +30,7 @@
#include <nettle/md2.h>
#include <nettle/sha.h>
#include <nettle/hmac.h>
-#ifdef HAVE_NETTLE27
-# include <nettle/umac.h>
-#endif
+#include <nettle/umac.h>
typedef void (*update_func) (void *, unsigned, const uint8_t *);
typedef void (*digest_func) (void *, unsigned, uint8_t *);
@@ -70,9 +68,7 @@ struct nettle_mac_ctx
struct hmac_sha384_ctx sha384;
struct hmac_sha512_ctx sha512;
struct hmac_sha1_ctx sha1;
-#ifdef HAVE_NETTLE27
struct umac96_ctx umac;
-#endif
} ctx;
/* this is the context just after
@@ -86,9 +82,7 @@ struct nettle_mac_ctx
struct hmac_sha384_ctx sha384;
struct hmac_sha512_ctx sha512;
struct hmac_sha1_ctx sha1;
-#ifdef HAVE_NETTLE27
struct umac96_ctx umac;
-#endif
} init_ctx;
void *ctx_ptr;
gnutls_mac_algorithm_t algo;
@@ -99,13 +93,11 @@ struct nettle_mac_ctx
set_nonce_func set_nonce;
};
-#ifdef HAVE_NETTLE27
static void
_wrap_umac96_set_key(void* ctx, unsigned len, const uint8_t* key)
{
return umac96_set_key(ctx, key);
}
-#endif
static int _mac_ctx_init(gnutls_mac_algorithm_t algo, struct nettle_mac_ctx *ctx)
{
@@ -154,7 +146,6 @@ static int _mac_ctx_init(gnutls_mac_algorithm_t algo, struct nettle_mac_ctx *ctx
ctx->ctx_ptr = &ctx->ctx.sha512;
ctx->length = SHA512_DIGEST_SIZE;
break;
-#ifdef HAVE_NETTLE27
case GNUTLS_MAC_UMAC_96:
ctx->update = (update_func) umac96_update;
ctx->digest = (digest_func) umac96_digest;
@@ -163,7 +154,6 @@ static int _mac_ctx_init(gnutls_mac_algorithm_t algo, struct nettle_mac_ctx *ctx
ctx->ctx_ptr = &ctx->ctx.umac;
ctx->length = 12;
break;
-#endif
default:
gnutls_assert ();
return GNUTLS_E_INVALID_REQUEST;
@@ -204,9 +194,7 @@ static int wrap_nettle_mac_exists(gnutls_mac_algorithm_t algo)
case GNUTLS_MAC_SHA256:
case GNUTLS_MAC_SHA384:
case GNUTLS_MAC_SHA512:
-#ifdef HAVE_NETTLE27
case GNUTLS_MAC_UMAC_96:
-#endif
return 1;
default:
return 0;
diff --git a/m4/hooks.m4 b/m4/hooks.m4
index 725acf03bf..7012149a5d 100644
--- a/m4/hooks.m4
+++ b/m4/hooks.m4
@@ -89,12 +89,12 @@ dnl fi
AC_MSG_CHECKING([whether to use nettle])
if test "$cryptolib" = "nettle";then
AC_MSG_RESULT(yes)
- AC_LIB_HAVE_LINKFLAGS([nettle], [hogweed gmp], [#include <nettle/rsa.h>],
- [rsa_decrypt_tr (0,0,0,0,0,0,0)])
+ AC_LIB_HAVE_LINKFLAGS([nettle], [hogweed gmp], [#include <nettle/umac.h>],
+ [nettle_umac96_set_nonce (0,0,0)])
if test "$ac_cv_libnettle" != yes; then
AC_MSG_ERROR([[
***
- *** Libnettle 2.5 was not found. Note that you must compile nettle with gmp support.
+ *** Libnettle 2.7 was not found. Note that you must compile nettle with gmp support.
]])
fi
else
@@ -102,8 +102,6 @@ else
fi
AM_CONDITIONAL(ENABLE_NETTLE, test "$cryptolib" = "nettle")
- AC_CHECK_LIB([nettle], [nettle_umac96_set_nonce], [AC_DEFINE([HAVE_NETTLE27], [], [UMAC detected in nettle])])
-
AC_ARG_WITH(included-libtasn1,
AS_HELP_STRING([--with-included-libtasn1], [use the included libtasn1]),
included_libtasn1=$withval,