• Home
  • Raw
  • Download

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 __del__(self): argument
374 if self.tpm:
375 self.tpm.close()
377 def close(self): argument
378 self.tpm.close()
380 def send_cmd(self, cmd): argument
381 self.tpm.write(cmd)
383 if (self.flags & Client.FLAG_NONBLOCK):
384 self.tpm_poll.register(self.tpm, select.POLLIN)
385 self.tpm_poll.poll(10000)
387 rsp = self.tpm.read()
389 if (self.flags & Client.FLAG_NONBLOCK):
390 self.tpm_poll.unregister(self.tpm)
392 if (self.flags & Client.FLAG_DEBUG) != 0:
405 def read_pcr(self, i, bank_alg = TPM2_ALG_SHA1): argument
420 rsp = self.send_cmd(cmd)
437 def extend_pcr(self, i, dig, bank_alg = TPM2_ALG_SHA1): argument
454 self.send_cmd(cmd)
456 def start_auth_session(self, session_type, name_alg = TPM2_ALG_SHA1): argument
471 return struct.unpack('>I', self.send_cmd(cmd)[10:14])[0]
473 def __calc_pcr_digest(self, pcrs, bank_alg = TPM2_ALG_SHA1, argument
479 pcr = self.read_pcr(i, bank_alg)
486 def policy_pcr(self, handle, pcrs, bank_alg = TPM2_ALG_SHA1, argument
489 dig = self.__calc_pcr_digest(pcrs, bank_alg, name_alg)
511 self.send_cmd(cmd)
513 def policy_password(self, handle): argument
521 self.send_cmd(cmd)
523 def get_policy_digest(self, handle): argument
531 return self.send_cmd(cmd)[12:]
533 def flush_context(self, handle): argument
541 self.send_cmd(cmd)
543 def create_root_key(self, auth_value = bytes()): argument
586 return struct.unpack('>I', self.send_cmd(cmd)[10:14])[0]
588 def seal(self, parent_key, data, auth_value, policy_dig, argument
624 rsp = self.send_cmd(cmd)
628 def unseal(self, parent_key, blob, auth_value, policy_handle): argument
647 data_handle = struct.unpack('>I', self.send_cmd(cmd)[10:14])[0]
665 rsp = self.send_cmd(cmd)
667 self.flush_context(data_handle)
673 def reset_da_lock(self): argument
686 self.send_cmd(cmd)
688 def __get_cap_cnt(self, cap, pt, cnt): argument
698 rsp = self.send_cmd(cmd)[10:]
709 def get_cap(self, cap, pt): argument
714 next_handles, more_data = self.__get_cap_cnt(cap, pt, 1)