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-147-g03085b0


From: Nikos Mavrogiannopoulos
Subject: [SCM] GNU gnutls branch, master, updated. gnutls_2_11_6-147-g03085b0
Date: Thu, 10 Feb 2011 18:17:06 +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=03085b0e23551ddcfabc0868cd9990f6371e876e

The branch, master has been updated
       via  03085b0e23551ddcfabc0868cd9990f6371e876e (commit)
      from  374cee6a96d73634bea443c60be471d844f6203a (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 03085b0e23551ddcfabc0868cd9990f6371e876e
Author: Nikos Mavrogiannopoulos <address@hidden>
Date:   Thu Feb 10 19:16:53 2011 +0100

    upgraded to nettle's new GCM API.

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

Summary of changes:
 lib/nettle/cipher.c |   47 ++++++++++-------------------------------------
 1 files changed, 10 insertions(+), 37 deletions(-)

diff --git a/lib/nettle/cipher.c b/lib/nettle/cipher.c
index 17c2fd7..ba9b214 100644
--- a/lib/nettle/cipher.c
+++ b/lib/nettle/cipher.c
@@ -68,13 +68,6 @@ struct aes_bidi_ctx
   struct aes_ctx decrypt;
 };
 
-struct gcm_full_ctx
-{
-  struct gcm_ctx gcm;
-  void *cipher;
-  nettle_crypt_func *f;
-};
-
 static void
 aes_bidi_setkey (struct aes_bidi_ctx *ctx, unsigned length,
                  const uint8_t * key)
@@ -135,13 +128,10 @@ struct nettle_cipher_ctx
     struct arctwo_ctx arctwo;
     struct des3_ctx des3;
     struct des_ctx des;
-  } ctx;
 #ifdef NETTLE_GCM
-  union
-  {
-    struct gcm_full_ctx gcm;
-  } mode_ctx;
+    struct gcm_aes_ctx aes_gcm;
 #endif
+  } ctx;
   void *ctx_ptr;
   uint8_t iv[MAX_BLOCK_SIZE];
   gnutls_cipher_algorithm_t algo;
@@ -162,9 +152,7 @@ static void _gcm_encrypt(void *_ctx, nettle_crypt_func f,
             unsigned length, uint8_t *dst,
             const uint8_t *src)
 {
-struct gcm_full_ctx *ctx = _ctx;
-
-  return gcm_encrypt(&ctx->gcm, ctx->cipher, ctx->f, length, dst, src);
+  return gcm_aes_encrypt(_ctx, length, dst, src);
 }
 
 static void _gcm_decrypt(void *_ctx, nettle_crypt_func f,  
@@ -172,17 +160,9 @@ static void _gcm_decrypt(void *_ctx, nettle_crypt_func f,
             unsigned length, uint8_t *dst,
             const uint8_t *src)
 {
-struct gcm_full_ctx *ctx = _ctx;
-
-  return gcm_decrypt(&ctx->gcm, ctx->cipher, ctx->f, length, dst, src);
+  return gcm_aes_decrypt(_ctx, length, dst, src);
 }
 
-static void _gcm_tag(void *_ctx, unsigned length, uint8_t *dst)
-{
-struct gcm_full_ctx *ctx = _ctx;
-
-  gcm_digest(&ctx->gcm, ctx->cipher, ctx->f, length, dst);
-}
 #endif
 
 static int
@@ -205,10 +185,10 @@ wrap_nettle_cipher_init (gnutls_cipher_algorithm_t algo, 
void **_ctx)
     case GNUTLS_CIPHER_AES_128_GCM:
       ctx->encrypt = _gcm_encrypt;
       ctx->decrypt = _gcm_decrypt;
-      ctx->i_encrypt = (nettle_crypt_func *) aes_bidi_encrypt;
-      ctx->auth = (auth_func)gcm_auth;
-      ctx->tag = _gcm_tag;
-      ctx->ctx_ptr = &ctx->mode_ctx.gcm;
+      ctx->i_encrypt = (nettle_crypt_func*) aes_bidi_encrypt;
+      ctx->auth = (auth_func)gcm_aes_auth;
+      ctx->tag = (tag_func)gcm_aes_digest;
+      ctx->ctx_ptr = &ctx->ctx.aes_gcm;
       ctx->block_size = AES_BLOCK_SIZE;
       break;
 #endif
@@ -284,14 +264,7 @@ wrap_nettle_cipher_setkey (void *_ctx, const void *key, 
size_t keysize)
     {
 #ifdef NETTLE_GCM
     case GNUTLS_CIPHER_AES_128_GCM:
-      aes_bidi_setkey (&ctx->ctx.aes_bidi, keysize, key);
-
-      ctx->mode_ctx.gcm.cipher = &ctx->ctx.aes_bidi;
-      ctx->mode_ctx.gcm.f = ctx->i_encrypt;
-  
-      gcm_set_key(&ctx->mode_ctx.gcm.gcm, ctx->mode_ctx.gcm.cipher,
-        ctx->mode_ctx.gcm.f);
-
+      gcm_aes_set_key(&ctx->ctx.aes_gcm, keysize, key);
       break;
 #endif
     case GNUTLS_CIPHER_AES_128_CBC:
@@ -364,7 +337,7 @@ struct nettle_cipher_ctx *ctx = _ctx;
           return GNUTLS_E_INVALID_REQUEST;
         }
 
-      gcm_set_iv(&ctx->mode_ctx.gcm.gcm, GCM_DEFAULT_NONCE_SIZE, iv);
+      gcm_aes_set_iv(&ctx->ctx.aes_gcm, GCM_DEFAULT_NONCE_SIZE, iv);
       break;
 #endif
     default:


hooks/post-receive
-- 
GNU gnutls



reply via email to

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