mirror of
https://git.code.sf.net/p/linux-ima/ima-evm-utils
synced 2025-04-27 22:32:31 +02:00
ima-evm-utils: Fix incorrect algorithm name in hash_info.gen
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> Reviewed-by: Petr Vorel <pvorel@suse.cz> Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
This commit is contained in:
parent
a5f5dd7c8e
commit
2a7658bf0e
1
src/.gitignore
vendored
1
src/.gitignore
vendored
@ -1 +1,2 @@
|
|||||||
hash_info.h
|
hash_info.h
|
||||||
|
tmp_hash_info.h
|
||||||
|
@ -84,9 +84,10 @@ echo "};"
|
|||||||
echo "const char *const hash_algo_name[HASH_ALGO__LAST] = {"
|
echo "const char *const hash_algo_name[HASH_ALGO__LAST] = {"
|
||||||
sed -n 's/HASH_ALGO_\(.*\),/\1 \L\1\E/p' $HASH_INFO | \
|
sed -n 's/HASH_ALGO_\(.*\),/\1 \L\1\E/p' $HASH_INFO | \
|
||||||
while read a b; do
|
while read a b; do
|
||||||
# Normalize text hash name: if it contains underscore between
|
# Normalize text hash name: sm3 algorithm name is different from
|
||||||
# digits replace it with a dash, other underscores are removed.
|
# the macro definition, which is also the only special case of an
|
||||||
b=$(echo "$b" | sed "s/\([0-9]\)_\([0-9]\)/\1-\2/g;s/_//g")
|
# underscore between digits. Remove all other underscores.
|
||||||
|
b=$(echo "$b" | sed "s/sm3_256/sm3/g;s/_//g")
|
||||||
printf '\t%-26s = "%s",\n' "[HASH_ALGO_$a]" "$b"
|
printf '\t%-26s = "%s",\n' "[HASH_ALGO_$a]" "$b"
|
||||||
done
|
done
|
||||||
echo "};"
|
echo "};"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user