aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2019-05-14 04:33:22 -0400
committerRichard Weinberger <richard@nod.at>2019-07-08 13:43:52 -0400
commit817aa094842dfc3a6b98c9582d4a647827f66201 (patch)
tree68919bfade27218cdb9e66c8bcaa2f2aa32b685e
parent8ba0a2ab84b23b541a5d2ef25d759c94880e7457 (diff)
ubifs: support offline signed images
HMACs can only be generated on the system the UBIFS image is running on. To support offline signed images we add a PKCS#7 signature to the UBIFS image which can be created by mkfs.ubifs. Both the master node and the superblock need to be authenticated, during normal runtime both are protected with HMACs. For offline signature support however only a single signature is desired. We add a signature covering the superblock node directly behind it. To protect the master node a hash of the master node is added to the superblock which is used when the master node doesn't contain a HMAC. Transition to a read/write filesystem is also supported. During transition first the master node is rewritten with a HMAC (implicitly, it is written anyway as the FS is marked dirty). Afterwards the superblock is rewritten with a HMAC. Once after the image has been mounted read/write it is HMAC only, the signature is no longer required or even present on the filesystem. In an offline signed image the master node is authenticated by the superblock. In a transition to r/w we have to make sure that the master node is rewritten before the superblock node. In this case the master node gets a HMAC and its authenticity no longer depends on the superblock node. There are some cases in which the current code first writes the superblock node though, so with this patch writing of the superblock node is delayed until the master node is written. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Signed-off-by: Richard Weinberger <richard@nod.at>
-rw-r--r--fs/ubifs/Kconfig3
-rw-r--r--fs/ubifs/auth.c86
-rw-r--r--fs/ubifs/master.c53
-rw-r--r--fs/ubifs/sb.c52
-rw-r--r--fs/ubifs/super.c41
-rw-r--r--fs/ubifs/ubifs-media.h28
-rw-r--r--fs/ubifs/ubifs.h6
7 files changed, 225 insertions, 44 deletions
diff --git a/fs/ubifs/Kconfig b/fs/ubifs/Kconfig
index 06c35c64162b..3902a677743e 100644
--- a/fs/ubifs/Kconfig
+++ b/fs/ubifs/Kconfig
@@ -77,8 +77,9 @@ config UBIFS_FS_SECURITY
77 77
78config UBIFS_FS_AUTHENTICATION 78config UBIFS_FS_AUTHENTICATION
79 bool "UBIFS authentication support" 79 bool "UBIFS authentication support"
80 depends on KEYS 80 select KEYS
81 select CRYPTO_HMAC 81 select CRYPTO_HMAC
82 select SYSTEM_DATA_VERIFICATION
82 help 83 help
83 Enable authentication support for UBIFS. This feature offers protection 84 Enable authentication support for UBIFS. This feature offers protection
84 against offline changes for both data and metadata of the filesystem. 85 against offline changes for both data and metadata of the filesystem.
diff --git a/fs/ubifs/auth.c b/fs/ubifs/auth.c
index 60f43b93d06e..d9af2de9084a 100644
--- a/fs/ubifs/auth.c
+++ b/fs/ubifs/auth.c
@@ -10,10 +10,12 @@
10 */ 10 */
11 11
12#include <linux/crypto.h> 12#include <linux/crypto.h>
13#include <linux/verification.h>
13#include <crypto/hash.h> 14#include <crypto/hash.h>
14#include <crypto/sha.h> 15#include <crypto/sha.h>
15#include <crypto/algapi.h> 16#include <crypto/algapi.h>
16#include <keys/user-type.h> 17#include <keys/user-type.h>
18#include <keys/asymmetric-type.h>
17 19
18#include "ubifs.h" 20#include "ubifs.h"
19 21
@@ -199,6 +201,77 @@ int __ubifs_node_check_hash(const struct ubifs_info *c, const void *node,
199} 201}
200 202
201/** 203/**
204 * ubifs_sb_verify_signature - verify the signature of a superblock
205 * @c: UBIFS file-system description object
206 * @sup: The superblock node
207 *
208 * To support offline signed images the superblock can be signed with a
209 * PKCS#7 signature. The signature is placed directly behind the superblock
210 * node in an ubifs_sig_node.
211 *
212 * Returns 0 when the signature can be successfully verified or a negative
213 * error code if not.
214 */
215int ubifs_sb_verify_signature(struct ubifs_info *c,
216 const struct ubifs_sb_node *sup)
217{
218 int err;
219 struct ubifs_scan_leb *sleb;
220 struct ubifs_scan_node *snod;
221 const struct ubifs_sig_node *signode;
222
223 sleb = ubifs_scan(c, UBIFS_SB_LNUM, UBIFS_SB_NODE_SZ, c->sbuf, 0);
224 if (IS_ERR(sleb)) {
225 err = PTR_ERR(sleb);
226 return err;
227 }
228
229 if (sleb->nodes_cnt == 0) {
230 ubifs_err(c, "Unable to find signature node");
231 err = -EINVAL;
232 goto out_destroy;
233 }
234
235 snod = list_first_entry(&sleb->nodes, struct ubifs_scan_node, list);
236
237 if (snod->type != UBIFS_SIG_NODE) {
238 ubifs_err(c, "Signature node is of wrong type");
239 err = -EINVAL;
240 goto out_destroy;
241 }
242
243 signode = snod->node;
244
245 if (le32_to_cpu(signode->len) > snod->len + sizeof(struct ubifs_sig_node)) {
246 ubifs_err(c, "invalid signature len %d", le32_to_cpu(signode->len));
247 err = -EINVAL;
248 goto out_destroy;
249 }
250
251 if (le32_to_cpu(signode->type) != UBIFS_SIGNATURE_TYPE_PKCS7) {
252 ubifs_err(c, "Signature type %d is not supported\n",
253 le32_to_cpu(signode->type));
254 err = -EINVAL;
255 goto out_destroy;
256 }
257
258 err = verify_pkcs7_signature(sup, sizeof(struct ubifs_sb_node),
259 signode->sig, le32_to_cpu(signode->len),
260 NULL, VERIFYING_UNSPECIFIED_SIGNATURE,
261 NULL, NULL);
262
263 if (err)
264 ubifs_err(c, "Failed to verify signature");
265 else
266 ubifs_msg(c, "Successfully verified super block signature");
267
268out_destroy:
269 ubifs_scan_destroy(sleb);
270
271 return err;
272}
273
274/**
202 * ubifs_init_authentication - initialize UBIFS authentication support 275 * ubifs_init_authentication - initialize UBIFS authentication support
203 * @c: UBIFS file-system description object 276 * @c: UBIFS file-system description object
204 * 277 *
@@ -478,3 +551,16 @@ int ubifs_hmac_wkm(struct ubifs_info *c, u8 *hmac)
478 return err; 551 return err;
479 return 0; 552 return 0;
480} 553}
554
555/*
556 * ubifs_hmac_zero - test if a HMAC is zero
557 * @c: UBIFS file-system description object
558 * @hmac: the HMAC to test
559 *
560 * This function tests if a HMAC is zero and returns true if it is
561 * and false otherwise.
562 */
563bool ubifs_hmac_zero(struct ubifs_info *c, const u8 *hmac)
564{
565 return !memchr_inv(hmac, 0, c->hmac_desc_len);
566}
diff --git a/fs/ubifs/master.c b/fs/ubifs/master.c
index b42a768709c0..52a85c01397e 100644
--- a/fs/ubifs/master.c
+++ b/fs/ubifs/master.c
@@ -48,6 +48,39 @@ int ubifs_compare_master_node(struct ubifs_info *c, void *m1, void *m2)
48 return 0; 48 return 0;
49} 49}
50 50
51/* mst_node_check_hash - Check hash of a master node
52 * @c: UBIFS file-system description object
53 * @mst: The master node
54 * @expected: The expected hash of the master node
55 *
56 * This checks the hash of a master node against a given expected hash.
57 * Note that we have two master nodes on a UBIFS image which have different
58 * sequence numbers and consequently different CRCs. To be able to match
59 * both master nodes we exclude the common node header containing the sequence
60 * number and CRC from the hash.
61 *
62 * Returns 0 if the hashes are equal, a negative error code otherwise.
63 */
64static int mst_node_check_hash(const struct ubifs_info *c,
65 const struct ubifs_mst_node *mst,
66 const u8 *expected)
67{
68 u8 calc[UBIFS_MAX_HASH_LEN];
69 const void *node = mst;
70
71 SHASH_DESC_ON_STACK(shash, c->hash_tfm);
72
73 shash->tfm = c->hash_tfm;
74
75 crypto_shash_digest(shash, node + sizeof(struct ubifs_ch),
76 UBIFS_MST_NODE_SZ - sizeof(struct ubifs_ch), calc);
77
78 if (ubifs_check_hash(c, expected, calc))
79 return -EPERM;
80
81 return 0;
82}
83
51/** 84/**
52 * scan_for_master - search the valid master node. 85 * scan_for_master - search the valid master node.
53 * @c: UBIFS file-system description object 86 * @c: UBIFS file-system description object
@@ -102,14 +135,22 @@ static int scan_for_master(struct ubifs_info *c)
102 if (!ubifs_authenticated(c)) 135 if (!ubifs_authenticated(c))
103 return 0; 136 return 0;
104 137
105 err = ubifs_node_verify_hmac(c, c->mst_node, 138 if (ubifs_hmac_zero(c, c->mst_node->hmac)) {
106 sizeof(struct ubifs_mst_node), 139 err = mst_node_check_hash(c, c->mst_node,
107 offsetof(struct ubifs_mst_node, hmac)); 140 c->sup_node->hash_mst);
108 if (err) { 141 if (err)
109 ubifs_err(c, "Failed to verify master node HMAC"); 142 ubifs_err(c, "Failed to verify master node hash");
110 return -EPERM; 143 } else {
144 err = ubifs_node_verify_hmac(c, c->mst_node,
145 sizeof(struct ubifs_mst_node),
146 offsetof(struct ubifs_mst_node, hmac));
147 if (err)
148 ubifs_err(c, "Failed to verify master node HMAC");
111 } 149 }
112 150
151 if (err)
152 return -EPERM;
153
113 return 0; 154 return 0;
114 155
115out: 156out:
diff --git a/fs/ubifs/sb.c b/fs/ubifs/sb.c
index 12c2afdb5804..a551eb3e9b89 100644
--- a/fs/ubifs/sb.c
+++ b/fs/ubifs/sb.c
@@ -578,17 +578,26 @@ static int authenticate_sb_node(struct ubifs_info *c,
578 return -EINVAL; 578 return -EINVAL;
579 } 579 }
580 580
581 err = ubifs_hmac_wkm(c, hmac_wkm); 581 /*
582 if (err) 582 * The super block node can either be authenticated by a HMAC or
583 return err; 583 * by a signature in a ubifs_sig_node directly following the
584 584 * super block node to support offline image creation.
585 if (ubifs_check_hmac(c, hmac_wkm, sup->hmac_wkm)) { 585 */
586 ubifs_err(c, "provided key does not fit"); 586 if (ubifs_hmac_zero(c, sup->hmac)) {
587 return -ENOKEY; 587 err = ubifs_sb_verify_signature(c, sup);
588 } else {
589 err = ubifs_hmac_wkm(c, hmac_wkm);
590 if (err)
591 return err;
592 if (ubifs_check_hmac(c, hmac_wkm, sup->hmac_wkm)) {
593 ubifs_err(c, "provided key does not fit");
594 return -ENOKEY;
595 }
596 err = ubifs_node_verify_hmac(c, sup, sizeof(*sup),
597 offsetof(struct ubifs_sb_node,
598 hmac));
588 } 599 }
589 600
590 err = ubifs_node_verify_hmac(c, sup, sizeof(*sup),
591 offsetof(struct ubifs_sb_node, hmac));
592 if (err) 601 if (err)
593 ubifs_err(c, "Failed to authenticate superblock: %d", err); 602 ubifs_err(c, "Failed to authenticate superblock: %d", err);
594 603
@@ -744,21 +753,16 @@ int ubifs_read_superblock(struct ubifs_info *c)
744 } 753 }
745 754
746 /* Automatically increase file system size to the maximum size */ 755 /* Automatically increase file system size to the maximum size */
747 c->old_leb_cnt = c->leb_cnt;
748 if (c->leb_cnt < c->vi.size && c->leb_cnt < c->max_leb_cnt) { 756 if (c->leb_cnt < c->vi.size && c->leb_cnt < c->max_leb_cnt) {
757 int old_leb_cnt = c->leb_cnt;
758
749 c->leb_cnt = min_t(int, c->max_leb_cnt, c->vi.size); 759 c->leb_cnt = min_t(int, c->max_leb_cnt, c->vi.size);
750 if (c->ro_mount) 760 sup->leb_cnt = cpu_to_le32(c->leb_cnt);
751 dbg_mnt("Auto resizing (ro) from %d LEBs to %d LEBs", 761
752 c->old_leb_cnt, c->leb_cnt); 762 c->superblock_need_write = 1;
753 else { 763
754 dbg_mnt("Auto resizing (sb) from %d LEBs to %d LEBs", 764 dbg_mnt("Auto resizing from %d LEBs to %d LEBs",
755 c->old_leb_cnt, c->leb_cnt); 765 old_leb_cnt, c->leb_cnt);
756 sup->leb_cnt = cpu_to_le32(c->leb_cnt);
757 err = ubifs_write_sb_node(c, sup);
758 if (err)
759 goto out;
760 c->old_leb_cnt = c->leb_cnt;
761 }
762 } 766 }
763 767
764 c->log_bytes = (long long)c->log_lebs * c->leb_size; 768 c->log_bytes = (long long)c->log_lebs * c->leb_size;
@@ -916,9 +920,7 @@ int ubifs_fixup_free_space(struct ubifs_info *c)
916 c->space_fixup = 0; 920 c->space_fixup = 0;
917 sup->flags &= cpu_to_le32(~UBIFS_FLG_SPACE_FIXUP); 921 sup->flags &= cpu_to_le32(~UBIFS_FLG_SPACE_FIXUP);
918 922
919 err = ubifs_write_sb_node(c, sup); 923 c->superblock_need_write = 1;
920 if (err)
921 return err;
922 924
923 ubifs_msg(c, "free space fixup complete"); 925 ubifs_msg(c, "free space fixup complete");
924 return err; 926 return err;
diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c
index af683734bbdd..13b8f68f6c24 100644
--- a/fs/ubifs/super.c
+++ b/fs/ubifs/super.c
@@ -566,6 +566,8 @@ static int init_constants_early(struct ubifs_info *c)
566 c->ranges[UBIFS_AUTH_NODE].min_len = UBIFS_AUTH_NODE_SZ; 566 c->ranges[UBIFS_AUTH_NODE].min_len = UBIFS_AUTH_NODE_SZ;
567 c->ranges[UBIFS_AUTH_NODE].max_len = UBIFS_AUTH_NODE_SZ + 567 c->ranges[UBIFS_AUTH_NODE].max_len = UBIFS_AUTH_NODE_SZ +
568 UBIFS_MAX_HMAC_LEN; 568 UBIFS_MAX_HMAC_LEN;
569 c->ranges[UBIFS_SIG_NODE].min_len = UBIFS_SIG_NODE_SZ;
570 c->ranges[UBIFS_SIG_NODE].max_len = c->leb_size - UBIFS_SB_NODE_SZ;
569 571
570 c->ranges[UBIFS_INO_NODE].min_len = UBIFS_INO_NODE_SZ; 572 c->ranges[UBIFS_INO_NODE].min_len = UBIFS_INO_NODE_SZ;
571 c->ranges[UBIFS_INO_NODE].max_len = UBIFS_MAX_INO_NODE_SZ; 573 c->ranges[UBIFS_INO_NODE].max_len = UBIFS_MAX_INO_NODE_SZ;
@@ -1359,6 +1361,26 @@ static int mount_ubifs(struct ubifs_info *c)
1359 goto out_lpt; 1361 goto out_lpt;
1360 } 1362 }
1361 1363
1364 /*
1365 * Handle offline signed images: Now that the master node is
1366 * written and its validation no longer depends on the hash
1367 * in the superblock, we can update the offline signed
1368 * superblock with a HMAC version,
1369 */
1370 if (ubifs_authenticated(c) && ubifs_hmac_zero(c, c->sup_node->hmac)) {
1371 err = ubifs_hmac_wkm(c, c->sup_node->hmac_wkm);
1372 if (err)
1373 goto out_lpt;
1374 c->superblock_need_write = 1;
1375 }
1376
1377 if (!c->ro_mount && c->superblock_need_write) {
1378 err = ubifs_write_sb_node(c, c->sup_node);
1379 if (err)
1380 goto out_lpt;
1381 c->superblock_need_write = 0;
1382 }
1383
1362 err = dbg_check_idx_size(c, c->bi.old_idx_sz); 1384 err = dbg_check_idx_size(c, c->bi.old_idx_sz);
1363 if (err) 1385 if (err)
1364 goto out_lpt; 1386 goto out_lpt;
@@ -1643,15 +1665,6 @@ static int ubifs_remount_rw(struct ubifs_info *c)
1643 if (err) 1665 if (err)
1644 goto out; 1666 goto out;
1645 1667
1646 if (c->old_leb_cnt != c->leb_cnt) {
1647 struct ubifs_sb_node *sup = c->sup_node;
1648
1649 sup->leb_cnt = cpu_to_le32(c->leb_cnt);
1650 err = ubifs_write_sb_node(c, sup);
1651 if (err)
1652 goto out;
1653 }
1654
1655 if (c->need_recovery) { 1668 if (c->need_recovery) {
1656 ubifs_msg(c, "completing deferred recovery"); 1669 ubifs_msg(c, "completing deferred recovery");
1657 err = ubifs_write_rcvrd_mst_node(c); 1670 err = ubifs_write_rcvrd_mst_node(c);
@@ -1683,6 +1696,16 @@ static int ubifs_remount_rw(struct ubifs_info *c)
1683 goto out; 1696 goto out;
1684 } 1697 }
1685 1698
1699 if (c->superblock_need_write) {
1700 struct ubifs_sb_node *sup = c->sup_node;
1701
1702 err = ubifs_write_sb_node(c, sup);
1703 if (err)
1704 goto out;
1705
1706 c->superblock_need_write = 0;
1707 }
1708
1686 c->ileb_buf = vmalloc(c->leb_size); 1709 c->ileb_buf = vmalloc(c->leb_size);
1687 if (!c->ileb_buf) { 1710 if (!c->ileb_buf) {
1688 err = -ENOMEM; 1711 err = -ENOMEM;
diff --git a/fs/ubifs/ubifs-media.h b/fs/ubifs/ubifs-media.h
index 86f0f2be116c..355d3081d882 100644
--- a/fs/ubifs/ubifs-media.h
+++ b/fs/ubifs/ubifs-media.h
@@ -275,6 +275,8 @@ enum {
275#define UBIFS_CS_NODE_SZ sizeof(struct ubifs_cs_node) 275#define UBIFS_CS_NODE_SZ sizeof(struct ubifs_cs_node)
276#define UBIFS_ORPH_NODE_SZ sizeof(struct ubifs_orph_node) 276#define UBIFS_ORPH_NODE_SZ sizeof(struct ubifs_orph_node)
277#define UBIFS_AUTH_NODE_SZ sizeof(struct ubifs_auth_node) 277#define UBIFS_AUTH_NODE_SZ sizeof(struct ubifs_auth_node)
278#define UBIFS_SIG_NODE_SZ sizeof(struct ubifs_sig_node)
279
278/* Extended attribute entry nodes are identical to directory entry nodes */ 280/* Extended attribute entry nodes are identical to directory entry nodes */
279#define UBIFS_XENT_NODE_SZ UBIFS_DENT_NODE_SZ 281#define UBIFS_XENT_NODE_SZ UBIFS_DENT_NODE_SZ
280/* Only this does not have to be multiple of 8 bytes */ 282/* Only this does not have to be multiple of 8 bytes */
@@ -301,6 +303,8 @@ enum {
301 */ 303 */
302#define UBIFS_XATTR_NAME_ENCRYPTION_CONTEXT "c" 304#define UBIFS_XATTR_NAME_ENCRYPTION_CONTEXT "c"
303 305
306/* Type field in ubifs_sig_node */
307#define UBIFS_SIGNATURE_TYPE_PKCS7 1
304 308
305/* 309/*
306 * On-flash inode flags. 310 * On-flash inode flags.
@@ -361,6 +365,7 @@ enum {
361 * UBIFS_CS_NODE: commit start node 365 * UBIFS_CS_NODE: commit start node
362 * UBIFS_ORPH_NODE: orphan node 366 * UBIFS_ORPH_NODE: orphan node
363 * UBIFS_AUTH_NODE: authentication node 367 * UBIFS_AUTH_NODE: authentication node
368 * UBIFS_SIG_NODE: signature node
364 * UBIFS_NODE_TYPES_CNT: count of supported node types 369 * UBIFS_NODE_TYPES_CNT: count of supported node types
365 * 370 *
366 * Note, we index arrays by these numbers, so keep them low and contiguous. 371 * Note, we index arrays by these numbers, so keep them low and contiguous.
@@ -381,6 +386,7 @@ enum {
381 UBIFS_CS_NODE, 386 UBIFS_CS_NODE,
382 UBIFS_ORPH_NODE, 387 UBIFS_ORPH_NODE,
383 UBIFS_AUTH_NODE, 388 UBIFS_AUTH_NODE,
389 UBIFS_SIG_NODE,
384 UBIFS_NODE_TYPES_CNT, 390 UBIFS_NODE_TYPES_CNT,
385}; 391};
386 392
@@ -638,6 +644,8 @@ struct ubifs_pad_node {
638 * @hmac_wkm: HMAC of a well known message (the string "UBIFS") as a convenience 644 * @hmac_wkm: HMAC of a well known message (the string "UBIFS") as a convenience
639 * to the user to check if the correct key is passed. 645 * to the user to check if the correct key is passed.
640 * @hash_algo: The hash algo used for this filesystem (one of enum hash_algo) 646 * @hash_algo: The hash algo used for this filesystem (one of enum hash_algo)
647 * @hash_mst: hash of the master node, only valid for signed images in which the
648 * master node does not contain a hmac
641 */ 649 */
642struct ubifs_sb_node { 650struct ubifs_sb_node {
643 struct ubifs_ch ch; 651 struct ubifs_ch ch;
@@ -668,7 +676,8 @@ struct ubifs_sb_node {
668 __u8 hmac[UBIFS_MAX_HMAC_LEN]; 676 __u8 hmac[UBIFS_MAX_HMAC_LEN];
669 __u8 hmac_wkm[UBIFS_MAX_HMAC_LEN]; 677 __u8 hmac_wkm[UBIFS_MAX_HMAC_LEN];
670 __le16 hash_algo; 678 __le16 hash_algo;
671 __u8 padding2[3838]; 679 __u8 hash_mst[UBIFS_MAX_HASH_LEN];
680 __u8 padding2[3774];
672} __packed; 681} __packed;
673 682
674/** 683/**
@@ -771,6 +780,23 @@ struct ubifs_auth_node {
771} __packed; 780} __packed;
772 781
773/** 782/**
783 * struct ubifs_sig_node - node for signing other nodes
784 * @ch: common header
785 * @type: type of the signature, currently only UBIFS_SIGNATURE_TYPE_PKCS7
786 * supported
787 * @len: The length of the signature data
788 * @padding: reserved for future, zeroes
789 * @sig: The signature data
790 */
791struct ubifs_sig_node {
792 struct ubifs_ch ch;
793 __le32 type;
794 __le32 len;
795 __u8 padding[32];
796 __u8 sig[];
797} __packed;
798
799/**
774 * struct ubifs_branch - key/reference/length branch 800 * struct ubifs_branch - key/reference/length branch
775 * @lnum: LEB number of the target node 801 * @lnum: LEB number of the target node
776 * @offs: offset within @lnum 802 * @offs: offset within @lnum
diff --git a/fs/ubifs/ubifs.h b/fs/ubifs/ubifs.h
index 745b23e5b406..c55f212dcb75 100644
--- a/fs/ubifs/ubifs.h
+++ b/fs/ubifs/ubifs.h
@@ -1104,7 +1104,6 @@ struct ubifs_debug_info;
1104 * used to store indexing nodes (@leb_size - @max_idx_node_sz) 1104 * used to store indexing nodes (@leb_size - @max_idx_node_sz)
1105 * @leb_cnt: count of logical eraseblocks 1105 * @leb_cnt: count of logical eraseblocks
1106 * @max_leb_cnt: maximum count of logical eraseblocks 1106 * @max_leb_cnt: maximum count of logical eraseblocks
1107 * @old_leb_cnt: count of logical eraseblocks before re-size
1108 * @ro_media: the underlying UBI volume is read-only 1107 * @ro_media: the underlying UBI volume is read-only
1109 * @ro_mount: the file-system was mounted as read-only 1108 * @ro_mount: the file-system was mounted as read-only
1110 * @ro_error: UBIFS switched to R/O mode because an error happened 1109 * @ro_error: UBIFS switched to R/O mode because an error happened
@@ -1295,6 +1294,7 @@ struct ubifs_info {
1295 unsigned int rw_incompat:1; 1294 unsigned int rw_incompat:1;
1296 unsigned int assert_action:2; 1295 unsigned int assert_action:2;
1297 unsigned int authenticated:1; 1296 unsigned int authenticated:1;
1297 unsigned int superblock_need_write:1;
1298 1298
1299 struct mutex tnc_mutex; 1299 struct mutex tnc_mutex;
1300 struct ubifs_zbranch zroot; 1300 struct ubifs_zbranch zroot;
@@ -1352,7 +1352,6 @@ struct ubifs_info {
1352 int idx_leb_size; 1352 int idx_leb_size;
1353 int leb_cnt; 1353 int leb_cnt;
1354 int max_leb_cnt; 1354 int max_leb_cnt;
1355 int old_leb_cnt;
1356 unsigned int ro_media:1; 1355 unsigned int ro_media:1;
1357 unsigned int ro_mount:1; 1356 unsigned int ro_mount:1;
1358 unsigned int ro_error:1; 1357 unsigned int ro_error:1;
@@ -1680,6 +1679,9 @@ static inline int ubifs_auth_node_sz(const struct ubifs_info *c)
1680 else 1679 else
1681 return 0; 1680 return 0;
1682} 1681}
1682int ubifs_sb_verify_signature(struct ubifs_info *c,
1683 const struct ubifs_sb_node *sup);
1684bool ubifs_hmac_zero(struct ubifs_info *c, const u8 *hmac);
1683 1685
1684int ubifs_hmac_wkm(struct ubifs_info *c, u8 *hmac); 1686int ubifs_hmac_wkm(struct ubifs_info *c, u8 *hmac);
1685 1687