Skip to content

Commit

Permalink
selftests/tpm2: Open tpm dev in unbuffered mode
Browse files Browse the repository at this point in the history
In order to have control over how many bytes are read or written
the device needs to be opened in unbuffered mode.

Signed-off-by: Tadeusz Struk <tadeusz.struk@intel.com>
Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Tested-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Signed-off-by: James Morris <james.morris@microsoft.com>
  • Loading branch information
Tadeusz Struk authored and James Morris committed Apr 8, 2019
1 parent f1a0ba6 commit 6da7058
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tools/testing/selftests/tpm2/tpm2.py
Original file line number Diff line number Diff line change
Expand Up @@ -358,9 +358,9 @@ def __init__(self, flags = 0):
self.flags = flags

if (self.flags & Client.FLAG_SPACE) == 0:
self.tpm = open('/dev/tpm0', 'r+b')
self.tpm = open('/dev/tpm0', 'r+b', buffering=0)
else:
self.tpm = open('/dev/tpmrm0', 'r+b')
self.tpm = open('/dev/tpmrm0', 'r+b', buffering=0)

def close(self):
self.tpm.close()
Expand Down

0 comments on commit 6da7058

Please sign in to comment.