Lines Matching refs:self

203     def __init__(self, alg):  argument
204 self.alg = alg
206 def __str__(self): argument
211 def __init__(self, name): argument
212 self.name = name
214 def __str__(self): argument
219 def __init__(self, alg): argument
220 self.alg = alg
222 def __str__(self): argument
227 def __init__(self, cc, rc): argument
228 self.cc = cc
229 self.rc = rc
232 self.name = TPM2_FMT1_ERRORS.get(rc & 0x3f, "TPM_RC_UNKNOWN")
234 self.name = TPM2_WARN_ERRORS.get(rc & 0x7f, "TPM_RC_UNKNOWN")
236 self.name = TPM2_VER1_ERRORS.get(rc & 0x7f, "TPM_RC_UNKNOWN")
238 self.name = TPM2_VER0_ERRORS.get(rc & 0x7f, "TPM_RC_UNKNOWN")
240 def __str__(self): argument
241 if self.cc:
242 return '%s: cc=0x%08x, rc=0x%08x' % (self.name, self.cc, self.rc)
244 return '%s: rc=0x%08x' % (self.name, self.rc)
250 def __init__(self, session_handle=TPM2_RS_PW, nonce=bytes(), argument
252 self.session_handle = session_handle
253 self.nonce = nonce
254 self.session_attributes = session_attributes
255 self.hmac = hmac
257 def __bytes__(self): argument
258 fmt = '>I H%us B H%us' % (len(self.nonce), len(self.hmac))
259 return struct.pack(fmt, self.session_handle, len(self.nonce),
260 self.nonce, self.session_attributes, len(self.hmac),
261 self.hmac)
263 def __len__(self): argument
264 fmt = '>I H%us B H%us' % (len(self.nonce), len(self.hmac))
271 def __init__(self, user_auth=bytes(), data=bytes()): argument
272 self.user_auth = user_auth
273 self.data = data
275 def __bytes__(self): argument
276 fmt = '>H%us H%us' % (len(self.user_auth), len(self.data))
277 return struct.pack(fmt, len(self.user_auth), self.user_auth,
278 len(self.data), self.data)
280 def __len__(self): argument
281 fmt = '>H%us H%us' % (len(self.user_auth), len(self.data))
295 def __fmt(self): argument
297 (len(self.auth_policy), len(self.parameters), len(self.unique))
299 def __init__(self, object_type, name_alg, object_attributes, argument
302 self.object_type = object_type
303 self.name_alg = name_alg
304 self.object_attributes = object_attributes
305 self.auth_policy = auth_policy
306 self.parameters = parameters
307 self.unique = unique
309 def __bytes__(self): argument
310 return struct.pack(self.__fmt(),
311 self.object_type,
312 self.name_alg,
313 self.object_attributes,
314 len(self.auth_policy),
315 self.auth_policy,
316 self.parameters,
317 len(self.unique),
318 self.unique)
320 def __len__(self): argument
321 return struct.calcsize(self.__fmt())
359 def __init__(self, flags = 0): argument
360 self.flags = flags
362 if (self.flags & Client.FLAG_SPACE) == 0:
363 self.tpm = open('/dev/tpm0', 'r+b', buffering=0)
365 self.tpm = open('/dev/tpmrm0', 'r+b', buffering=0)
367 if (self.flags & Client.FLAG_NONBLOCK):
368 flags = fcntl.fcntl(self.tpm, fcntl.F_GETFL)
370 fcntl.fcntl(self.tpm, fcntl.F_SETFL, flags)
371 self.tpm_poll = select.poll()
373 def close(self): argument
374 self.tpm.close()
376 def send_cmd(self, cmd): argument
377 self.tpm.write(cmd)
379 if (self.flags & Client.FLAG_NONBLOCK):
380 self.tpm_poll.register(self.tpm, select.POLLIN)
381 self.tpm_poll.poll(10000)
383 rsp = self.tpm.read()
385 if (self.flags & Client.FLAG_NONBLOCK):
386 self.tpm_poll.unregister(self.tpm)
388 if (self.flags & Client.FLAG_DEBUG) != 0:
401 def read_pcr(self, i, bank_alg = TPM2_ALG_SHA1): argument
416 rsp = self.send_cmd(cmd)
433 def extend_pcr(self, i, dig, bank_alg = TPM2_ALG_SHA1): argument
450 self.send_cmd(cmd)
452 def start_auth_session(self, session_type, name_alg = TPM2_ALG_SHA1): argument
467 return struct.unpack('>I', self.send_cmd(cmd)[10:14])[0]
469 def __calc_pcr_digest(self, pcrs, bank_alg = TPM2_ALG_SHA1, argument
475 pcr = self.read_pcr(i, bank_alg)
482 def policy_pcr(self, handle, pcrs, bank_alg = TPM2_ALG_SHA1, argument
485 dig = self.__calc_pcr_digest(pcrs, bank_alg, name_alg)
507 self.send_cmd(cmd)
509 def policy_password(self, handle): argument
517 self.send_cmd(cmd)
519 def get_policy_digest(self, handle): argument
527 return self.send_cmd(cmd)[12:]
529 def flush_context(self, handle): argument
537 self.send_cmd(cmd)
539 def create_root_key(self, auth_value = bytes()): argument
582 return struct.unpack('>I', self.send_cmd(cmd)[10:14])[0]
584 def seal(self, parent_key, data, auth_value, policy_dig, argument
620 rsp = self.send_cmd(cmd)
624 def unseal(self, parent_key, blob, auth_value, policy_handle): argument
643 data_handle = struct.unpack('>I', self.send_cmd(cmd)[10:14])[0]
661 rsp = self.send_cmd(cmd)
663 self.flush_context(data_handle)
669 def reset_da_lock(self): argument
682 self.send_cmd(cmd)
684 def __get_cap_cnt(self, cap, pt, cnt): argument
694 rsp = self.send_cmd(cmd)[10:]
705 def get_cap(self, cap, pt): argument
710 next_handles, more_data = self.__get_cap_cnt(cap, pt, 1)