Discussion:
[PATCH 1/2] mkfs.ubifs: Fix IV selection
Richard Weinberger
2018-11-07 20:21:07 UTC
Permalink
We need to check for AES being in 128-cbc mode and not 256-cbc.
fscrypt supports only 128-cbc and 256-xts so far.

Signed-off-by: Richard Weinberger <***@nod.at>
---
ubifs-utils/mkfs.ubifs/crypto.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ubifs-utils/mkfs.ubifs/crypto.c b/ubifs-utils/mkfs.ubifs/crypto.c
index 9c6073ec00f9..cd68e372601f 100644
--- a/ubifs-utils/mkfs.ubifs/crypto.c
+++ b/ubifs-utils/mkfs.ubifs/crypto.c
@@ -152,7 +152,7 @@ static ssize_t encrypt_block(const void *plaintext, size_t size,
iv.index = cpu_to_le64(block_index);
memset(iv.padding, 0, sizeof(iv.padding));

- if (cipher == EVP_aes_256_cbc()) {
+ if (cipher == EVP_aes_128_cbc()) {
tweak = alloca(ivsize);
gen_essiv_salt(&iv, FS_IV_SIZE, key, key_len, tweak);
} else {
--
2.19.1
Richard Weinberger
2018-11-07 20:21:08 UTC
Permalink
compr_size has to be in LE16.

Signed-off-by: Richard Weinberger <***@nod.at>
---
ubifs-utils/mkfs.ubifs/fscrypt.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ubifs-utils/mkfs.ubifs/fscrypt.c b/ubifs-utils/mkfs.ubifs/fscrypt.c
index 6d2b650d626d..118c11c5a4ca 100644
--- a/ubifs-utils/mkfs.ubifs/fscrypt.c
+++ b/ubifs-utils/mkfs.ubifs/fscrypt.c
@@ -125,7 +125,7 @@ int encrypt_data_node(struct fscrypt_context *fctx, unsigned int block_no,
void *inbuf, *outbuf, *crypt_key;
size_t ret, pad_len = round_up(length, FS_CRYPTO_BLOCK_SIZE);

- dn->compr_size = length;
+ dn->compr_size = cpu_to_le16(length);

inbuf = xzalloc(pad_len);
outbuf = xzalloc(pad_len);
--
2.19.1
Heiko Schocher
2018-11-08 05:28:34 UTC
Permalink
Hello Richard,
Post by Richard Weinberger
compr_size has to be in LE16.
---
ubifs-utils/mkfs.ubifs/fscrypt.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Thanks! Fixes my problems with encryption on imx6 based board.

Tested-by: Heiko Schocher <hsdenx.de>

bye,
Heiko
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-52 Fax: +49-8142-66989-80 Email: ***@denx.de
David Oberhollenzer
2018-11-09 13:38:14 UTC
Permalink
Applied to mtd-utils.git master.

Thanks,

David

Heiko Schocher
2018-11-08 05:28:15 UTC
Permalink
Hello Richard,
Post by Richard Weinberger
We need to check for AES being in 128-cbc mode and not 256-cbc.
fscrypt supports only 128-cbc and 256-xts so far.
---
ubifs-utils/mkfs.ubifs/crypto.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Thanks! Fixes my problems with encryption on imx6 based board.

Tested-by: Heiko Schocher <hsdenx.de>

bye,
Heiko
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-52 Fax: +49-8142-66989-80 Email: ***@denx.de
David Oberhollenzer
2018-11-09 13:36:21 UTC
Permalink
Applied to mtd-utils.git master.

Thanks,

David
Loading...