diff mbox series

[ima-evm-utils] ima-evm-utils: Fix incorrect algorithm name in hash_info.gen

Message ID 20210722052704.11031-1-tianjia.zhang@linux.alibaba.com (mailing list archive)
State New, archived
Headers show
Series [ima-evm-utils] ima-evm-utils: Fix incorrect algorithm name in hash_info.gen | expand

Commit Message

tianjia.zhang July 22, 2021, 5:27 a.m. UTC
There is no such an algorithm name as sm3-256. This is an ambiguity
caused by the definition of the macro HASH_ALGO_SM3_256. The sed
command is only a special case of sm3, so sm3 is used to replace
the sm3-256 algorithm name.

Signed-off-by: Tianjia Zhang <tianjia.zhang@linux.alibaba.com>
---
 src/.gitignore    | 1 +
 src/hash_info.gen | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

Comments

Mimi Zohar July 22, 2021, 12:28 p.m. UTC | #1
Hi Tianjia,

On Thu, 2021-07-22 at 13:27 +0800, Tianjia Zhang wrote:
> There is no such an algorithm name as sm3-256. This is an ambiguity
> caused by the definition of the macro HASH_ALGO_SM3_256. The sed
> command is only a special case of sm3, so sm3 is used to replace
> the sm3-256 algorithm name.
> 
> Signed-off-by: Tianjia Zhang <tianjia.zhang@linux.alibaba.com>
> ---
>  src/.gitignore    | 1 +
>  src/hash_info.gen | 2 +-
>  2 files changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/src/.gitignore b/src/.gitignore
> index 38e8e3c..69d2988 100644
> --- a/src/.gitignore
> +++ b/src/.gitignore
> @@ -1 +1,2 @@
>  hash_info.h
> +tmp_hash_info.h
> diff --git a/src/hash_info.gen b/src/hash_info.gen
> index 5f7a97f..f72db37 100755
> --- a/src/hash_info.gen
> +++ b/src/hash_info.gen
> @@ -86,7 +86,7 @@ sed -n 's/HASH_ALGO_\(.*\),/\1 \L\1\E/p' $HASH_INFO | \
>    while read a b; do
>      # Normalize text hash name: if it contains underscore between
>      # digits replace it with a dash, other underscores are removed.
> -    b=$(echo "$b" | sed "s/\([0-9]\)_\([0-9]\)/\1-\2/g;s/_//g")
> +    b=$(echo "$b" | sed "s/sm3_256/sm3/g;s/_//g")

Please update the comment associated with this change.

thanks,

Mimi

>      printf '\t%-26s = "%s",\n' "[HASH_ALGO_$a]" "$b"
>    done
>  echo "};
Petr Vorel July 22, 2021, 1:10 p.m. UTC | #2
Hi Tianjia,

Reviewed-by: Petr Vorel <pvorel@suse.cz>

Agree with Mimi to update the comment associated with this change.

Kind regards,
Petr
tianjia.zhang July 23, 2021, 6:36 a.m. UTC | #3
Hi Petr, Mimi,

On 7/22/21 9:10 PM, Petr Vorel wrote:
> Hi Tianjia,
> 
> Reviewed-by: Petr Vorel <pvorel@suse.cz>
> 
> Agree with Mimi to update the comment associated with this change.
> 
> Kind regards,
> Petr
> 

thanks, will update it soon.

Best regards,
Tianjia
diff mbox series

Patch

diff --git a/src/.gitignore b/src/.gitignore
index 38e8e3c..69d2988 100644
--- a/src/.gitignore
+++ b/src/.gitignore
@@ -1 +1,2 @@ 
 hash_info.h
+tmp_hash_info.h
diff --git a/src/hash_info.gen b/src/hash_info.gen
index 5f7a97f..f72db37 100755
--- a/src/hash_info.gen
+++ b/src/hash_info.gen
@@ -86,7 +86,7 @@  sed -n 's/HASH_ALGO_\(.*\),/\1 \L\1\E/p' $HASH_INFO | \
   while read a b; do
     # Normalize text hash name: if it contains underscore between
     # digits replace it with a dash, other underscores are removed.
-    b=$(echo "$b" | sed "s/\([0-9]\)_\([0-9]\)/\1-\2/g;s/_//g")
+    b=$(echo "$b" | sed "s/sm3_256/sm3/g;s/_//g")
     printf '\t%-26s = "%s",\n' "[HASH_ALGO_$a]" "$b"
   done
 echo "};"