summaryrefslogtreecommitdiff
path: root/ubifs-utils/mkfs.ubifs/fscrypt.c
diff options
context:
space:
mode:
Diffstat (limited to 'ubifs-utils/mkfs.ubifs/fscrypt.c')
-rw-r--r--ubifs-utils/mkfs.ubifs/fscrypt.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/ubifs-utils/mkfs.ubifs/fscrypt.c b/ubifs-utils/mkfs.ubifs/fscrypt.c
index b9f9acc..ce6e2fc 100644
--- a/ubifs-utils/mkfs.ubifs/fscrypt.c
+++ b/ubifs-utils/mkfs.ubifs/fscrypt.c
@@ -242,12 +242,17 @@ struct fscrypt_context *init_fscrypt_context(const char *cipher_name,
return NULL;
}
- if (parse_key_descriptor(key_descriptor, master_key_descriptor))
- return NULL;
-
if (load_master_key(key_file, fscrypt_cipher))
return NULL;
+ if (!key_descriptor) {
+ if (derive_key_descriptor(fscrypt_masterkey, master_key_descriptor))
+ return NULL;
+ } else {
+ if (parse_key_descriptor(key_descriptor, master_key_descriptor))
+ return NULL;
+ }
+
RAND_bytes((void *)nonce, FS_KEY_DERIVATION_NONCE_SIZE);
new_fctx = xmalloc(sizeof(*new_fctx));