]> Gentwo Git Trees - linux/.git/commitdiff
selftests: tpm2: Fix ill defined assertions
authorMaurice Hieronymus <mhi@mailbox.org>
Sun, 23 Nov 2025 11:18:09 +0000 (12:18 +0100)
committerJarkko Sakkinen <jarkko@kernel.org>
Wed, 3 Dec 2025 20:55:27 +0000 (22:55 +0200)
Remove parentheses around assert statements in Python. With parentheses,
assert always evaluates to True, making the checks ineffective.

Signed-off-by: Maurice Hieronymus <mhi@mailbox.org>
Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
tools/testing/selftests/tpm2/tpm2.py

index bba8cb54548ec9022af79d9eb6286a5ef0704fe4..3d130c30bc7c4c3a9b2100f8d235cfe530f495ca 100644 (file)
@@ -437,7 +437,7 @@ class Client:
 
     def extend_pcr(self, i, dig, bank_alg = TPM2_ALG_SHA1):
         ds = get_digest_size(bank_alg)
-        assert(ds == len(dig))
+        assert ds == len(dig)
 
         auth_cmd = AuthCommand()
 
@@ -589,7 +589,7 @@ class Client:
     def seal(self, parent_key, data, auth_value, policy_dig,
              name_alg = TPM2_ALG_SHA1):
         ds = get_digest_size(name_alg)
-        assert(not policy_dig or ds == len(policy_dig))
+        assert not policy_dig or ds == len(policy_dig)
 
         attributes = 0
         if not policy_dig: