]> git.ipfire.org Git - thirdparty/gnutls.git/commitdiff
Do not handle MAC reset separately. It is implied by nettle's output function.
authorNikos Mavrogiannopoulos <nmav@gnutls.org>
Fri, 26 Apr 2013 21:37:07 +0000 (00:37 +0300)
committerNikos Mavrogiannopoulos <nmav@gnutls.org>
Fri, 26 Apr 2013 21:37:07 +0000 (00:37 +0300)
lib/accelerated/x86/hmac-padlock.c
lib/crypto-backend.h
lib/gnutls_cipher_int.c
lib/gnutls_hash_int.c
lib/gnutls_hash_int.h
lib/nettle/mac.c

index d8057eb291fa42a2a20476c814f887421f5ba8d0..5da3571f3893d3b3dae26342b93811cfdf9d333b 100644 (file)
@@ -54,17 +54,6 @@ struct padlock_hmac_ctx
         struct hmac_sha1_ctx sha1;
     } ctx;
 
-    /* this is the context just after
-     * the set_key. Used in reset().
-     */
-    union
-    {
-        struct hmac_sha224_ctx sha224;
-        struct hmac_sha256_ctx sha256;
-        struct hmac_sha384_ctx sha384;
-        struct hmac_sha512_ctx sha512;
-        struct hmac_sha1_ctx sha1;
-    } init_ctx;
     void *ctx_ptr;
     gnutls_mac_algorithm_t algo;
     size_t length;
@@ -244,19 +233,9 @@ wrap_padlock_hmac_setkey (void *_ctx, const void *key, size_t keylen)
 
     ctx->setkey (ctx->ctx_ptr, keylen, key);
 
-    memcpy (&ctx->init_ctx, &ctx->ctx, sizeof (ctx->ctx));
-
     return GNUTLS_E_SUCCESS;
 }
 
