diff options
author | Integral <integral@member.fsf.org> | 2024-10-23 10:32:02 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-10-23 10:32:02 +0200 |
commit | b6b8527cd184085008585c1a1f9725eb97c342ef (patch) | |
tree | d615d9db0cfbbd14417e8e5feb32461dfec83e10 /src/test | |
parent | update TODO (diff) | |
download | systemd-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.c | 13 |
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); } } |