Normalize NS350 chip state at entry/exit of nations SPDM tests#489
Merged
Conversation
NS350's Nations_IdentityKeySet returns TPM_RC_VALUE when asked to set the identity key to its current value. The nations test assumed the chip always started at identity-key=1, but self-hosted CI runners carry persistent NV state across runs — any prior failure left the chip in a state the next run could not recover from. GPIO reset clears volatile state but does not reset NV-persistent identity-key or PSK provisioning. Add normalize_nations_chip(): GPIO reset + idempotent --psk-clear + idempotent --identity-key-set. Call at entry of both nations and nations-psk blocks, and wire to trap EXIT so the chip is always cleaned up on success, failure, or set -e early exit. Validated on Pi hardware across five scenarios (identity-key=1, identity-key=0, PSK-provisioned, nations-psk clean, nations-psk PSK-stuck): all runs now pass and leave the chip at canonical identity-key=1.
dgarske
approved these changes
Apr 21, 2026
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.
NS350 had persistent states that where getting messed up due to canceled runs and failed runs. Added a way to clear psk key after reset to make sure the states are consistent for each run.