[U-Boot] [PATCH 1/2] Fix inconsistency of VERIFY defines in cmd_mem

Introduced in change d20a40de9db07de1f1f06a79a4da1cdda5379b75 "Roll crc32 into hash infrastructure"
Use a consistent define to enable the verify feature in crc32 command.
Signed-off-by: Joe Hershberger joe.hershberger@ni.com ---
common/cmd_mem.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/common/cmd_mem.c b/common/cmd_mem.c index 5d8c9e6..b91adb2 100644 --- a/common/cmd_mem.c +++ b/common/cmd_mem.c @@ -1303,7 +1303,7 @@ U_BOOT_CMD(
#ifdef CONFIG_CMD_CRC32
-#ifndef CONFIG_CRC32_VERIFY +#ifndef CONFIG_HASH_VERIFY
U_BOOT_CMD( crc32, 4, 1, do_mem_crc, @@ -1311,7 +1311,7 @@ U_BOOT_CMD( "address count [addr]\n - compute CRC32 checksum [save at addr]" );
-#else /* CONFIG_CRC32_VERIFY */ +#else /* CONFIG_HASH_VERIFY */
U_BOOT_CMD( crc32, 5, 1, do_mem_crc, @@ -1320,7 +1320,7 @@ U_BOOT_CMD( "-v address count crc\n - verify crc of memory area" );
-#endif /* CONFIG_CRC32_VERIFY */ +#endif /* CONFIG_HASH_VERIFY */
#endif

Introduced in change d20a40de9db07de1f1f06a79a4da1cdda5379b75 "Roll crc32 into hash infrastructure"
The crc32 command with no -v expects an optional 3rd argument to be an address to store the result in. With the -v switch, the last argument is a crc, not an address. In the case where -v is set, we should set the HASH_FLAG_ENV flag since that will first look for the value to be a digest value, which matches the expected API for the crc32 command.
Signed-off-by: Joe Hershberger joe.hershberger@ni.com ---
common/cmd_mem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/common/cmd_mem.c b/common/cmd_mem.c index b91adb2..2e85d53 100644 --- a/common/cmd_mem.c +++ b/common/cmd_mem.c @@ -1227,7 +1227,7 @@ static int do_mem_crc(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) ac = argc - 1; #ifdef CONFIG_HASH_VERIFY if (strcmp(*av, "-v") == 0) { - flags |= HASH_FLAG_VERIFY; + flags |= HASH_FLAG_VERIFY | HASH_FLAG_ENV; av++; ac--; }

On 5 May 2015 at 11:23, Joe Hershberger joe.hershberger@ni.com wrote:
Introduced in change d20a40de9db07de1f1f06a79a4da1cdda5379b75 "Roll crc32 into hash infrastructure"
The crc32 command with no -v expects an optional 3rd argument to be an address to store the result in. With the -v switch, the last argument is a crc, not an address. In the case where -v is set, we should set the HASH_FLAG_ENV flag since that will first look for the value to be a digest value, which matches the expected API for the crc32 command.
Signed-off-by: Joe Hershberger joe.hershberger@ni.com
common/cmd_mem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Reviewed-by: Simon Glass sjg@chromium.org

On Tue, May 05, 2015 at 12:23:53PM -0500, Joe Hershberger wrote:
Introduced in change d20a40de9db07de1f1f06a79a4da1cdda5379b75 "Roll crc32 into hash infrastructure"
The crc32 command with no -v expects an optional 3rd argument to be an address to store the result in. With the -v switch, the last argument is a crc, not an address. In the case where -v is set, we should set the HASH_FLAG_ENV flag since that will first look for the value to be a digest value, which matches the expected API for the crc32 command.
Signed-off-by: Joe Hershberger joe.hershberger@ni.com Reviewed-by: Simon Glass sjg@chromium.org
Applied to u-boot/master, thanks!

Hi Joe,
On 5 May 2015 at 11:23, Joe Hershberger joe.hershberger@ni.com wrote:
Introduced in change d20a40de9db07de1f1f06a79a4da1cdda5379b75 "Roll crc32 into hash infrastructure"
Use a consistent define to enable the verify feature in crc32 command.
Signed-off-by: Joe Hershberger joe.hershberger@ni.com
common/cmd_mem.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/common/cmd_mem.c b/common/cmd_mem.c index 5d8c9e6..b91adb2 100644 --- a/common/cmd_mem.c +++ b/common/cmd_mem.c @@ -1303,7 +1303,7 @@ U_BOOT_CMD(
#ifdef CONFIG_CMD_CRC32
-#ifndef CONFIG_CRC32_VERIFY +#ifndef CONFIG_HASH_VERIFY
Do you need to change the users of CONFIG_CRC32_VERIFY?
U_BOOT_CMD( crc32, 4, 1, do_mem_crc, @@ -1311,7 +1311,7 @@ U_BOOT_CMD( "address count [addr]\n - compute CRC32 checksum [save at addr]" );
-#else /* CONFIG_CRC32_VERIFY */ +#else /* CONFIG_HASH_VERIFY */
U_BOOT_CMD( crc32, 5, 1, do_mem_crc, @@ -1320,7 +1320,7 @@ U_BOOT_CMD( "-v address count crc\n - verify crc of memory area" );
-#endif /* CONFIG_CRC32_VERIFY */ +#endif /* CONFIG_HASH_VERIFY */
#endif
-- 1.7.11.5
Regards, Simon

Hi Simon,
On Tue, May 5, 2015 at 4:37 PM, Simon Glass sjg@chromium.org wrote:
Hi Joe,
On 5 May 2015 at 11:23, Joe Hershberger joe.hershberger@ni.com wrote:
Introduced in change d20a40de9db07de1f1f06a79a4da1cdda5379b75 "Roll crc32 into hash infrastructure"
Use a consistent define to enable the verify feature in crc32 command.
Signed-off-by: Joe Hershberger joe.hershberger@ni.com
common/cmd_mem.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/common/cmd_mem.c b/common/cmd_mem.c index 5d8c9e6..b91adb2 100644 --- a/common/cmd_mem.c +++ b/common/cmd_mem.c @@ -1303,7 +1303,7 @@ U_BOOT_CMD(
#ifdef CONFIG_CMD_CRC32
-#ifndef CONFIG_CRC32_VERIFY +#ifndef CONFIG_HASH_VERIFY
Do you need to change the users of CONFIG_CRC32_VERIFY?
Shouldn't need to just like you didn't on the other similar change to this file because in include/hash.h:
#if defined(CONFIG_SHA1SUM_VERIFY) || defined(CONFIG_CRC32_VERIFY) #define CONFIG_HASH_VERIFY #endif
U_BOOT_CMD( crc32, 4, 1, do_mem_crc, @@ -1311,7 +1311,7 @@ U_BOOT_CMD( "address count [addr]\n - compute CRC32 checksum [save at addr]" );
-#else /* CONFIG_CRC32_VERIFY */ +#else /* CONFIG_HASH_VERIFY */
U_BOOT_CMD( crc32, 5, 1, do_mem_crc, @@ -1320,7 +1320,7 @@ U_BOOT_CMD( "-v address count crc\n - verify crc of memory area" );
-#endif /* CONFIG_CRC32_VERIFY */ +#endif /* CONFIG_HASH_VERIFY */
#endif
-- 1.7.11.5
Cheers, -Joe

Hi Joe,
On 5 May 2015 at 17:35, Joe Hershberger joe.hershberger@gmail.com wrote:
Hi Simon,
On Tue, May 5, 2015 at 4:37 PM, Simon Glass sjg@chromium.org wrote:
Hi Joe,
On 5 May 2015 at 11:23, Joe Hershberger joe.hershberger@ni.com wrote:
Introduced in change d20a40de9db07de1f1f06a79a4da1cdda5379b75 "Roll crc32 into hash infrastructure"
Use a consistent define to enable the verify feature in crc32 command.
Signed-off-by: Joe Hershberger joe.hershberger@ni.com
common/cmd_mem.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/common/cmd_mem.c b/common/cmd_mem.c index 5d8c9e6..b91adb2 100644 --- a/common/cmd_mem.c +++ b/common/cmd_mem.c @@ -1303,7 +1303,7 @@ U_BOOT_CMD(
#ifdef CONFIG_CMD_CRC32
-#ifndef CONFIG_CRC32_VERIFY +#ifndef CONFIG_HASH_VERIFY
Do you need to change the users of CONFIG_CRC32_VERIFY?
Shouldn't need to just like you didn't on the other similar change to this file because in include/hash.h:
#if defined(CONFIG_SHA1SUM_VERIFY) || defined(CONFIG_CRC32_VERIFY) #define CONFIG_HASH_VERIFY #endif
OK, thanks.
Acked-by: Simon Glass sjg@chromium.org [snip]
Regards, Simon

On Tue, May 05, 2015 at 12:23:52PM -0500, Joe Hershberger wrote:
Introduced in change d20a40de9db07de1f1f06a79a4da1cdda5379b75 "Roll crc32 into hash infrastructure"
Use a consistent define to enable the verify feature in crc32 command.
Signed-off-by: Joe Hershberger joe.hershberger@ni.com Acked-by: Simon Glass sjg@chromium.org
Applied to u-boot/master, thanks!
participants (4)
-
Joe Hershberger
-
Joe Hershberger
-
Simon Glass
-
Tom Rini