All of lore.kernel.org
 help / color / mirror / Atom feed
* [dm-crypt] [PATCH] print warning when adding a key that contains non-ASCII characters
@ 2009-10-22 14:16 Ludwig Nussel
  2009-11-03  7:47 ` Ludwig Nussel
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Ludwig Nussel @ 2009-10-22 14:16 UTC (permalink / raw)
  To: dm-crypt; +Cc: Ludwig Nussel

Hi,

There's no way to determine whether e.g. the keymap on the console is
the same as in X. Ie a key with umlauts added in an xterm may not be
usable during boot. So when using e.g. an encrypted root partition
users could lock themselves out. So I wonder whether a patch like
the following would be acceptable?

cu
Ludwig

---
 lib/utils.c |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/lib/utils.c b/lib/utils.c
index d23619e..df9c9a5 100644
--- a/lib/utils.c
+++ b/lib/utils.c
@@ -3,6 +3,7 @@
 #include <stdlib.h>
 #include <stddef.h>
 #include <stdarg.h>
+#include <ctype.h>
 #include <errno.h>
 #include <linux/fs.h>
 #include <sys/types.h>
@@ -378,6 +379,20 @@ out_err:
 	return failed;
 }
 
+static void warnifnotascii(struct crypt_device *ctx, const char *str)
+{
+	for(;*str; ++str) {
+		if(!isascii(*str)) {
+			log_std(ctx,
+				"* Warning: Entering non-ASCII passwords\n"
+				"* may not be possible on all systems.\n"
+				"* Make sure you can unlock the volume in\n"
+				"* the intended environment!\n");
+			break;
+		}
+	}
+}
+
 /*
  * Password reading behaviour matrix of get_key
  * 
@@ -443,6 +458,7 @@ void get_key(char *prompt, char **key, unsigned int *passLen, int key_size,
 				goto out_err;
 			}
 			memset(pass_verify, 0, sizeof(pass_verify));
+			warnifnotascii(cd, pass);
 		}
 		*passLen = strlen(pass);
 		*key = pass;
-- 
1.6.4.2

^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2009-11-06 11:11 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-10-22 14:16 [dm-crypt] [PATCH] print warning when adding a key that contains non-ASCII characters Ludwig Nussel
2009-11-03  7:47 ` Ludwig Nussel
2009-11-03  9:15   ` Ian McDonald
2009-11-03 12:58   ` Arno Wagner
2009-11-03 22:40   ` Uwe Menges
2009-11-04 15:46     ` Heinz Diehl
2009-11-03  9:04 ` Milan Broz
2009-11-03 10:08   ` Ludwig Nussel
2009-11-03 10:31     ` Milan Broz
2009-11-06 11:11 ` Pasi Kärkkäinen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.