Add Transparent TPM_RC_RETRY auto-resubmit#537
Open
aidangarske wants to merge 5 commits into
Open
Conversation
dgarske
requested changes
Jun 23, 2026
dgarske
previously approved these changes
Jun 23, 2026
dgarske
requested changes
Jun 25, 2026
dgarske
requested changes
Jun 25, 2026
| packet->pos = cmdSz; | ||
|
|
||
| #ifdef WOLFTPM_SPDM | ||
| rc = TPM2_SPDM_SendCommand(ctx, packet); |
Member
There was a problem hiding this comment.
Could / should we actually map INTERNAL_SEND_COMMAND -> TPM2_SPDM_SendCommand to cleanup this section and the duplicated one below?
I suppose not since it is used to check for SPDM active. Do we need to do a better job making sure that someone can't just get SPDM to fail and have it fall back to plain text cmd/rsp?
…, document option
…dedup transport dispatch
02fcc54 to
ddddacd
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
The TPM returns
TPM_RC_RETRYwhen momentarily busy — e.g. the coredictionary-attack logic persisting the
daUsedflag to NV on the first authuse of a non-
noDAkey (an externally provisioned AIK/SUDI key). wolfTPMpassed this raw code back to the caller, unlike the TCG ESYS stack which
auto-resubmits. A customer hit it on
wolfTPM2_SignSequenceComplete.This adds optional, bounded auto-resubmit at the command chokepoint
(
TPM2_SendCommand/TPM2_SendCommandAuth), covering all transports. ATPM_RC_RETRYresponse is header-only, so the saved 10-byte header is restoredand the identical command resent — no re-marshalling.
Opt-in / disabled by default. wolfTPM's own key templates all set
noDA,so wolfTPM-created keys never trigger it; defaulting on would change behavior
for everyone to serve a case none of our keys reach. Existing callers keep the
raw
TPM_RC_RETRYunless they opt in.TPM2_SetCommandRetries(&dev.ctx, N)— enable at runtime (0 = off)-DWOLFTPM_MAX_RETRIES=N— change the compile-time default (default 0)WOLFTPM_NO_RETRY— compile the handling out entirely (~528 B)Note:
TPM_RC_RETRYis original TPM 2.0 (Part 2 rev 00.99, 2014) core-TPM DAbehavior — unrelated to SPDM, transport, or SPI wait states.
Tests cover the resubmit bookkeeping and the config API; ChangeLog and README
updated
ZD 22030