]> git.baikalelectronics.ru Git - kernel.git/commitdiff
selftests/tpm2: Open tpm dev in unbuffered mode
authorTadeusz Struk <tadeusz.struk@intel.com>
Tue, 12 Feb 2019 23:42:05 +0000 (15:42 -0800)
committerJames Morris <james.morris@microsoft.com>
Mon, 8 Apr 2019 22:58:55 +0000 (15:58 -0700)
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>
tools/testing/selftests/tpm2/tpm2.py

index 6fc99ce025b59f3dff460516d8b81c441c96a477..828c185846248031ff598670d393e34a38fa24df 100644 (file)
@@ -358,9 +358,9 @@ class Client:
         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()