certs: move scripts/check-blacklist-hashes.awk to certs/
authorMasahiro Yamada <masahiroy@kernel.org>
Sat, 11 Jun 2022 17:22:32 +0000 (02:22 +0900)
committerMasahiro Yamada <masahiroy@kernel.org>
Wed, 27 Jul 2022 12:17:59 +0000 (21:17 +0900)
This script is only used in certs/Makefile, so certs/ is a better
home for it.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Reviewed-by: Mickaël Salaün <mic@linux.microsoft.com>
Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>
MAINTAINERS
certs/Makefile
certs/check-blacklist-hashes.awk [new file with mode: 0755]
scripts/check-blacklist-hashes.awk [deleted file]

index f679152bdbadf9a2ef67d6b3aad70509ab46f453..cd569d35d55c1677cf39b3d9650ece3faa5c64ab 100644 (file)
@@ -4718,7 +4718,6 @@ L:        keyrings@vger.kernel.org
 S:     Maintained
 F:     Documentation/admin-guide/module-signing.rst
 F:     certs/
-F:     scripts/check-blacklist-hashes.awk
 F:     scripts/sign-file.c
 F:     tools/certs/
 
index 88a73b28d254a2da623e3a5e645b44f711d2cf0d..854647dbce05eb49401be17d6eb9a35a2fd0d7ad 100644 (file)
@@ -13,7 +13,7 @@ CFLAGS_blacklist_hashes.o := -I $(obj)
 
 quiet_cmd_check_and_copy_blacklist_hash_list = GEN     $@
       cmd_check_and_copy_blacklist_hash_list = \
-       $(AWK) -f $(srctree)/scripts/check-blacklist-hashes.awk $(CONFIG_SYSTEM_BLACKLIST_HASH_LIST) >&2; \
+       $(AWK) -f $(srctree)/$(src)/check-blacklist-hashes.awk $(CONFIG_SYSTEM_BLACKLIST_HASH_LIST) >&2; \
        cat $(CONFIG_SYSTEM_BLACKLIST_HASH_LIST) > $@
 
 $(obj)/blacklist_hash_list: $(CONFIG_SYSTEM_BLACKLIST_HASH_LIST) FORCE
diff --git a/certs/check-blacklist-hashes.awk b/certs/check-blacklist-hashes.awk
new file mode 100755 (executable)
index 0000000..107c1d3
--- /dev/null
@@ -0,0 +1,37 @@
+#!/usr/bin/awk -f
+# SPDX-License-Identifier: GPL-2.0
+#
+# Copyright © 2020, Microsoft Corporation. All rights reserved.
+#
+# Author: Mickaël Salaün <mic@linux.microsoft.com>
+#
+# Check that a CONFIG_SYSTEM_BLACKLIST_HASH_LIST file contains a valid array of
+# hash strings.  Such string must start with a prefix ("tbs" or "bin"), then a
+# colon (":"), and finally an even number of hexadecimal lowercase characters
+# (up to 128).
+
+BEGIN {
+       RS = ","
+}
+{
+       if (!match($0, "^[ \t\n\r]*\"([^\"]*)\"[ \t\n\r]*$", part1)) {
+               print "Not a string (item " NR "):", $0;
+               exit 1;
+       }
+       if (!match(part1[1], "^(tbs|bin):(.*)$", part2)) {
+               print "Unknown prefix (item " NR "):", part1[1];
+               exit 1;
+       }
+       if (!match(part2[2], "^([0-9a-f]+)$", part3)) {
+               print "Not a lowercase hexadecimal string (item " NR "):", part2[2];
+               exit 1;
+       }
+       if (length(part3[1]) > 128) {
+               print "Hash string too long (item " NR "):", part3[1];
+               exit 1;
+       }
+       if (length(part3[1]) % 2 == 1) {
+               print "Not an even number of hexadecimal characters (item " NR "):", part3[1];
+               exit 1;
+       }
+}
diff --git a/scripts/check-blacklist-hashes.awk b/scripts/check-blacklist-hashes.awk
deleted file mode 100755 (executable)
index 107c1d3..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-#!/usr/bin/awk -f
-# SPDX-License-Identifier: GPL-2.0
-#
-# Copyright © 2020, Microsoft Corporation. All rights reserved.
-#
-# Author: Mickaël Salaün <mic@linux.microsoft.com>
-#
-# Check that a CONFIG_SYSTEM_BLACKLIST_HASH_LIST file contains a valid array of
-# hash strings.  Such string must start with a prefix ("tbs" or "bin"), then a
-# colon (":"), and finally an even number of hexadecimal lowercase characters
-# (up to 128).
-
-BEGIN {
-       RS = ","
-}
-{
-       if (!match($0, "^[ \t\n\r]*\"([^\"]*)\"[ \t\n\r]*$", part1)) {
-               print "Not a string (item " NR "):", $0;
-               exit 1;
-       }
-       if (!match(part1[1], "^(tbs|bin):(.*)$", part2)) {
-               print "Unknown prefix (item " NR "):", part1[1];
-               exit 1;
-       }
-       if (!match(part2[2], "^([0-9a-f]+)$", part3)) {
-               print "Not a lowercase hexadecimal string (item " NR "):", part2[2];
-               exit 1;
-       }
-       if (length(part3[1]) > 128) {
-               print "Hash string too long (item " NR "):", part3[1];
-               exit 1;
-       }
-       if (length(part3[1]) % 2 == 1) {
-               print "Not an even number of hexadecimal characters (item " NR "):", part3[1];
-               exit 1;
-       }
-}