diff options
author | Nils Wallménius <nils@rockbox.org> | 2009-04-02 21:27:26 +0000 |
---|---|---|
committer | Nils Wallménius <nils@rockbox.org> | 2009-04-02 21:27:26 +0000 |
commit | dd36c579155c377bfe8ef95ee73a2077d5f73a17 (patch) | |
tree | f0c3dd9da43fec5579bdda17ecd5aa4b23523f46 /apps/plugins/keybox.c | |
parent | 0eea6ceac4821017192e3dfbeb46fddfd7a8f8e5 (diff) | |
download | rockbox-dd36c579155c377bfe8ef95ee73a2077d5f73a17.tar.gz rockbox-dd36c579155c377bfe8ef95ee73a2077d5f73a17.tar.bz2 rockbox-dd36c579155c377bfe8ef95ee73a2077d5f73a17.zip |
keybox: handle user canceling in the vkeyboard in a nicer way, fix a comment so that it makes sense
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20608 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins/keybox.c')
-rw-r--r-- | apps/plugins/keybox.c | 32 |
1 files changed, 23 insertions, 9 deletions
diff --git a/apps/plugins/keybox.c b/apps/plugins/keybox.c index f50e6be19c..ddff1e95d2 100644 --- a/apps/plugins/keybox.c +++ b/apps/plugins/keybox.c @@ -22,15 +22,14 @@ #include "lib/md5.h" PLUGIN_HEADER - #define KEYBOX_FILE PLUGIN_DIR "/apps/keybox.dat" #define BLOCK_SIZE 8 #define MAX_ENTRIES 12*BLOCK_SIZE /* keep this a multiple of BLOCK_SIZE */ #define FIELD_LEN 32 /* should be enough for anyone ;) */ -/* salt 4 bytes (needed for decryption) not encrypted padded with 4 bytes of zeroes - pwhash 16 bytes (to check for the right password) encrypted - encrypted data. */ +/* The header begins with the unencrypted salt (4 bytes) padded with 4 bytes of + zeroes. After that comes the encrypted hash of the master password (16 bytes) */ + #define HEADER_LEN 24 @@ -203,13 +202,25 @@ static void add_entry(int selected_item) rb->splash(HZ, "Enter title"); pw_list.entries[i].title[0] = '\0'; - rb->kbd_input(pw_list.entries[i].title, FIELD_LEN); + if (rb->kbd_input(pw_list.entries[i].title, FIELD_LEN)) + return; + rb->splash(HZ, "Enter name"); pw_list.entries[i].name[0] = '\0'; - rb->kbd_input(pw_list.entries[i].name, FIELD_LEN); + if (rb->kbd_input(pw_list.entries[i].name, FIELD_LEN)) + { + pw_list.entries[i].title[0] = '\0'; + return; + } + rb->splash(HZ, "Enter password"); pw_list.entries[i].password[0] = '\0'; - rb->kbd_input(pw_list.entries[i].password, FIELD_LEN); + if (rb->kbd_input(pw_list.entries[i].password, FIELD_LEN)) + { + pw_list.entries[i].title[0] = '\0'; + pw_list.entries[i].name[0] = '\0'; + return; + } for (j = 0; j < selected_item; j++) { @@ -506,9 +517,12 @@ static int enter_pw(char *pw_buf, size_t buflen, bool new_pw) if (new_pw) { rb->splash(HZ, "Enter new master password"); - rb->kbd_input(buf[0], sizeof(buf[0])); + if (rb->kbd_input(buf[0], sizeof(buf[0]))) + return -1; + rb->splash(HZ, "Confirm master password"); - rb->kbd_input(buf[1], sizeof(buf[1])); + if (rb->kbd_input(buf[1], sizeof(buf[1]))) + return -1; if (rb->strcmp(buf[0], buf[1])) { |