gnutls-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[SCM] GNU gnutls branch, master, updated. gnutls_2_11_6-116-gf2ffa6b


From: Nikos Mavrogiannopoulos
Subject: [SCM] GNU gnutls branch, master, updated. gnutls_2_11_6-116-gf2ffa6b
Date: Mon, 07 Feb 2011 16:01:16 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU gnutls".

http://git.savannah.gnu.org/cgit/gnutls.git/commit/?id=f2ffa6bd97faca66f7a60b1398c39f4300c3359a

The branch, master has been updated
       via  f2ffa6bd97faca66f7a60b1398c39f4300c3359a (commit)
       via  459f751e216446ece2cd5aa3d355736ce41c7551 (commit)
      from  fde8ca28df9eabf495c9fd81d8a6bbdb5d28ab22 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit f2ffa6bd97faca66f7a60b1398c39f4300c3359a
Author: Nikos Mavrogiannopoulos <address@hidden>
Date:   Mon Feb 7 16:59:57 2011 +0100

    Removed upper limit on MAC algorithm key.

commit 459f751e216446ece2cd5aa3d355736ce41c7551
Author: Nikos Mavrogiannopoulos <address@hidden>
Date:   Mon Feb 7 16:57:52 2011 +0100

    improved premature_termination error message

-----------------------------------------------------------------------

Summary of changes:
 lib/gnutls_errors.c |    2 +-
 lib/nettle/mac.c    |   43 +++++++++++++++++++++++++++----------------
 2 files changed, 28 insertions(+), 17 deletions(-)

diff --git a/lib/gnutls_errors.c b/lib/gnutls_errors.c
index ca3403c..95de0f4 100644
--- a/lib/gnutls_errors.c
+++ b/lib/gnutls_errors.c
@@ -74,7 +74,7 @@ static const gnutls_error_entry error_algorithms[] = {
                GNUTLS_E_DH_PRIME_UNACCEPTABLE, 1),
   ERROR_ENTRY (N_("A TLS packet with unexpected length was received."),
                GNUTLS_E_UNEXPECTED_PACKET_LENGTH, 1),
-  ERROR_ENTRY (N_("A TLS connection was non-properly terminated."),
+  ERROR_ENTRY (N_("The TLS connection was non-properly terminated."),
                GNUTLS_E_PREMATURE_TERMINATION, 1),
   ERROR_ENTRY (N_
                ("The specified session has been invalidated for some reason."),
diff --git a/lib/nettle/mac.c b/lib/nettle/mac.c
index b3f09b7..ffa708a 100644
--- a/lib/nettle/mac.c
+++ b/lib/nettle/mac.c
@@ -58,13 +58,6 @@ struct nettle_hash_ctx
   digest_func digest;
 };
 
-/* FIXME: Nettle doesn't have a reset function for
- * hmac so we need to manually reset a context, by
- * calling set_key(). For that reason we need to
- * store the hmac key here.
- */
-#define MAX_HMAC_KEY 1024
-
 struct nettle_hmac_ctx
 {
   union
@@ -82,7 +75,13 @@ struct nettle_hmac_ctx
   update_func update;
   digest_func digest;
   set_key_func setkey;
-  opaque key[MAX_HMAC_KEY];
+
+/* FIXME: Nettle doesn't have a reset function for
+ * hmac so we need to manually reset a context, by
+ * calling set_key(). For that reason we need to
+ * store the hmac key here.
+ */
+  opaque *key;
   size_t key_size;
 };
 
@@ -91,7 +90,7 @@ wrap_nettle_hmac_init (gnutls_mac_algorithm_t algo, void 
**_ctx)
 {
   struct nettle_hmac_ctx *ctx;
 
-  ctx = gnutls_malloc (sizeof (struct nettle_hmac_ctx));
+  ctx = gnutls_calloc (1, sizeof (struct nettle_hmac_ctx));
   if (ctx == NULL)
     {
       gnutls_assert ();
@@ -159,11 +158,13 @@ wrap_nettle_hmac_setkey (void *_ctx, const void *key, 
size_t keylen)
 {
   struct nettle_hmac_ctx *ctx = _ctx;
 
-  if (keylen > MAX_HMAC_KEY)
-    {
-      gnutls_assert();
-      return GNUTLS_E_INTERNAL_ERROR;
-    }
+  if (ctx->key)
+    gnutls_free(ctx->key);
+
+  ctx->key = gnutls_malloc(keylen);
+  if (ctx->key == NULL)
+    return GNUTLS_E_MEMORY_ERROR;
+
   memcpy(ctx->key, key, keylen);
   ctx->key_size = keylen;
 
@@ -178,7 +179,6 @@ wrap_nettle_hmac_reset (void *_ctx)
   struct nettle_hmac_ctx *ctx = _ctx;
 
   ctx->setkey (ctx->ctx_ptr, ctx->key_size, ctx->key);
-  
 }
 
 static int
@@ -191,6 +191,17 @@ wrap_nettle_hmac_update (void *_ctx, const void *text, 
size_t textsize)
   return GNUTLS_E_SUCCESS;
 }
 
+static void
+wrap_nettle_hmac_deinit (void *hd)
+{
+  struct nettle_hmac_ctx *ctx = hd;
+
+  gnutls_free (ctx->key);
+  gnutls_free (hd);
+}
+
+/* Hash functions 
+ */
 static int
 wrap_nettle_hash_update (void *_ctx, const void *text, size_t textsize)
 {
@@ -364,7 +375,7 @@ gnutls_crypto_mac_st _gnutls_mac_ops = {
   .hash = wrap_nettle_hmac_update,
   .reset = wrap_nettle_hmac_reset,
   .output = wrap_nettle_hmac_output,
-  .deinit = wrap_nettle_hash_deinit,
+  .deinit = wrap_nettle_hmac_deinit,
 };
 
 gnutls_crypto_digest_st _gnutls_digest_ops = {


hooks/post-receive
-- 
GNU gnutls



reply via email to

[Prev in Thread] Current Thread [Next in Thread]