From 49b2ae70344bc3212aa268576cb15d903b32558e Mon Sep 17 00:00:00 2001 From: Sascha Hauer Date: Tue, 2 Oct 2018 08:33:08 +0200 Subject: fs: ubifs: Add authentication support This adds UBIFS authentication support. For now, we do not do any authentication even on authenticated UBIFS images. Since this behaviour is not what the user normally expects when mounting authenticated images we only do this when the user explicitly allows it in "global.ubifs.allow_authenticated_unauthenticated". If the flag is false then we refuse mounting such an image and return -EPERM instead. Signed-off-by: Sascha Hauer --- fs/ubifs/misc.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'fs/ubifs/misc.h') diff --git a/fs/ubifs/misc.h b/fs/ubifs/misc.h index 77429be554..82f9225657 100644 --- a/fs/ubifs/misc.h +++ b/fs/ubifs/misc.h @@ -188,7 +188,8 @@ static inline int ubifs_return_leb(struct ubifs_info *c, int lnum) */ static inline int ubifs_idx_node_sz(const struct ubifs_info *c, int child_cnt) { - return UBIFS_IDX_NODE_SZ + (UBIFS_BRANCH_SZ + c->key_len) * child_cnt; + return UBIFS_IDX_NODE_SZ + (UBIFS_BRANCH_SZ + c->key_len + c->hash_len) + * child_cnt; } /** @@ -203,7 +204,7 @@ struct ubifs_branch *ubifs_idx_branch(const struct ubifs_info *c, int bnum) { return (struct ubifs_branch *)((void *)idx->branches + - (UBIFS_BRANCH_SZ + c->key_len) * bnum); + (UBIFS_BRANCH_SZ + c->key_len + c->hash_len) * bnum); } /** -- cgit v1.2.3