bcachefs-tools/cmd_key.c

28 lines
491 B
C
Raw Normal View History

2016-10-04 06:22:17 +03:00
#include <errno.h>
#include <unistd.h>
#include <uuid/uuid.h>
#include "cmds.h"
#include "checksum.h"
#include "crypto.h"
#include "libbcache.h"
int cmd_unlock(int argc, char *argv[])
{
struct bch_sb *sb;
char *passphrase;
if (argc != 2)
die("please supply a single device");
sb = bcache_super_read(argv[1]);
passphrase = read_passphrase("Enter passphrase: ");
2017-03-01 13:45:15 +03:00
add_bcache_key(sb, passphrase);
2016-10-04 06:22:17 +03:00
memzero_explicit(passphrase, strlen(passphrase));
free(passphrase);
return 0;
}