From 0e537c08629ec82c0268358073e2e1c30d7590a1 Mon Sep 17 00:00:00 2001 From: Zhihao Cheng Date: Mon, 11 Nov 2024 17:00:54 +0800 Subject: ubifs-utils: Adapt master.c in libubifs Adapt master.c in libubifs, compared with linux kernel implementations: 1. Remove authentication related implementations (eg. mst_node_check_hash), authentication is not supported in fsck for now. Signed-off-by: Zhihao Cheng Signed-off-by: David Oberhollenzer --- ubifs-utils/libubifs/master.c | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/ubifs-utils/libubifs/master.c b/ubifs-utils/libubifs/master.c index 7adc37c..cce1a41 100644 --- a/ubifs-utils/libubifs/master.c +++ b/ubifs-utils/libubifs/master.c @@ -10,7 +10,11 @@ /* This file implements reading and writing the master node */ +#include "linux_err.h" +#include "kmem.h" #include "ubifs.h" +#include "defs.h" +#include "debug.h" /** * ubifs_compare_master_node - compare two UBIFS master nodes @@ -21,7 +25,7 @@ * This function compares two UBIFS master nodes. Returns 0 if they are equal * and nonzero if not. */ -int ubifs_compare_master_node(struct ubifs_info *c, void *m1, void *m2) +int ubifs_compare_master_node(__unused struct ubifs_info *c, void *m1, void *m2) { int ret; int behind; @@ -61,20 +65,11 @@ int ubifs_compare_master_node(struct ubifs_info *c, void *m1, void *m2) * * Returns 0 if the hashes are equal, a negative error code otherwise. */ -static int mst_node_check_hash(const struct ubifs_info *c, - const struct ubifs_mst_node *mst, - const u8 *expected) +static int mst_node_check_hash(__unused const struct ubifs_info *c, + __unused const struct ubifs_mst_node *mst, + __unused const u8 *expected) { - u8 calc[UBIFS_MAX_HASH_LEN]; - const void *node = mst; - - crypto_shash_tfm_digest(c->hash_tfm, node + sizeof(struct ubifs_ch), - UBIFS_MST_NODE_SZ - sizeof(struct ubifs_ch), - calc); - - if (ubifs_check_hash(c, expected, calc)) - return -EPERM; - + // To be implemented return 0; } -- cgit v1.2.3