[arch-commits] Commit in cryptsetup/trunk (2 files)

Thomas Bächler thomas at archlinux.org
Thu Nov 3 14:49:18 EDT 2011


    Date: Thursday, November 3, 2011 @ 14:49:18
  Author: thomas
Revision: 141964

upgpkg: cryptsetup 1.4.0-2 - fix display of key size in plain volumes

Added:
  cryptsetup/trunk/cryptsetup-fix-crypt_get_volume_key_size-for-plain-device.patch
Modified:
  cryptsetup/trunk/PKGBUILD

-----------------------------------------------------------------+
 PKGBUILD                                                        |   23 +-
 cryptsetup-fix-crypt_get_volume_key_size-for-plain-device.patch |   94 ++++++++++
 2 files changed, 107 insertions(+), 10 deletions(-)

Modified: PKGBUILD
===================================================================
--- PKGBUILD	2011-11-03 18:23:02 UTC (rev 141963)
+++ PKGBUILD	2011-11-03 18:49:18 UTC (rev 141964)
@@ -2,7 +2,7 @@
 # Maintainer: Thomas Bächler <thomas at archlinux.org>
 pkgname=cryptsetup
 pkgver=1.4.0
-pkgrel=1
+pkgrel=2
 pkgdesc="Userspace setup tool for transparent encryption of block devices using dm-crypt"
 arch=(i686 x86_64)
 license=('GPL')
@@ -13,23 +13,26 @@
 options=('!libtool' '!emptydirs')
 source=(http://cryptsetup.googlecode.com/files/${pkgname}-${pkgver}.tar.bz2
         encrypt_hook
-	encrypt_install)
+	encrypt_install
+	cryptsetup-fix-crypt_get_volume_key_size-for-plain-device.patch)
 sha256sums=('96d682853c8019cfeae0b21250cd2d00af42e46251807e8dbda2ff8427c2e9ed'
             '811bbea1337106ad811731c746d73ee81039bad00aef52398e3a377ad0766757'
-            'd4380195351b70abf8fcb3cd19461879c55a7a07e4915d1f0365b295b112a573')
+            'd4380195351b70abf8fcb3cd19461879c55a7a07e4915d1f0365b295b112a573'
+            '6fa1d3172014ba3ba96f7a67acbcae7f26b24a61abb84b3917f526a54f81dd87')
 build() {
-  cd $srcdir/$pkgname-${pkgver}
+  cd "${srcdir}"/$pkgname-${pkgver}
+  patch -p0 -i "${srcdir}"/cryptsetup-fix-crypt_get_volume_key_size-for-plain-device.patch
   ./configure --prefix=/usr --disable-static --sbindir=/sbin --libdir=/lib
   make
 }
 
 package() {
-  cd $srcdir/$pkgname-${pkgver}
-  make DESTDIR=$pkgdir install
+  cd "${srcdir}"/$pkgname-${pkgver}
+  make DESTDIR="${pkgdir}" install
   # install hook
-  install -D -m644 $srcdir/encrypt_hook $pkgdir/lib/initcpio/hooks/encrypt
-  install -D -m644 $srcdir/encrypt_install $pkgdir/lib/initcpio/install/encrypt
+  install -D -m644 "${srcdir}"/encrypt_hook "${pkgdir}"/lib/initcpio/hooks/encrypt
+  install -D -m644 "${srcdir}"/encrypt_install "${pkgdir}"/lib/initcpio/install/encrypt
   # Fix pkgconfig location
-  install -d -m755 $pkgdir/usr/lib
-  mv $pkgdir/lib/pkgconfig $pkgdir/usr/lib/
+  install -d -m755 "${pkgdir}"/usr/lib
+  mv "${pkgdir}"/lib/pkgconfig "${pkgdir}"/usr/lib/
 }

