From: Richard Weinberger <richard@nod.at>
To: linux-mtd@lists.infradead.org
Cc: david.oberhollenzer@sigma-star.at, Richard Weinberger <richard@nod.at>
Subject: [PATCH 04/42] mkfs.ubifs: Implement UBIFS_FLG_DOUBLE_HASH
Date: Thu, 18 Oct 2018 16:36:40 +0200 [thread overview]
Message-ID: <20181018143718.26298-5-richard@nod.at> (raw)
In-Reply-To: <20181018143718.26298-1-richard@nod.at>
From: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Signed-off-by: Richard Weinberger <richard@nod.at>
---
ubifs-utils/mkfs.ubifs/mkfs.ubifs.c | 13 +++++++++++++
ubifs-utils/mkfs.ubifs/mkfs.ubifs.h | 2 ++
ubifs-utils/mkfs.ubifs/ubifs.h | 2 ++
3 files changed, 17 insertions(+)
diff --git a/ubifs-utils/mkfs.ubifs/mkfs.ubifs.c b/ubifs-utils/mkfs.ubifs/mkfs.ubifs.c
index fd6538c6d4e1..e7acf17f6c96 100644
--- a/ubifs-utils/mkfs.ubifs/mkfs.ubifs.c
+++ b/ubifs-utils/mkfs.ubifs/mkfs.ubifs.c
@@ -1436,6 +1436,14 @@ static int add_symlink_inode(const char *path_name, struct stat *st, ino_t inum,
return add_inode(st, inum, buf, len, flags, path_name);
}
+static void set_dent_cookie(struct ubifs_dent_node *dent)
+{
+ if (c->double_hash)
+ RAND_bytes((void *)&dent->cookie, sizeof(dent->cookie));
+ else
+ dent->cookie = 0;
+}
+
/**
* add_dent_node - write a directory entry node.
* @dir_inum: target inode number of directory
@@ -1469,6 +1477,7 @@ static int add_dent_node(ino_t dir_inum, const char *name, ino_t inum,
dent->nlen = cpu_to_le16(dname.len);
memcpy(dent->name, dname.name, dname.len);
dent->name[dname.len] = '\0';
+ set_dent_cookie(dent);
len = UBIFS_DENT_NODE_SZ + dname.len + 1;
@@ -2268,6 +2277,8 @@ static int write_super(void)
sup.flags |= cpu_to_le32(UBIFS_FLG_BIGLPT);
if (c->space_fixup)
sup.flags |= cpu_to_le32(UBIFS_FLG_SPACE_FIXUP);
+ if (c->double_hash)
+ sup.flags |= cpu_to_le32(UBIFS_FLG_DOUBLE_HASH);
return write_node(&sup, UBIFS_SB_NODE_SZ, UBIFS_SB_LNUM);
}
@@ -2630,6 +2641,8 @@ int main(int argc, char *argv[])
if (crypto_init())
return -1;
+ RAND_poll();
+
err = get_options(argc, argv);
if (err)
return err;
diff --git a/ubifs-utils/mkfs.ubifs/mkfs.ubifs.h b/ubifs-utils/mkfs.ubifs/mkfs.ubifs.h
index 132119167fa5..aa032392155b 100644
--- a/ubifs-utils/mkfs.ubifs/mkfs.ubifs.h
+++ b/ubifs-utils/mkfs.ubifs/mkfs.ubifs.h
@@ -46,6 +46,8 @@
#include <uuid.h>
#include <sys/file.h>
+#include <openssl/rand.h>
+
#include <mtd/ubifs-media.h>
/* common.h requires the PROGRAM_NAME macro */
diff --git a/ubifs-utils/mkfs.ubifs/ubifs.h b/ubifs-utils/mkfs.ubifs/ubifs.h
index 2f080a8ce708..5a4af997e7bd 100644
--- a/ubifs-utils/mkfs.ubifs/ubifs.h
+++ b/ubifs-utils/mkfs.ubifs/ubifs.h
@@ -330,6 +330,7 @@ struct ubifs_znode
* @nhead_offs: offset of LPT head
* @big_lpt: flag that LPT is too big to write whole during commit
* @space_fixup: flag indicating that free space in LEBs needs to be cleaned up
+ * @double_hash: flag indicating that we can do lookups by hash
* @lpt_sz: LPT size
*
* @ltab_lnum: LEB number of LPT's own lprops table
@@ -408,6 +409,7 @@ struct ubifs_info
int nhead_offs;
int big_lpt;
int space_fixup;
+ int double_hash;
long long lpt_sz;
int ltab_lnum;
--
2.19.1
next prev parent reply other threads:[~2018-10-18 14:38 UTC|newest]
Thread overview: 45+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-18 14:36 [PATCH 00/42] mtd-utils: Add fscrypt support to mkfs.ubifs Richard Weinberger
2018-10-18 14:36 ` [PATCH 01/42] Import latest ubifs-media.h Richard Weinberger
2018-10-18 14:36 ` [PATCH 02/42] common: Add round functions Richard Weinberger
2018-10-18 14:36 ` [PATCH 03/42] mkfs.ubifs: Add crypto helper functions Richard Weinberger
2018-10-18 14:36 ` Richard Weinberger [this message]
2018-10-18 14:36 ` [PATCH 05/42] mkfs.ubifs: Make r5 hash binary string aware Richard Weinberger
2018-10-18 14:36 ` [PATCH 06/42] mkfs.ubifs: Add fscrypto defines Richard Weinberger
2018-10-18 14:36 ` [PATCH 07/42] mkfs.ubifs: Add basic fscrypto functions Richard Weinberger
2018-10-18 14:36 ` [PATCH 08/42] mkfs.ubifs: Implement UBIFS_FLG_ENCRYPTION Richard Weinberger
2018-10-18 14:36 ` [PATCH 09/42] mkfs.ubifs: Implement basic fscrypto context passing Richard Weinberger
2018-10-18 14:36 ` [PATCH 10/42] mkfs.ubifs: Implement fscrypto context store as xattr Richard Weinberger
2018-10-18 14:36 ` [PATCH 11/42] mkfs.ubifs: Store directory name len in the temporary index Richard Weinberger
2018-10-18 14:36 ` [PATCH 12/42] mkfs.ubifs: Implement filename encryption Richard Weinberger
2018-10-18 14:36 ` [PATCH 13/42] mkfs.ubifs: Add dummy setup for crypto Richard Weinberger
2018-10-18 14:36 ` [PATCH 14/42] mkfs.ubifs: Pass source/dest key len to key derive function Richard Weinberger
2018-10-18 14:36 ` [PATCH 15/42] mkfs.ubifs: Add encrypted symlink support Richard Weinberger
2018-10-18 14:36 ` [PATCH 16/42] mkfs.ubifs: Implement file contents encryption Richard Weinberger
2018-10-18 14:36 ` [PATCH 17/42] mkfs.ubifs: Move symlink data encryption to helper function Richard Weinberger
2018-10-18 14:36 ` [PATCH 18/42] mkfs.ubifs: Make sure we catch nodes that should or should not have name Richard Weinberger
2018-10-18 14:36 ` [PATCH 19/42] mkfs.ubifs: Free all index entry names Richard Weinberger
2018-10-18 14:36 ` [PATCH 20/42] mkfs.ubifs: Seperate path encryption from symlink encryption helper Richard Weinberger
2018-10-18 14:36 ` [PATCH 21/42] mkfs.ubifs: Cleanup add_dent_node, user path " Richard Weinberger
2018-10-18 14:36 ` [PATCH 22/42] mkfs.ubifs: Replace constant values with parameters in init_fscrypt_context Richard Weinberger
2018-10-18 14:36 ` [PATCH 23/42] mkfs.ubifs: Make encryption dependend on (not-yet-existant) command line options Richard Weinberger
2018-10-18 14:37 ` [PATCH 24/42] mkfs.ubifs: Get key descriptor from command line and master key from file Richard Weinberger
2018-10-18 14:37 ` [PATCH 25/42] mkfs.ubifs: Specify padding policy via command line Richard Weinberger
2018-10-18 14:37 ` [PATCH 26/42] mkfs.ubifs: Initial support for encryption command lines Richard Weinberger
2018-10-18 14:37 ` [PATCH 27/42] mkfs.ubifs: Remove cipher implementations from public header Richard Weinberger
2018-10-18 14:37 ` [PATCH 28/42] mkfs.ubifs: Move fscrypt definitions and functions out of mkfs.ubifs.c Richard Weinberger
2018-10-18 14:37 ` [PATCH 29/42] mkfs.ubifs: Cleanup over-long lines Richard Weinberger
2018-10-18 14:37 ` [PATCH 30/42] mkfs.ubifs: Check length of master key Richard Weinberger
2018-10-18 14:37 ` [PATCH 31/42] mkfs.ubifs: Accept 0x prefix for key descriptor Richard Weinberger
2018-10-18 14:37 ` [PATCH 32/42] mkfs.ubifs: Correctly use iv lengths in aes-cts mode Richard Weinberger
2018-10-18 14:37 ` [PATCH 33/42] mkfs.ubifs: Enable Cipher selection Richard Weinberger
2018-10-18 14:37 ` [PATCH 34/42] mkfs.ubifs: Use correct sizes for keys and hash lengths Richard Weinberger
2018-10-18 14:37 ` [PATCH 35/42] mkfs.ubifs: Fixup AES-XTS mode Richard Weinberger
2018-10-18 14:37 ` [PATCH 36/42] mkfs.ubifs: Compute encryption key descriptor automatically Richard Weinberger
2018-10-18 14:37 ` [PATCH 37/42] mkfs.ubifs: Fix key descriptor printing Richard Weinberger
2018-10-18 14:37 ` [PATCH 38/42] mkfs.ubifs: More fscryptctl compatibility Richard Weinberger
2018-10-18 14:37 ` [PATCH 39/42] mkfs.ubifs: Move RAND_poll to crypto.c Richard Weinberger
2018-10-18 14:37 ` [PATCH 40/42] mkfs.ubifs: Enable support for building without crypto Richard Weinberger
2018-10-18 14:37 ` [PATCH 41/42] mkfs.ubifs: Print key descriptor only when generated Richard Weinberger
2018-10-18 14:37 ` [PATCH 42/42] mkfs.ubifs: Use AES-256-XTS as default Richard Weinberger
2018-11-02 16:41 ` [PATCH 00/42] mtd-utils: Add fscrypt support to mkfs.ubifs David Oberhollenzer
2018-11-02 16:43 ` Richard Weinberger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20181018143718.26298-5-richard@nod.at \
--to=richard@nod.at \
--cc=david.oberhollenzer@sigma-star.at \
--cc=linux-mtd@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox