[Pkg-cryptsetup-devel] Bug#364529: cryptsetup 1.0.3

David Härdeman david at 2gen.com
Wed May 10 20:09:07 UTC 2006


On Wed, May 10, 2006 at 08:13:07PM +0200, Jonas Meurer wrote:
>hello Darvid,
>
>I would suggest to upload cryptsetup 1.0.3 soon, as it seems relatively
>stable now, and i doubt that a new (fixed) devmapper upload will happen
>soon.
>therefore we will have troubles getting cryptsetup into testing, but at
>least the unstable users will have a new version available.

Cool, that would help me in partman-crypto development, and should close 
quite a lot of bugs.

>do you think that you fix #358452 in the svn within the next days? if
>so, i would be glad to wait for that before i upload the package.
>
>the same for other changes, that you would like to make before 1.0.3-1
>is uploaded. what about #362564, for example? does it need any extra
>work, or is it fixed with the current solution in svn?

I have a fixed version of the scripts in my local version of the svn 
repo, they just need some more testing. I'll do the testing during this 
week (esp. weekend). Could you defer the upload until monday?

>also, it would be great to have a fix for #364529 and #365333 too,

That's the same bug isn't it?

In #364529 the bug is that non-terminal input is truncated at 32 characters
In #365333 the reporter mentions that "key is a file containing 64 hex 
digits (i.e. 256 bits) and a \n", which should trigger the same bug.

>but i've neither time nor skills to do that.

Ok, I took a look at it, and I think that the attached patch (against 
cryptsetup-1.0.3 tarball) should fix the 32-char truncation issue. 
Perhaps you could build a test .deb with it and as the submitters of the 
two bugs to test it? (I could do it myself, but sending random 
executables built by non-DD's to users seems like a bad idea).

If it works, it should probably go upstream as well, since changing the 
passphrase reading functionality might be bad security-wise.

Regards,
David
-------------- next part --------------
--- cryptsetup-1.0.3/lib/setup.c.orig	2006-05-10 21:50:43.000000000 +0200
+++ cryptsetup-1.0.3/lib/setup.c	2006-05-10 21:54:54.000000000 +0200
@@ -75,13 +75,13 @@
 /*
  * Password reading behaviour matrix of get_key
  * 
- *                    p   v   n
- * -----------------+---+---+----
- * interactive      | Y | Y | Y
- * from fd          | N | N | Y
- * from binary file | N | N | N
+ *                    p   v   n   h
+ * -----------------+---+---+---+---
+ * interactive      | Y | Y | Y | Inf
+ * from fd          | N | N | Y | Inf
+ * from binary file | N | N | N | Inf or options->key_size
  *
- * Legend: p..prompt, v..can verify, n..newline-stop
+ * Legend: p..prompt, v..can verify, n..newline-stop, h..read horizon
  * 
  * Returns true when more keys are available (that is when password
  * reading can be retried as for interactive terminals).
@@ -94,7 +94,8 @@
 	const int verify_if_possible = options->flags & CRYPT_FLAG_VERIFY_IF_POSSIBLE;
 	char *pass = NULL;
 	int newline_stop;
-	
+	int read_horizon;
+
 	if(options->key_file) {
 		fd = open(options->key_file, O_RDONLY);
 		if (fd < 0) {
@@ -104,9 +105,14 @@
 			goto out_err;
 		}	
 		newline_stop = 0;
+
+		/* This can either be 0 (LUKS) or the actually number
+		   of key bytes (default or passed by -s) */
+		read_horizon = options->key_size;
 	} else {
 		fd = options->passphrase_fd;
 		newline_stop = 1;
+		read_horizon = 0;   /* Infinite, if read from terminal or fd */
 	}	
 
 	signal(SIGALRM, catch_alarm);
@@ -156,7 +162,7 @@
 		 * such as /dev/random, because in this case, the loop
 		 * will read forever.
 		 */ 
-		if(options->key_file && options->key_size == 0) {
+		if(options->key_file && read_horizon == 0) {
 			struct stat st;
 			if(stat(options->key_file, &st) < 0) {
 		 		set_error("Can't stat key file");
@@ -169,7 +175,7 @@
 			}
 		}
 		buflen = 0;
-		for(i = 0; options->key_size == 0 || i < options->key_size; i++) {
+		for(i = 0; read_horizon == 0 || i < read_horizon; i++) {
 			if(i >= buflen - 1) {
 				buflen += 128;
 				pass = safe_realloc(pass, buflen);


More information about the Pkg-cryptsetup-devel mailing list