]> git.ipfire.org Git - thirdparty/gnutls.git/commitdiff
Always use encryption direction.
authorNikos Mavrogiannopoulos <nmav@gnutls.org>
Wed, 5 Oct 2011 06:41:01 +0000 (08:41 +0200)
committerNikos Mavrogiannopoulos <nmav@gnutls.org>
Wed, 5 Oct 2011 06:41:01 +0000 (08:41 +0200)
lib/accelerated/x86/aes-gcm-padlock.c

index 28292adc874396713f5120ee90541aea80ab187d..5039e86f7cdefc9827c1f00968170ad6849ccab7 100644 (file)
@@ -45,7 +45,6 @@
  * Actually padlock doesn't include GCM mode. We just use
  * the ECB part of padlock and nettle for everything else.
  */
-
 struct gcm_padlock_aes_ctx GCM_CTX(struct padlock_ctx);
 
 static void padlock_aes_encrypt(void *_ctx,
@@ -63,6 +62,9 @@ static void padlock_aes_encrypt(void *_ctx,
 static void padlock_aes_set_encrypt_key(struct padlock_ctx *_ctx,
                                         unsigned length, const uint8_t *key)
 {
+  struct padlock_ctx *ctx = _ctx;
+  ctx->enc = 1;
+  
   padlock_aes_cipher_setkey(_ctx, key, length);
 }
 
@@ -106,7 +108,7 @@ aes_gcm_setiv (void *_ctx, const void *iv, size_t iv_size)
   struct gcm_padlock_aes_ctx *ctx = _ctx;
 
   if (iv_size != GCM_BLOCK_SIZE - 4)
-    return GNUTLS_E_INVALID_REQUEST;
+    return gnutls_assert_val(GNUTLS_E_INVALID_REQUEST);
   
   GCM_SET_IV(ctx, iv_size, iv);