-static void
-wrap_padlock_hmac_reset (void *_ctx)
-{
-    struct padlock_hmac_ctx *ctx = _ctx;
-
-    memcpy (&ctx->ctx, &ctx->init_ctx, sizeof (ctx->ctx));
-}
-
 static int
 wrap_padlock_hmac_update (void *_ctx, const void *text, size_t textsize)
 {
@@ -357,7 +336,6 @@ const gnutls_crypto_mac_st hmac_sha_padlock_struct = {
     .setkey = NULL,
     .setnonce = NULL,
     .hash = NULL,
-    .reset = NULL,
     .output = NULL,
     .deinit = NULL,
     .fast = wrap_padlock_hmac_fast
@@ -368,7 +346,6 @@ const gnutls_crypto_mac_st hmac_sha_padlock_nano_struct = {
     .setkey = wrap_padlock_hmac_setkey,
     .setnonce = NULL,
     .hash = wrap_padlock_hmac_update,
-    .reset = wrap_padlock_hmac_reset,
     .output = wrap_padlock_hmac_output,
     .deinit = wrap_padlock_hmac_deinit,
     .fast = wrap_padlock_hmac_fast,
index 955e4bd1e8067788b105c51f9b0360bd6835536f..eba691badbb826ae591f2a6a534fcf2025d359c0 100644 (file)
@@ -52,7 +52,6 @@
     int (*init) (gnutls_mac_algorithm_t, void **ctx);
     int (*setkey) (void *ctx, const void *key, size_t keysize);
     int (*setnonce) (void *ctx, const void *nonce, size_t noncesize);
-    void (*reset) (void *ctx);
     int (*hash) (void *ctx, const void *text, size_t textsize);
     int (*output) (void *src_ctx, void *digest, size_t digestsize);
     void (*deinit) (void *ctx);
index 0744aea4e3641e7ca5860a65c18c4e3ec32b9602..d56bf0a4ffcc368ebcdb02bcdb88c1457c2944b6 100644 (file)
@@ -283,7 +283,6 @@ int ret;
       else
         {
           _gnutls_mac_output (&handle->mac.mac, tag);
-          _gnutls_mac_reset (&handle->mac.mac);
         }
     }
   else if (_gnutls_cipher_is_aead(&handle->cipher))
index 439b91c64783cdd71a0b5bc8283bcf5ae013ecd8..2621ec4256022283e401681145b439fe6a577463 100644 (file)
@@ -232,7 +232,6 @@ _gnutls_mac_init (mac_hd_st * mac, gnutls_mac_algorithm_t algorithm,
       mac->setnonce = cc->setnonce;
       mac->output = cc->output;
       mac->deinit = cc->deinit;
-      mac->reset = cc->reset;
 
       return 0;
     }
@@ -248,7 +247,6 @@ _gnutls_mac_init (mac_hd_st * mac, gnutls_mac_algorithm_t algorithm,
   mac->setnonce = _gnutls_mac_ops.setnonce;
   mac->output = _gnutls_mac_ops.output;
   mac->deinit = _gnutls_mac_ops.deinit;
-  mac->reset = _gnutls_mac_ops.reset;
 
   if (_gnutls_mac_ops.setkey (mac->handle, key, keylen) < 0)
     {
index cb0de13d22563f327e06599ec4ea728f637135e2..c83c01d87eb406aa6ebe4df178106203f388c969 100644 (file)
@@ -62,7 +62,6 @@ typedef struct
   int mac_len;
 
   hash_func hash;
-  reset_func reset;
   nonce_func setnonce;
   output_func output;
   deinit_func deinit;
@@ -111,18 +110,6 @@ _gnutls_mac_set_nonce (mac_hd_st * handle, const void *nonce, size_t n_size)
 void
 _gnutls_mac_deinit (mac_hd_st * handle, void *digest);
 
-inline static void
-_gnutls_mac_reset (mac_hd_st * handle)
-{
-  if (handle->handle == NULL)
-    {
-      return;
-    }
-
-  handle->reset (handle->handle);
-}
-
-
 /* Hash interface */
 int _gnutls_hash_init (digest_hd_st *, gnutls_digest_algorithm_t algorithm);
 
index 6a52e5917c3b178fca2cdac50267fae46a373114..9e95c2a1ad9b5f09f1d1621cee59f80bf14b3c30 100644 (file)
@@ -71,19 +71,6 @@ struct nettle_mac_ctx
     struct umac96_ctx umac;
   } ctx;
   
-  /* this is the context just after
-   * the set_key. Used in reset().
-   */
-  union
-  {
-    struct hmac_md5_ctx md5;
-    struct hmac_sha224_ctx sha224;
-    struct hmac_sha256_ctx sha256;
-    struct hmac_sha384_ctx sha384;
-    struct hmac_sha512_ctx sha512;
-    struct hmac_sha1_ctx sha1;
-    struct umac96_ctx umac;
-  } init_ctx;
   void *ctx_ptr;
   gnutls_mac_algorithm_t algo;
   size_t length;
@@ -235,8 +222,6 @@ wrap_nettle_mac_set_key (void *_ctx, const void *key, size_t keylen)
 
   ctx->set_key (ctx->ctx_ptr, keylen, key);
   
-  memcpy(&ctx->init_ctx, &ctx->ctx, sizeof(ctx->ctx));
-
   return GNUTLS_E_SUCCESS;
 }
 
@@ -253,14 +238,6 @@ wrap_nettle_mac_set_nonce (void *_ctx, const void *nonce, size_t noncelen)
   return GNUTLS_E_SUCCESS;
 }
 
-static void
-wrap_nettle_mac_reset (void *_ctx)
-{
-  struct nettle_mac_ctx *ctx = _ctx;
-
-  memcpy(&ctx->ctx, &ctx->init_ctx, sizeof(ctx->ctx));
-}
-
 static int
 wrap_nettle_mac_update (void *_ctx, const void *text, size_t textsize)
 {
@@ -466,7 +443,6 @@ gnutls_crypto_mac_st _gnutls_mac_ops = {
   .setkey = wrap_nettle_mac_set_key,
   .setnonce = wrap_nettle_mac_set_nonce,
   .hash = wrap_nettle_mac_update,
-  .reset = wrap_nettle_mac_reset,
   .output = wrap_nettle_mac_output,
   .deinit = wrap_nettle_mac_deinit,
   .fast = wrap_nettle_mac_fast,