Patchwork [U-Boot,RFC,11/44] image: Rename fit_image_check_hashes() to fit_image_verify()

login
register
mail settings
Submitter Simon Glass
Date Jan. 5, 2013, 1:51 a.m.
Message ID <1357350734-13737-12-git-send-email-sjg@chromium.org>
Download mbox | patch
Permalink /patch/209608/
State Superseded, archived
Headers show

Comments

Simon Glass - Jan. 5, 2013, 1:51 a.m.
This is the main entry point to the FIT image verification code. We will
be using it to handle image verification with signatures, so rename the
function.

Signed-off-by: Simon Glass <sjg@chromium.org>
---
 common/cmd_bootm.c  |    4 ++--
 common/cmd_fpga.c   |    2 +-
 common/cmd_source.c |    2 +-
 common/cmd_ximg.c   |    2 +-
 common/image-fit.c  |   16 ++++++++--------
 common/image.c      |    2 +-
 common/update.c     |    2 +-
 include/image.h     |    4 ++--
 8 files changed, 17 insertions(+), 17 deletions(-)
Marek Vasut - Jan. 5, 2013, 8:09 a.m.
Dear Simon Glass,

> This is the main entry point to the FIT image verification code. We will
> be using it to handle image verification with signatures, so rename the
> function.
> 
> Signed-off-by: Simon Glass <sjg@chromium.org>

Reviewed-by: Marek Vasut <marex@denx.de>

Best regards,
Marek Vasut

Patch

diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c
index 2debfe3..7b07393 100644
--- a/common/cmd_bootm.c
+++ b/common/cmd_bootm.c
@@ -797,7 +797,7 @@  static int fit_check_kernel(const void *fit, int os_noffset, int verify)
 
 	if (verify) {
 		puts("   Verifying Hash Integrity ... ");
-		if (!fit_image_check_hashes(fit, os_noffset)) {
+		if (!fit_image_verify(fit, os_noffset)) {
 			puts("Bad Data Hash\n");
 			bootstage_error(BOOTSTAGE_ID_FIT_CHECK_HASH);
 			return 0;
@@ -1151,7 +1151,7 @@  static int image_info(ulong addr)
 
 		fit_print_contents(hdr);
 
-		if (!fit_all_image_check_hashes(hdr)) {
+		if (!fit_all_image_verify(hdr)) {
 			puts("Bad hash in FIT image!\n");
 			return 1;
 		}
diff --git a/common/cmd_fpga.c b/common/cmd_fpga.c
index 1834246..1341604 100644
--- a/common/cmd_fpga.c
+++ b/common/cmd_fpga.c
@@ -306,7 +306,7 @@  int do_fpga (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
 				}
 
 				/* verify integrity */
-				if (!fit_image_check_hashes (fit_hdr, noffset)) {
+				if (!fit_image_verify(fit_hdr, noffset)) {
 					puts ("Bad Data Hash\n");
 					return 1;
 				}
diff --git a/common/cmd_source.c b/common/cmd_source.c
index 02a862c..6a82fb2 100644
--- a/common/cmd_source.c
+++ b/common/cmd_source.c
@@ -124,7 +124,7 @@  source (ulong addr, const char *fit_uname)
 
 		/* verify integrity */
 		if (verify) {
-			if (!fit_image_check_hashes (fit_hdr, noffset)) {
+			if (!fit_image_verify(fit_hdr, noffset)) {
 				puts ("Bad Data Hash\n");
 				return 1;
 			}
diff --git a/common/cmd_ximg.c b/common/cmd_ximg.c
index ea0a26e..f8722a0 100644
--- a/common/cmd_ximg.c
+++ b/common/cmd_ximg.c
@@ -160,7 +160,7 @@  do_imgextract(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
 
 		/* verify integrity */
 		if (verify) {
-			if (!fit_image_check_hashes(fit_hdr, noffset)) {
+			if (!fit_image_verify(fit_hdr, noffset)) {
 				puts("Bad Data Hash\n");
 				return 1;
 			}
diff --git a/common/image-fit.c b/common/image-fit.c
index d75ec3a..7fab682 100644
--- a/common/image-fit.c
+++ b/common/image-fit.c
@@ -853,11 +853,11 @@  int calculate_hash(const void *data, int data_len, const char *algo,
 }
 
 /**
- * fit_image_check_hashes - verify data intergity
+ * fit_image_verify - verify data intergity
  * @fit: pointer to the FIT format image header
  * @image_noffset: component image node offset
  *
- * fit_image_check_hashes() goes over component image hash nodes,
+ * fit_image_verify() goes over component image hash nodes,
  * re-calculates each data hash and compares with the value stored in hash
  * node.
  *
@@ -865,7 +865,7 @@  int calculate_hash(const void *data, int data_len, const char *algo,
  *     1, if all hashes are valid
  *     0, otherwise (or on error)
  */
-int fit_image_check_hashes(const void *fit, int image_noffset)
+int fit_image_verify(const void *fit, int image_noffset)
 {
 	const void	*data;
 	size_t		size;
@@ -959,17 +959,17 @@  error:
 }
 
 /**
- * fit_all_image_check_hashes - verify data intergity for all images
+ * fit_all_image_verify - verify data intergity for all images
  * @fit: pointer to the FIT format image header
  *
- * fit_all_image_check_hashes() goes over all images in the FIT and
+ * fit_all_image_verify() goes over all images in the FIT and
  * for every images checks if all it's hashes are valid.
  *
  * returns:
  *     1, if all hashes of all images are valid
  *     0, otherwise (or on error)
  */
-int fit_all_image_check_hashes(const void *fit)
+int fit_all_image_verify(const void *fit)
 {
 	int images_noffset;
 	int noffset;
@@ -999,7 +999,7 @@  int fit_all_image_check_hashes(const void *fit)
 			printf("   Hash(es) for Image %u (%s): ", count++,
 					fit_get_name(fit, noffset, NULL));
 
-			if (!fit_image_check_hashes(fit, noffset))
+			if (!fit_image_verify(fit, noffset))
 				return 0;
 			printf("\n");
 		}
@@ -1448,7 +1448,7 @@  int fit_check_ramdisk(const void *fit, int rd_noffset, uint8_t arch,
 
 	if (verify) {
 		puts("   Verifying Hash Integrity ... ");
-		if (!fit_image_check_hashes(fit, rd_noffset)) {
+		if (!fit_image_verify(fit, rd_noffset)) {
 			puts("Bad Data Hash\n");
 			bootstage_error(BOOTSTAGE_ID_FIT_RD_HASH);
 			return 0;
diff --git a/common/image.c b/common/image.c
index 27f6f5b..554f269 100644
--- a/common/image.c
+++ b/common/image.c
@@ -1210,7 +1210,7 @@  static int fit_check_fdt(const void *fit, int fdt_noffset, int verify)
 
 	if (verify) {
 		puts("   Verifying Hash Integrity ... ");
-		if (!fit_image_check_hashes(fit, fdt_noffset)) {
+		if (!fit_image_verify(fit, fdt_noffset)) {
 			fdt_error("Bad Data Hash");
 			return 0;
 		}
diff --git a/common/update.c b/common/update.c
index 94d6a82..87941ec 100644
--- a/common/update.c
+++ b/common/update.c
@@ -297,7 +297,7 @@  got_update_file:
 		printf("Processing update '%s' :",
 			fit_get_name(fit, noffset, NULL));
 
-		if (!fit_image_check_hashes(fit, noffset)) {
+		if (!fit_image_verify(fit, noffset)) {
 			printf("Error: invalid update hash, aborting\n");
 			ret = 1;
 			goto next_node;
diff --git a/include/image.h b/include/image.h
index f723b62..ed351ef 100644
--- a/include/image.h
+++ b/include/image.h
@@ -612,8 +612,8 @@  int fit_set_timestamp(void *fit, int noffset, time_t timestamp);
 int fit_set_hashes(void *fit);
 int fit_image_set_hashes(void *fit, int image_noffset);
 
-int fit_image_check_hashes(const void *fit, int noffset);
-int fit_all_image_check_hashes(const void *fit);
+int fit_image_verify(const void *fit, int noffset);
+int fit_all_image_verify(const void *fit);
 int fit_image_check_os(const void *fit, int noffset, uint8_t os);
 int fit_image_check_arch(const void *fit, int noffset, uint8_t arch);
 int fit_image_check_type(const void *fit, int noffset, uint8_t type);