]> www.infradead.org Git - mtd-utils.git/commitdiff
ubifs-utils: Adapt master.c in libubifs
authorZhihao Cheng <chengzhihao1@huawei.com>
Mon, 11 Nov 2024 09:00:54 +0000 (17:00 +0800)
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>
Mon, 11 Nov 2024 09:32:45 +0000 (10:32 +0100)
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 <chengzhihao1@huawei.com>
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
ubifs-utils/libubifs/master.c

index 7adc37c10b6af48af4f4b82faa9763b3b8e342f8..cce1a415954e0de8bfb0e6e78b020b6a14ec1150 100644 (file)
 
 /* 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;
 }