Added: cryptsetup-fix-crypt_get_volume_key_size-for-plain-device.patch
===================================================================
--- cryptsetup-fix-crypt_get_volume_key_size-for-plain-device.patch	                        (rev 0)
+++ cryptsetup-fix-crypt_get_volume_key_size-for-plain-device.patch	2011-11-03 18:49:18 UTC (rev 141964)
@@ -0,0 +1,94 @@
+Index: ChangeLog
+===================================================================
+--- ChangeLog	(Revision 664)
++++ ChangeLog	(Revision 665)
+@@ -1,3 +1,6 @@
++2011-10-27  Milan Broz  <mbroz at redhat.com>
++	* Fix crypt_get_volume_key_size() for plain device.
++
+ 2011-10-25  Milan Broz  <mbroz at redhat.com>
+ 	* Print informative message in isLuks only in verbose mode.
+ 	* Version 1.4.0.
+Index: tests/api-test.c
+===================================================================
+--- tests/api-test.c	(Revision 664)
++++ tests/api-test.c	(Revision 665)
+@@ -660,6 +660,11 @@
+ 
+ 	FAIL_(crypt_init_by_name_and_header(&cd, CDEVICE_1, H_DEVICE),"can't init plain device by header device");
+ 	OK_(crypt_init_by_name(&cd, CDEVICE_1));
++	OK_(strcmp(cipher_mode,crypt_get_cipher_mode(cd)));
++	OK_(strcmp(cipher,crypt_get_cipher(cd)));
++	EQ_((int)key_size, crypt_get_volume_key_size(cd));
++	EQ_(params.skip, crypt_get_iv_offset(cd));
++	EQ_(params.offset, crypt_get_data_offset(cd));
+ 	OK_(crypt_deactivate(cd, CDEVICE_1));
+ 	crypt_free(cd);
+ 
+Index: lib/setup.c
+===================================================================
+--- lib/setup.c	(Revision 664)
++++ lib/setup.c	(Revision 665)
+@@ -56,6 +56,7 @@
+ 	char *plain_cipher;
+ 	char *plain_cipher_mode;
+ 	char *plain_uuid;
++	unsigned int plain_key_size;
+ 
+ 	/* used in CRYPT_LOOPAES */
+ 	struct crypt_params_loopaes loopaes_hdr;
+@@ -677,6 +678,7 @@
+ 		(*cd)->plain_hdr.hash = NULL; /* no way to get this */
+ 		(*cd)->plain_hdr.offset = dmd.offset;
+ 		(*cd)->plain_hdr.skip = dmd.iv_offset;
++		(*cd)->plain_key_size = dmd.vk->keylength;
+ 
+ 		r = crypt_parse_name_and_mode(dmd.cipher, cipher, NULL, cipher_mode);
+ 		if (!r) {
+@@ -754,6 +756,7 @@
+ 		return -EINVAL;
+ 	}
+ 
++	cd->plain_key_size = volume_key_size;
+ 	cd->volume_key = crypt_alloc_volume_key(volume_key_size, NULL);
+ 	if (!cd->volume_key)
+ 		return -ENOMEM;
+@@ -1516,7 +1519,7 @@
+ 		}
+ 
+ 		r = process_key(cd, cd->plain_hdr.hash,
+-				cd->volume_key->keylength,
++				cd->plain_key_size,
+ 				passphrase, passphrase_size, &vk);
+ 		if (r < 0)
+ 			goto out;
+@@ -1586,7 +1589,7 @@
+ 			goto out;
+ 
+ 		r = process_key(cd, cd->plain_hdr.hash,
+-				cd->volume_key->keylength,
++				cd->plain_key_size,
+ 				passphrase_read, passphrase_size_read, &vk);
+ 		if (r < 0)
+ 			goto out;
+@@ -1658,8 +1661,7 @@
+ 		if (!name)
+ 			return -EINVAL;
+ 
+-		if (!volume_key || !volume_key_size || !cd->volume_key ||
+-			volume_key_size != cd->volume_key->keylength) {
++		if (!volume_key || !volume_key_size || volume_key_size != cd->plain_key_size) {
+ 			log_err(cd, _("Incorrect volume key specified for plain device.\n"));
+ 			return -EINVAL;
+ 		}
+@@ -1976,8 +1978,8 @@
+ 
+ int crypt_get_volume_key_size(struct crypt_device *cd)
+ {
+-	if (isPLAIN(cd->type) && cd->volume_key)
+-		return cd->volume_key->keylength;
++	if (isPLAIN(cd->type))
++		return cd->plain_key_size;
+ 
+ 	if (isLUKS(cd->type))
+ 		return cd->hdr.keyBytes;



More information about the arch-commits mailing list