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

Improvements in auth handling to support Policy Password and Policy Auth Value #350

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

dgarske
Copy link
Contributor

@dgarske dgarske commented May 8, 2024

  • Refactor to eliminate confusing cast between TPMS_AUTH_COMMAND and TPM2_AUTH_SESSION.
  • Adds support for TPM2_PolicyAuthValue and TPM2_PolicyPassword.
  • Adds NV policy read/write API's: wolfTPM2_NVReadAuthPolicy and wolfTPM2_NVWriteAuthPolicy.
    ZD 17739

@dgarske dgarske force-pushed the policyauth branch 3 times, most recently from c49ef1a to ad156f1 Compare May 8, 2024 21:51
@dgarske dgarske marked this pull request as ready for review May 20, 2024 22:09
@dgarske dgarske requested a review from embhorn May 20, 2024 22:12
TPM2_Packet_PlaceU32(packet, tmpSz);
/* Update the Auth Area total size in the command packet */
i = TPM2_Packet_PlaceU32(packet, authTotalSzPos);

Copy link
Member

Choose a reason for hiding this comment

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

(void) i; here to prevent unused warnings when DEBUG_WOLFTPM is not defined

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed:

src/tpm2.c:265:5: warning: Value stored to 'i' is never read [deadcode.DeadStores]
    i = TPM2_Packet_PlaceU32(packet, authTotalSzPos);
    ^   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.
src/tpm2_packet.c:394:9: warning: Value stored to 'i' is never read [deadcode.DeadStores]
        i = TPM2_Packet_PlaceU32(packet, authTotalSzPos);
        ^   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

}
/* based on position difference places calculated size at marked U32 above */
TPM2_Packet_PlaceU32(packet, tmpSz);
i = TPM2_Packet_PlaceU32(packet, authTotalSzPos);
Copy link
Member

Choose a reason for hiding this comment

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

Assigning i but never using

\return BAD_FUNC_ARG: check the provided arguments

\param dev pointer to a TPM2_DEV struct
\param sessionHandle the handle of the current policy session, a session is required to use policy PCR
Copy link
Member

Choose a reason for hiding this comment

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

Not listed in function declaration below

@dgarske dgarske requested a review from embhorn May 21, 2024 00:04
Copy link
Member

@embhorn embhorn left a comment

Choose a reason for hiding this comment

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

Tested examples and user application

@dgarske dgarske assigned wolfSSL-Bot and embhorn and unassigned embhorn and dgarske May 21, 2024
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.

None yet

3 participants