Merge branch 'veritysetup'
[platform/upstream/cryptsetup.git] / lib / loopaes / loopaes.c
index b14243a..35345eb 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * loop-AES compatible volume handling
  *
- * Copyright (C) 2011, Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2011-2012, Red Hat, Inc. All rights reserved.
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
@@ -14,7 +14,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
 #include <errno.h>
@@ -22,8 +22,9 @@
 #include <stdlib.h>
 #include <string.h>
 
-#include "crypto_backend.h"
+#include "libcryptsetup.h"
 #include "loopaes.h"
+#include "internal.h"
 
 static const char *get_hash(unsigned int key_size)
 {
@@ -191,18 +192,22 @@ int LOOPAES_activate(struct crypt_device *cd,
        uint32_t req_flags;
        int r;
        struct crypt_dm_active_device dmd = {
-               .device = crypt_get_device_name(cd),
-               .cipher = NULL,
+               .target = DM_CRYPT,
                .uuid   = crypt_get_uuid(cd),
-               .vk    = vk,
-               .offset = crypt_get_data_offset(cd),
-               .iv_offset = crypt_get_iv_offset(cd),
                .size   = 0,
-               .flags  = flags
+               .flags  = flags,
+               .data_device = crypt_get_device_name(cd),
+               .u.crypt  = {
+                       .cipher = NULL,
+                       .vk     = vk,
+                       .offset = crypt_get_data_offset(cd),
+                       .iv_offset = crypt_get_iv_offset(cd),
+               }
        };
 
 
-       r = device_check_and_adjust(cd, dmd.device, DEV_EXCL, &dmd.size, &dmd.offset, &flags);
+       r = device_check_and_adjust(cd, dmd.data_device, DEV_EXCL,
+                                   &dmd.size, &dmd.u.crypt.offset, &flags);
        if (r)
                return r;
 
@@ -216,8 +221,9 @@ int LOOPAES_activate(struct crypt_device *cd,
        if (r < 0)
                return -ENOMEM;
 
-       dmd.cipher = cipher;
-       log_dbg("Trying to activate loop-AES device %s using cipher %s.", name, dmd.cipher);
+       dmd.u.crypt.cipher = cipher;
+       log_dbg("Trying to activate loop-AES device %s using cipher %s.",
+               name, dmd.u.crypt.cipher);
 
        r = dm_create_device(name, CRYPT_LOOPAES, &dmd, 0);