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_3_0_5-27-gcb9bd9f


From: Nikos Mavrogiannopoulos
Subject: [SCM] GNU gnutls branch, master, updated. gnutls_3_0_5-27-gcb9bd9f
Date: Fri, 04 Nov 2011 18:54:39 +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=cb9bd9f425b7c5d01a2ccf41ae2cb0101da24c5e

The branch, master has been updated
       via  cb9bd9f425b7c5d01a2ccf41ae2cb0101da24c5e (commit)
      from  6e47f6043aa7c25055e43b2a9d5322db63604d52 (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 cb9bd9f425b7c5d01a2ccf41ae2cb0101da24c5e
Author: Nikos Mavrogiannopoulos <address@hidden>
Date:   Fri Nov 4 19:55:00 2011 +0100

    corrected NULL cipher encryption. Reported by Fabrice Gautier.

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

Summary of changes:
 lib/gnutls_cipher_int.c |   38 ++++++++++++++++++++++++--------------
 lib/gnutls_cipher_int.h |    5 +++--
 2 files changed, 27 insertions(+), 16 deletions(-)

diff --git a/lib/gnutls_cipher_int.c b/lib/gnutls_cipher_int.c
index d61d2c8..5814d51 100644
--- a/lib/gnutls_cipher_int.c
+++ b/lib/gnutls_cipher_int.c
@@ -41,6 +41,9 @@ _gnutls_cipher_init (cipher_hd_st * handle, 
gnutls_cipher_algorithm_t cipher,
   int ret = GNUTLS_E_INTERNAL_ERROR;
   const gnutls_crypto_cipher_st *cc = NULL;
 
+  if (cipher == GNUTLS_CIPHER_NULL)
+    return gnutls_assert_val(GNUTLS_E_INVALID_REQUEST);
+
   handle->is_aead = _gnutls_cipher_algo_is_aead(cipher);
   if (handle->is_aead)
      handle->tag_size = gnutls_cipher_get_block_size(cipher);
@@ -124,12 +127,14 @@ int ret;
 
   memset(handle, 0, sizeof(*handle));
 
-  ret = _gnutls_cipher_init(&handle->cipher, cipher, cipher_key, iv, enc);
-  if (ret < 0)
+  if (cipher != GNUTLS_CIPHER_NULL)
     {
-      gnutls_assert();
-      return ret;
+      ret = _gnutls_cipher_init(&handle->cipher, cipher, cipher_key, iv, enc);
+      if (ret < 0)
+        return gnutls_assert_val(ret);
     }
+  else
+    handle->is_null = 1;
 
   if (mac != GNUTLS_MAC_AEAD)
     {
@@ -153,7 +158,8 @@ int ret;
 
   return 0;
 cleanup:
-  _gnutls_cipher_deinit(&handle->cipher);
+  if (handle->is_null == 0)
+    _gnutls_cipher_deinit(&handle->cipher);
   return ret;
 
 }
@@ -196,9 +202,12 @@ int ret;
       if (ret < 0)
         return gnutls_assert_val(ret);
 
-      ret = _gnutls_cipher_encrypt2(&handle->cipher, text, textlen, 
ciphertext, ciphertextlen);
-      if (ret < 0)
-        return gnutls_assert_val(ret);
+      if (handle->is_null==0)
+        {
+          ret = _gnutls_cipher_encrypt2(&handle->cipher, text, textlen, 
ciphertext, ciphertextlen);
+          if (ret < 0)
+            return gnutls_assert_val(ret);
+        }
     }
   else if (_gnutls_cipher_is_aead(&handle->cipher))
     {
@@ -220,12 +229,12 @@ int _gnutls_auth_cipher_decrypt2 (auth_cipher_hd_st * 
handle,
 {
 int ret;
 
-  ret = _gnutls_cipher_decrypt2(&handle->cipher, ciphertext, ciphertextlen, 
-    text, textlen);
-  if (ret < 0)
+  if (handle->is_null==0)
     {
-      gnutls_assert();
-      return ret;
+      ret = _gnutls_cipher_decrypt2(&handle->cipher, ciphertext, 
ciphertextlen, 
+        text, textlen);
+      if (ret < 0)
+        return gnutls_assert_val(ret);
     }
 
   if (handle->is_mac)
@@ -278,5 +287,6 @@ void _gnutls_auth_cipher_deinit (auth_cipher_hd_st * handle)
       else
         _gnutls_hmac_deinit(&handle->mac, NULL);
     }
-  _gnutls_cipher_deinit(&handle->cipher);
+  if (handle->is_null==0)
+    _gnutls_cipher_deinit(&handle->cipher);
 }
diff --git a/lib/gnutls_cipher_int.h b/lib/gnutls_cipher_int.h
index bd2b68d..301bce8 100644
--- a/lib/gnutls_cipher_int.h
+++ b/lib/gnutls_cipher_int.h
@@ -141,8 +141,9 @@ typedef struct
 {
   cipher_hd_st cipher;
   digest_hd_st mac;
-  int is_mac:1;
-  int ssl_hmac:1;
+  unsigned int is_mac:1;
+  unsigned int ssl_hmac:1;
+  unsigned int is_null:1;
   int tag_size;
 } auth_cipher_hd_st;
 


hooks/post-receive
-- 
GNU gnutls



reply via email to

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