-
Notifications
You must be signed in to change notification settings - Fork 146
Fixes 20260415 - fix finding from static analysis #751
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
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
61731ca
Zeroize PolicySign key buffer before free
danielinux 91e0b16
keygen_lms: zero LmsKey after free
danielinux 1359aac
Block rollback fallback in non-flash update paths
danielinux d4f062a
tools/tpm: write policy output in binary mode
danielinux 3118f7a
Fixed regression in sim test, added sim test for denied rollback
danielinux 26552b5
Addressed copilot's comments
danielinux 0a4f828
Addressed Fenrir's comments
danielinux 90670fc
Addressed the 3 remaining open Copilot comments.
danielinux 8d9e912
Addressed another round of copilot comments
danielinux 73c2962
Fixed regression in update_ram tests
danielinux File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| #!/bin/bash | ||
| set -euo pipefail | ||
|
|
||
| if [ ! -f ".config" ]; then | ||
| echo "Missing .config. Run make config first." >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| if ! grep -Eq '^(DUALBANK_SWAP(\?|)=1)' .config; then | ||
| echo "DUALBANK_SWAP=1 is required for this simulation." >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| if [ ! -x "./wolfboot.elf" ]; then | ||
| echo "wolfboot.elf not found. Build the simulator first." >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| if [ ! -f "./internal_flash.dd" ]; then | ||
| echo "internal_flash.dd not found. Build test-sim-internal-flash-with-update first." >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| backup_image="$(mktemp ./internal_flash.rollback.XXXXXX)" | ||
| cp ./internal_flash.dd "$backup_image" | ||
| trap 'cp "$backup_image" ./internal_flash.dd; rm -f "$backup_image" sim_registers.dd' EXIT | ||
|
|
||
| rm -f sim_registers.dd | ||
|
|
||
| update_addr_hex="$(grep '^WOLFBOOT_PARTITION_UPDATE_ADDRESS=' .config | cut -d= -f2)" | ||
| if [ -z "${update_addr_hex}" ]; then | ||
| echo "WOLFBOOT_PARTITION_UPDATE_ADDRESS is not set in .config." >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| update_addr=$((update_addr_hex)) | ||
|
|
||
| # Corrupt UPDATE payload bytes so version metadata remains intact but | ||
| # image verification fails and boot logic attempts fallback. | ||
| printf '\x00\x00\x00\x00\x00\x00\x00\x00' | \ | ||
| dd of=./internal_flash.dd bs=1 seek="$((update_addr + 0x120))" conv=notrunc status=none | ||
|
|
||
| set +e | ||
| rollback_output="$(timeout 3s ./wolfboot.elf get_version 2>&1)" | ||
| rollback_rc=$? | ||
| set -e | ||
|
|
||
| if [ "$rollback_rc" -eq 0 ]; then | ||
| echo "Expected rollback denial, but boot continued normally." >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| if [ "$rollback_rc" -ne 124 ] && [ "$rollback_rc" -ne 80 ]; then | ||
| echo "Unexpected exit code while checking rollback denial: $rollback_rc" >&2 | ||
| echo "$rollback_output" >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| if ! printf '%s\n' "$rollback_output" | grep -q "Rollback to lower version not allowed"; then | ||
| echo "Rollback denial message not found in output." >&2 | ||
| echo "$rollback_output" >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| echo "Dualbank rollback-to-older-version denial verified." |
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.