]> git.sesse.net Git - bcachefs-tools-debian/blob - cmd_key.c
cmd_migrate
[bcachefs-tools-debian] / cmd_key.c
1 #include <errno.h>
2 #include <unistd.h>
3 #include <uuid/uuid.h>
4
5 #include "cmds.h"
6 #include "checksum.h"
7 #include "crypto.h"
8 #include "libbcache.h"
9
10 int cmd_unlock(int argc, char *argv[])
11 {
12         struct bch_sb *sb;
13         char *passphrase;
14
15         if (argc != 2)
16                 die("please supply a single device");
17
18         sb = bcache_super_read(argv[1]);
19
20         passphrase = read_passphrase("Enter passphrase: ");
21
22         add_bcache_key(sb, passphrase);
23
24         memzero_explicit(passphrase, strlen(passphrase));
25         free(passphrase);
26         return 0;
27 }