[PATCH 41/42] mkfs.ubifs: Print key descriptor only when generated

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Richard Weinberger <richard@xxxxxx>
---
 ubifs-utils/mkfs.ubifs/fscrypt.c    | 5 +++--
 ubifs-utils/mkfs.ubifs/fscrypt.h    | 1 -
 ubifs-utils/mkfs.ubifs/mkfs.ubifs.c | 2 --
 3 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/ubifs-utils/mkfs.ubifs/fscrypt.c b/ubifs-utils/mkfs.ubifs/fscrypt.c
index 3d4bff618050..6d2b650d626d 100644
--- a/ubifs-utils/mkfs.ubifs/fscrypt.c
+++ b/ubifs-utils/mkfs.ubifs/fscrypt.c
@@ -65,13 +65,13 @@ void free_fscrypt_context(struct fscrypt_context *fctx)
 	free(fctx);
 }
 
-void print_fscrypt_master_key_descriptor(struct fscrypt_context *fctx)
+static void print_fscrypt_master_key_descriptor(__u8 *master_key_descriptor)
 {
 	int i;
 
 	normsg_cont("fscrypt master key descriptor: 0x");
 	for (i = 0; i < FS_KEY_DESCRIPTOR_SIZE; i++) {
-		printf("%02x", fctx->master_key_descriptor[i]);
+		printf("%02x", master_key_descriptor[i]);
 	}
 	printf("\n");
 }
@@ -248,6 +248,7 @@ struct fscrypt_context *init_fscrypt_context(const char *cipher_name,
 	if (!key_descriptor) {
 		if (derive_key_descriptor(fscrypt_masterkey, master_key_descriptor))
 			return NULL;
+		print_fscrypt_master_key_descriptor(master_key_descriptor);
 	} else {
 		if (parse_key_descriptor(key_descriptor, master_key_descriptor))
 			return NULL;
diff --git a/ubifs-utils/mkfs.ubifs/fscrypt.h b/ubifs-utils/mkfs.ubifs/fscrypt.h
index 3b717b4359c6..34b799c94c2b 100644
--- a/ubifs-utils/mkfs.ubifs/fscrypt.h
+++ b/ubifs-utils/mkfs.ubifs/fscrypt.h
@@ -101,7 +101,6 @@ struct fscrypt_symlink_data {
 unsigned char *calc_fscrypt_subkey(struct fscrypt_context *fctx);
 struct fscrypt_context *inherit_fscrypt_context(struct fscrypt_context *fctx);
 void free_fscrypt_context(struct fscrypt_context *fctx);
-void print_fscrypt_master_key_descriptor(struct fscrypt_context *fctx);
 unsigned int fscrypt_fname_encrypted_size(struct fscrypt_context *fctx,
 					  unsigned int ilen);
 int encrypt_path(void **outbuf, void *data, unsigned int data_len,
diff --git a/ubifs-utils/mkfs.ubifs/mkfs.ubifs.c b/ubifs-utils/mkfs.ubifs/mkfs.ubifs.c
index 7073bf052688..a60d392bbc81 100644
--- a/ubifs-utils/mkfs.ubifs/mkfs.ubifs.c
+++ b/ubifs-utils/mkfs.ubifs/mkfs.ubifs.c
@@ -772,8 +772,6 @@ static int get_options(int argc, char**argv)
 						key_file, key_desc);
 		if (!root_fctx)
 			return -1;
-
-		print_fscrypt_master_key_descriptor(root_fctx);
 #else
 		return err_msg("mkfs.ubifs was built without crypto support.");
 #endif
-- 
2.19.1


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/



[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux