summaryrefslogtreecommitdiffstats
path: root/src/test
diff options
context:
space:
mode:
authorIntegral <integral@member.fsf.org>2024-10-23 10:32:02 +0200
committerGitHub <noreply@github.com>2024-10-23 10:32:02 +0200
commitb6b8527cd184085008585c1a1f9725eb97c342ef (patch)
treed615d9db0cfbbd14417e8e5feb32461dfec83e10 /src/test
parentupdate TODO (diff)
downloadsystemd-b6b8527cd184085008585c1a1f9725eb97c342ef.tar.xz
systemd-b6b8527cd184085008585c1a1f9725eb97c342ef.zip
refactor: replace sizeof in loop with ELEMENTSOF & FOREACH_ELEMENT (#34863)
Diffstat (limited to 'src/test')
-rw-r--r--src/test/test-tpm2.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/test/test-tpm2.c b/src/test/test-tpm2.c
index de2889b8d2..8caf51b260 100644
--- a/src/test/test-tpm2.c
+++ b/src/test/test-tpm2.c
@@ -74,16 +74,15 @@ TEST(tpm2_util_pbkdf2_hmac_sha256) {
};
uint8_t res[SHA256_DIGEST_SIZE];
- for (size_t i = 0; i < sizeof(test_vectors)/sizeof(test_vectors[0]); i++) {
-
+ FOREACH_ELEMENT(vector, test_vectors) {
int rc = tpm2_util_pbkdf2_hmac_sha256(
- test_vectors[i].pass,
- test_vectors[i].passlen,
- test_vectors[i].salt,
- test_vectors[i].saltlen,
+ vector->pass,
+ vector->passlen,
+ vector->salt,
+ vector->saltlen,
res);
assert_se(rc == 0);
- assert_se(memcmp(test_vectors[i].expected, res, SHA256_DIGEST_SIZE) == 0);
+ assert_se(memcmp(vector->expected, res, SHA256_DIGEST_SIZE) == 0);
}
}