diff options
author | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2018-10-18 16:36:59 +0200 |
---|---|---|
committer | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2018-11-01 12:40:14 +0100 |
commit | f4efc8b7c4989e93629dad845bfe45c47ca1d03a (patch) | |
tree | 45e0cac3179a5ddb51016977f135b6f335d1fde1 /ubifs-utils/mkfs.ubifs/mkfs.ubifs.c | |
parent | 22bf17cd9cccb5723241af2e9f5166af08ed7172 (diff) |
mkfs.ubifs: Make encryption dependend on (not-yet-existant) command line options
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Signed-off-by: Richard Weinberger <richard@nod.at>
Diffstat (limited to 'ubifs-utils/mkfs.ubifs/mkfs.ubifs.c')
-rw-r--r-- | ubifs-utils/mkfs.ubifs/mkfs.ubifs.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/ubifs-utils/mkfs.ubifs/mkfs.ubifs.c b/ubifs-utils/mkfs.ubifs/mkfs.ubifs.c index 8be84ca..5be390e 100644 --- a/ubifs-utils/mkfs.ubifs/mkfs.ubifs.c +++ b/ubifs-utils/mkfs.ubifs/mkfs.ubifs.c @@ -217,6 +217,7 @@ static struct inum_mapping **hash_table; /* Inode creation sequence number */ static unsigned long long creat_sqnum; +//TODO: add options for double hash and encryption static const char *optstring = "d:r:m:o:D:yh?vVe:c:g:f:Fp:k:x:X:j:R:l:j:UQqa"; static const struct option longopts[] = { @@ -654,6 +655,8 @@ static int get_options(int argc, char**argv) c->max_leb_cnt = -1; c->max_bud_bytes = -1; c->log_lebs = -1; + c->double_hash = 0; + c->encrypted = 0; while (1) { opt = getopt_long(argc, argv, optstring, longopts, &i); @@ -2826,15 +2829,16 @@ static int init(void) sz = sizeof(struct inum_mapping *) * HASH_TABLE_SIZE; hash_table = xzalloc(sz); - //TODO make this a parameter - RAND_bytes((void *)master_key_descriptor, FS_KEY_DESCRIPTOR_SIZE); - RAND_bytes((void *)nonce, FS_KEY_DERIVATION_NONCE_SIZE); + if (c->encrypted) { + RAND_bytes((void *)master_key_descriptor, + FS_KEY_DESCRIPTOR_SIZE); + RAND_bytes((void *)nonce, FS_KEY_DERIVATION_NONCE_SIZE); - root_fctx = init_fscrypt_context(FS_POLICY_FLAGS_PAD_4, - master_key_descriptor, nonce); - print_fscrypt_master_key_descriptor(root_fctx); - c->double_hash = 1; - c->encrypted = 1; + root_fctx = init_fscrypt_context(FS_POLICY_FLAGS_PAD_4, + master_key_descriptor, nonce); + print_fscrypt_master_key_descriptor(root_fctx); + c->double_hash = 1; + } err = init_compression(); if (err) |