]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
* grub-core/fs/zfs/zfscrypt.c (grub_ccm_decrypt): Return right error
authorVladimir Serbinenko <phcoder@gmail.com>
Wed, 6 Nov 2013 23:59:44 +0000 (00:59 +0100)
committerVladimir Serbinenko <phcoder@gmail.com>
Wed, 6 Nov 2013 23:59:44 +0000 (00:59 +0100)
type.
(grub_gcm_decrypt): Likewise.
(algo_decrypt): Likewise.
(grub_zfs_decrypt_real): Transform error type.

ChangeLog
grub-core/fs/zfs/zfscrypt.c

index fb8e248893a1290533237945a92c45c98f6e8488..69efb31bc7337999b1733baffa4022cbc3589aa2 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2013-11-07  Vladimir Serbinenko  <phcoder@gmail.com>
+
+       * grub-core/fs/zfs/zfscrypt.c (grub_ccm_decrypt): Return right error
+       type.
+       (grub_gcm_decrypt): Likewise.
+       (algo_decrypt): Likewise.
+       (grub_zfs_decrypt_real): Transform error type.
+
 2013-11-07  Vladimir Serbinenko  <phcoder@gmail.com>
 
        * grub-core/disk/geli.c (geli_rekey): Fix error return type.
index d5f9dcdbc8b1bf3352dd6696c148c5792283e7bf..88dae72efc4d83435773c5690bb3678650ee9b70 100644 (file)
@@ -143,7 +143,7 @@ grub_ccm_decrypt (grub_crypto_cipher_handle_t cipher,
     return err;
   if (mac_out)
     grub_crypto_xor (mac_out, mac, mul, m);
-  return GRUB_ERR_NONE;
+  return GPG_ERR_NO_ERROR;
 }
 
 static void
@@ -244,7 +244,7 @@ grub_gcm_decrypt (grub_crypto_cipher_handle_t cipher,
   if (mac_out)
     grub_crypto_xor (mac_out, mac, mac_xor, m);
 
-  return GRUB_ERR_NONE;
+  return GPG_ERR_NO_ERROR;
 }
 
 
@@ -258,13 +258,14 @@ algo_decrypt (grub_crypto_cipher_handle_t cipher, grub_uint64_t algo,
   switch (algo)
     {
     case 0:
-      return grub_ccm_decrypt (cipher, out, in, psize, mac_out, nonce, l, m);
+      return grub_ccm_decrypt (cipher, out, in, psize,
+                              mac_out, nonce, l, m);
     case 1:
-      return grub_gcm_decrypt (cipher, out, in, psize, mac_out, nonce,
+      return grub_gcm_decrypt (cipher, out, in, psize,
+                              mac_out, nonce,
                               15 - l, m);
     default:
-      return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET, "algorithm %lld is not supported yet",
-                        (long long) algo);
+      return GPG_ERR_CIPHER_ALGO;
     }
 }
 
@@ -279,7 +280,7 @@ grub_zfs_decrypt_real (grub_crypto_cipher_handle_t cipher,
   grub_uint32_t mac[4];
   unsigned i;
   grub_uint32_t sw[4];
-  grub_err_t err;
+  gcry_err_code_t err;
       
   grub_memcpy (sw, nonce, 16);
   if (endian != GRUB_ZFS_BIG_ENDIAN)
@@ -295,7 +296,7 @@ grub_zfs_decrypt_real (grub_crypto_cipher_handle_t cipher,
                      size, mac,
                      sw + 1, 3, 12);
   if (err)
-    return err;
+    return grub_crypto_gcry_error (err);
   
   for (i = 0; i < 3; i++)
     if (grub_zfs_to_cpu32 (expected_mac[i], endian)