diff options
author | Richard Weinberger <richard@nod.at> | 2018-10-18 16:37:10 +0200 |
---|---|---|
committer | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2018-11-01 12:41:42 +0100 |
commit | c573dc0021310e1956da638ecf654d65043a42ca (patch) | |
tree | 6883983076e58c1723fdda2cb6efbf2a706acf20 /ubifs-utils/mkfs.ubifs/fscrypt.c | |
parent | 2651d8e09509a7614a66a25e6489d943fd93376b (diff) |
mkfs.ubifs: Use correct sizes for keys and hash lengths
This works currently by chance since the sizes match, but
that might change with different cipher setups.
Signed-off-by: Richard Weinberger <richard@nod.at>
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'ubifs-utils/mkfs.ubifs/fscrypt.c')
-rw-r--r-- | ubifs-utils/mkfs.ubifs/fscrypt.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/ubifs-utils/mkfs.ubifs/fscrypt.c b/ubifs-utils/mkfs.ubifs/fscrypt.c index 2fc0ae8..b9f9acc 100644 --- a/ubifs-utils/mkfs.ubifs/fscrypt.c +++ b/ubifs-utils/mkfs.ubifs/fscrypt.c @@ -31,7 +31,7 @@ unsigned char *calc_fscrypt_subkey(struct fscrypt_context *fctx) int ret; unsigned char *new_key = xmalloc(FS_MAX_KEY_SIZE); - ret = derive_key_aes(fctx->nonce, fscrypt_masterkey, FS_MAX_KEY_SIZE, new_key); + ret = derive_key_aes(fctx->nonce, fscrypt_masterkey, fscrypt_cipher->key_length, new_key); if (ret < 0) { err_msg("derive_key_aes failed: %i\n", ret); @@ -202,7 +202,7 @@ static int load_master_key(const char *key_file, struct cipher *fsc) return -1; } - keysize = read(kf, fscrypt_masterkey, sizeof(fscrypt_masterkey)); + keysize = read(kf, fscrypt_masterkey, fsc->key_length); if (keysize < 0) { sys_errmsg("read '%s'", key_file); goto fail; |