summaryrefslogtreecommitdiffstats
path: root/src/test/test-tpm2.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2023-08-24 11:16:14 +0200
committerLennart Poettering <lennart@poettering.net>2023-08-24 13:40:37 +0200
commit2099cd6289981f51e9f8b4b9bf028eca36c9ad52 (patch)
tree9dac6bab7e73777dd844c9f1f53e3b89e286feaf /src/test/test-tpm2.c
parentMerge pull request #28946 from poettering/json-variant-append-arrayb (diff)
downloadsystemd-2099cd6289981f51e9f8b4b9bf028eca36c9ad52.tar.xz
systemd-2099cd6289981f51e9f8b4b9bf028eca36c9ad52.zip
tpm2: unify symbolic name infra for PCRs
We so far maintained two places for symboic names for PCRs. One in tpm2-util.h and one in tpm-pcr.h. Let's unify this into one, i.e. move the full list from tpm2-util.h into tpm-pcr.h, replacing the short list placed so far there. Systematically prefix the definitions with TPM2_ or tpm2_, to follow how we do this for all other defines in this context. No change in behaviour, just unification of tables.
Diffstat (limited to 'src/test/test-tpm2.c')
-rw-r--r--src/test/test-tpm2.c76
1 files changed, 38 insertions, 38 deletions
diff --git a/src/test/test-tpm2.c b/src/test/test-tpm2.c
index 7e65396b14..e2c700896a 100644
--- a/src/test/test-tpm2.c
+++ b/src/test/test-tpm2.c
@@ -4,44 +4,44 @@
#include "tpm2-util.h"
#include "tests.h"
-TEST(pcr_index_from_string) {
- assert_se(pcr_index_from_string("platform-code") == 0);
- assert_se(pcr_index_from_string("0") == 0);
- assert_se(pcr_index_from_string("platform-config") == 1);
- assert_se(pcr_index_from_string("1") == 1);
- assert_se(pcr_index_from_string("external-code") == 2);
- assert_se(pcr_index_from_string("2") == 2);
- assert_se(pcr_index_from_string("external-config") == 3);
- assert_se(pcr_index_from_string("3") == 3);
- assert_se(pcr_index_from_string("boot-loader-code") == 4);
- assert_se(pcr_index_from_string("4") == 4);
- assert_se(pcr_index_from_string("boot-loader-config") == 5);
- assert_se(pcr_index_from_string("5") == 5);
- assert_se(pcr_index_from_string("secure-boot-policy") == 7);
- assert_se(pcr_index_from_string("7") == 7);
- assert_se(pcr_index_from_string("kernel-initrd") == 9);
- assert_se(pcr_index_from_string("9") == 9);
- assert_se(pcr_index_from_string("ima") == 10);
- assert_se(pcr_index_from_string("10") == 10);
- assert_se(pcr_index_from_string("kernel-boot") == 11);
- assert_se(pcr_index_from_string("11") == 11);
- assert_se(pcr_index_from_string("kernel-config") == 12);
- assert_se(pcr_index_from_string("12") == 12);
- assert_se(pcr_index_from_string("sysexts") == 13);
- assert_se(pcr_index_from_string("13") == 13);
- assert_se(pcr_index_from_string("shim-policy") == 14);
- assert_se(pcr_index_from_string("14") == 14);
- assert_se(pcr_index_from_string("system-identity") == 15);
- assert_se(pcr_index_from_string("15") == 15);
- assert_se(pcr_index_from_string("debug") == 16);
- assert_se(pcr_index_from_string("16") == 16);
- assert_se(pcr_index_from_string("application-support") == 23);
- assert_se(pcr_index_from_string("23") == 23);
- assert_se(pcr_index_from_string("hello") == -EINVAL);
- assert_se(pcr_index_from_string("8") == 8);
- assert_se(pcr_index_from_string("44") == -EINVAL);
- assert_se(pcr_index_from_string("-5") == -EINVAL);
- assert_se(pcr_index_from_string("24") == -EINVAL);
+TEST(tpm2_pcr_index_from_string) {
+ assert_se(tpm2_pcr_index_from_string("platform-code") == 0);
+ assert_se(tpm2_pcr_index_from_string("0") == 0);
+ assert_se(tpm2_pcr_index_from_string("platform-config") == 1);
+ assert_se(tpm2_pcr_index_from_string("1") == 1);
+ assert_se(tpm2_pcr_index_from_string("external-code") == 2);
+ assert_se(tpm2_pcr_index_from_string("2") == 2);
+ assert_se(tpm2_pcr_index_from_string("external-config") == 3);
+ assert_se(tpm2_pcr_index_from_string("3") == 3);
+ assert_se(tpm2_pcr_index_from_string("boot-loader-code") == 4);
+ assert_se(tpm2_pcr_index_from_string("4") == 4);
+ assert_se(tpm2_pcr_index_from_string("boot-loader-config") == 5);
+ assert_se(tpm2_pcr_index_from_string("5") == 5);
+ assert_se(tpm2_pcr_index_from_string("secure-boot-policy") == 7);
+ assert_se(tpm2_pcr_index_from_string("7") == 7);
+ assert_se(tpm2_pcr_index_from_string("kernel-initrd") == 9);
+ assert_se(tpm2_pcr_index_from_string("9") == 9);
+ assert_se(tpm2_pcr_index_from_string("ima") == 10);
+ assert_se(tpm2_pcr_index_from_string("10") == 10);
+ assert_se(tpm2_pcr_index_from_string("kernel-boot") == 11);
+ assert_se(tpm2_pcr_index_from_string("11") == 11);
+ assert_se(tpm2_pcr_index_from_string("kernel-config") == 12);
+ assert_se(tpm2_pcr_index_from_string("12") == 12);
+ assert_se(tpm2_pcr_index_from_string("sysexts") == 13);
+ assert_se(tpm2_pcr_index_from_string("13") == 13);
+ assert_se(tpm2_pcr_index_from_string("shim-policy") == 14);
+ assert_se(tpm2_pcr_index_from_string("14") == 14);
+ assert_se(tpm2_pcr_index_from_string("system-identity") == 15);
+ assert_se(tpm2_pcr_index_from_string("15") == 15);
+ assert_se(tpm2_pcr_index_from_string("debug") == 16);
+ assert_se(tpm2_pcr_index_from_string("16") == 16);
+ assert_se(tpm2_pcr_index_from_string("application-support") == 23);
+ assert_se(tpm2_pcr_index_from_string("23") == 23);
+ assert_se(tpm2_pcr_index_from_string("hello") == -EINVAL);
+ assert_se(tpm2_pcr_index_from_string("8") == 8);
+ assert_se(tpm2_pcr_index_from_string("44") == -EINVAL);
+ assert_se(tpm2_pcr_index_from_string("-5") == -EINVAL);
+ assert_se(tpm2_pcr_index_from_string("24") == -EINVAL);
}
TEST(tpm2_util_pbkdf2_hmac_sha256) {