diff options
author | Kent Overstreet <kent.overstreet@gmail.com> | 2016-12-11 14:45:48 -0900 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@gmail.com> | 2016-12-11 14:58:27 -0900 |
commit | 7f4191a202ea4558ca2d5eb8a47daea33c9999c7 (patch) | |
tree | 137f957291da895f78b43a8903db6f744d6e202c /bcache-key.c | |
parent | 4e158e155327d09868453ae9759a58284245175a (diff) |
add support for maximum journal entry size
also rip out prototype crypto support code - real code is in the dev
branch, with the new superblock format
Diffstat (limited to 'bcache-key.c')
-rw-r--r-- | bcache-key.c | 52 |
1 files changed, 0 insertions, 52 deletions
diff --git a/bcache-key.c b/bcache-key.c deleted file mode 100644 index 3cd6d09..0000000 --- a/bcache-key.c +++ /dev/null @@ -1,52 +0,0 @@ -#include <errno.h> -#include <unistd.h> -#include <keyutils.h> -#include <uuid/uuid.h> - -#include "bcache.h" -#include "libbcache.h" -#include "crypto.h" - -int cmd_unlock(int argc, char *argv[]) -{ - struct bcache_disk_key disk_key; - struct bcache_key key; - struct cache_sb *sb; - char *passphrase; - char uuid[40]; - char description[60]; - - if (argc != 2) - die("please supply a single device"); - - sb = bcache_super_read(argv[1]); - - if (!CACHE_SET_ENCRYPTION_KEY(sb)) - die("filesystem is not encrypted"); - - memcpy(&disk_key, sb->encryption_key, sizeof(disk_key)); - - if (!memcmp(&disk_key, bch_key_header, sizeof(bch_key_header))) - die("filesystem does not have encryption key"); - - passphrase = read_passphrase("Enter passphrase: "); - - derive_passphrase(&key, passphrase); - disk_key_encrypt(sb, &disk_key, &key); - - if (memcmp(&disk_key, bch_key_header, sizeof(bch_key_header))) - die("incorrect passphrase"); - - uuid_unparse_lower(sb->user_uuid.b, uuid); - sprintf(description, "bcache:%s", uuid); - - if (add_key("logon", description, &key, sizeof(key), - KEY_SPEC_USER_KEYRING) < 0) - die("add_key error: %s", strerror(errno)); - - memzero_explicit(&disk_key, sizeof(disk_key)); - memzero_explicit(&key, sizeof(key)); - memzero_explicit(passphrase, strlen(passphrase)); - free(passphrase); - return 0; -} |