Skip to content

Commit cffc934

Browse files
sysheapjarkkojs
authored andcommitted
selftests: tpm2: Fix ill defined assertions
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>
1 parent a619fe3 commit cffc934

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

  • tools/testing/selftests/tpm2

tools/testing/selftests/tpm2/tpm2.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,7 @@ def read_pcr(self, i, bank_alg = TPM2_ALG_SHA1):
437437

438438
def extend_pcr(self, i, dig, bank_alg = TPM2_ALG_SHA1):
439439
ds = get_digest_size(bank_alg)
440-
assert(ds == len(dig))
440+
assert ds == len(dig)
441441

442442
auth_cmd = AuthCommand()
443443

@@ -589,7 +589,7 @@ def create_root_key(self, auth_value = bytes()):
589589
def seal(self, parent_key, data, auth_value, policy_dig,
590590
name_alg = TPM2_ALG_SHA1):
591591
ds = get_digest_size(name_alg)
592-
assert(not policy_dig or ds == len(policy_dig))
592+
assert not policy_dig or ds == len(policy_dig)
593593

594594
attributes = 0
595595
if not policy_dig:

0 commit comments

Comments
 (0)