Lines Matching refs:tpm
9 #include <tpm-v2.h>
48 /* TPM internal states */
52 /* TPM password per hierarchy */
55 /* TPM properties */
57 /* TPM PCRs */
59 /* TPM PCR extensions */
72 struct sandbox_tpm2 *tpm = dev_get_priv(dev);
165 if (!pw_sz && !tpm->pw_sz[*hierarchy])
179 if (pw_sz != tpm->pw_sz[*hierarchy] ||
180 strncmp(pw, tpm->pw[*hierarchy], tpm->pw_sz[*hierarchy])) {
190 struct sandbox_tpm2 *tpm = dev_get_priv(dev);
194 if (!tpm->init_done || tpm->startup_done)
199 if (!tpm->init_done || !tpm->startup_done)
204 if (!tpm->startup_done)
209 if (!tpm->tests_done)
243 struct sandbox_tpm2 *tpm = dev_get_priv(dev);
248 if (tpm->pcr[pcr_index][i] || extension[i])
251 memcpy(tpm->pcr[pcr_index], sandbox_extended_once_pcr,
253 tpm->pcr_extensions[pcr_index]++;
262 struct sandbox_tpm2 *tpm = dev_get_priv(dev);
320 tpm->startup_done = true;
336 tpm->tests_done = true;
343 tpm->pw_sz[hierarchy] = 0;
348 tpm->pw_sz[i] = 0;
352 tpm->properties[i] = 0;
356 tpm->pcr_extensions[i] = 0;
358 tpm->pcr[i][j] = 0;
370 tpm->pw_sz[hierarchy] = new_pw_sz;
371 memcpy(tpm->pw[hierarchy], sent, new_pw_sz);
382 printf("Sandbox TPM only support TPM_CAPABILITIES\n");
426 put_unaligned_be32(tpm->properties[property + i],
441 tpm->properties[TPM2_PROP_MAX_TRIES] = get_unaligned_be32(sent);
442 sent += sizeof(*tpm->properties);
443 tpm->properties[TPM2_RECOVERY_TIME] = get_unaligned_be32(sent);
444 sent += sizeof(*tpm->properties);
445 tpm->properties[TPM2_LOCKOUT_RECOVERY] = get_unaligned_be32(sent);
446 sent += sizeof(*tpm->properties);
463 printf("Sandbox TPM only handle SHA256 algorithm\n");
471 printf("Sandbox TPM cannot handle so much PCRs\n");
480 printf("Sandbox TPM handles up to %d PCR(s)\n",
508 put_unaligned_be32(tpm->pcr_extensions[pcr_index], recv);
512 memcpy(recv, tpm->pcr[pcr_index], TPM2_DIGEST_LEN);
530 printf("Sandbox TPM handles up to %d PCR(s)\n",
548 printf("Sandbox TPM only handle SHA256 algorithm\n");
578 struct sandbox_tpm2 *tpm = dev_get_priv(dev);
580 if (tpm->init_done)
583 tpm->init_done = true;
590 struct sandbox_tpm2 *tpm = dev_get_priv(dev);
593 memset(tpm, 0, sizeof(*tpm));