Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add create primary key example #215

Merged
merged 3 commits into from
Jun 29, 2022
Merged

Conversation

dgarske
Copy link
Contributor

@dgarske dgarske commented Jun 28, 2022

  • Add create primary key example.
  • Add support for using a unique template with create and create primary.

Confirmed the "unique" string is used for the primary key derivation from seed.
The primary key must be recreated on Windows TBS as it cannot be persisted to NV. The public template (including unique value) is used for the KDF based on hierarchy seed.

@dgarske dgarske self-assigned this Jun 28, 2022
@dgarske dgarske requested a review from anhu June 29, 2022 16:52
@dgarske dgarske assigned anhu and unassigned dgarske Jun 29, 2022
Copy link
Member

@anhu anhu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a few comments. Looks great though!!

README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
examples/keygen/create_primary.c Outdated Show resolved Hide resolved
examples/keygen/create_primary.c Outdated Show resolved Hide resolved
examples/keygen/create_primary.c Outdated Show resolved Hide resolved
src/tpm2_wrap.c Show resolved Hide resolved
src/tpm2_wrap.c Show resolved Hide resolved
wrapper/CSharp/wolfTPM-tests.cs Outdated Show resolved Hide resolved
wolftpm/tpm2_wrap.h Outdated Show resolved Hide resolved
wolftpm/tpm2_wrap.h Show resolved Hide resolved
@anhu anhu assigned dgarske and unassigned anhu Jun 29, 2022
@dgarske dgarske requested a review from anhu June 29, 2022 21:00
@dgarske dgarske assigned anhu and unassigned dgarske Jun 29, 2022
examples/keygen/create_primary.c Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
@anhu anhu assigned dgarske and unassigned anhu Jun 29, 2022
@dgarske dgarske requested a review from anhu June 29, 2022 21:41
@dgarske dgarske assigned anhu and unassigned dgarske Jun 29, 2022
Copy link
Member

@anhu anhu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent!!! Will merge momentarily.

@anhu anhu merged commit bfadb25 into wolfSSL:master Jun 29, 2022
@dgarske dgarske deleted the keycreate_unique branch June 29, 2022 21:46
#ifndef WOLFTPM_WINAPI
/* Move storage key into persistent NV */
printf("Storing Primary key to handle 0x%08x\n", persistHandle);
rc = wolfTPM2_NVStoreKey(&dev, hierarchy, &primary,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could the primary key be stored as persistent?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could the primary key be stored as persistent?

Hi @JasonMac219 , on TPM's where the internal NV is available it is possible. On platforms like Windows TBS there is no way to store the primary key. You would need to recreate it using the same template and unique at startup which will create the same primary key, since it uses the same seed. Once it is created a temporary (memory based) handle is returned, which you can use until next reboot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants