-
-
Notifications
You must be signed in to change notification settings - Fork 198
Improve TPM extend ops output in normal and DEBUG mode #1758
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
Changes from all commits
5299266
7ca8d42
250a144
de7902f
77d4be1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,7 +28,7 @@ fi | |
# Unify lsmod output to use - instead of _ for comparison | ||
module_name=$(basename "$MODULE" | sed 's/_/-/g' | sed 's/\.ko$//') | ||
if lsmod | sed 's/_/-/g' | grep -q "^$module_name\\b"; then | ||
DEBUG "$MODULE: already loaded" | ||
DEBUG "$MODULE: already loaded, skipping" | ||
exit 0 | ||
fi | ||
|
||
|
@@ -39,18 +39,22 @@ if [ ! -r /sys/class/tpm/tpm0/pcrs -o ! -x /bin/tpm ]; then | |
fi | ||
|
||
if [ -z "$tpm_missing" ]; then | ||
DEBUG "Extending TPM PCR $MODULE_PCR with $MODULE prior of usage" | ||
tpmr extend -ix "$MODULE_PCR" -if "$MODULE" \ | ||
|| die "$MODULE: tpm extend failed" | ||
fi | ||
|
||
if [ ! -z "$*" -a -z "$tpm_missing" ]; then | ||
DEBUG "Extending TPM PCR $MODULE_PCR with $*" | ||
TMPFILE=/tmp/insmod.$$ | ||
echo "$@" > $TMPFILE | ||
DEBUG "Extending TPM PCR $MODULE_PCR with $MODULE prior of usage" | ||
tpmr extend -ix "$MODULE_PCR" -if $TMPFILE \ | ||
|| die "$MODULE: tpm extend on arguments failed" | ||
echo "TPM: Extending PCR[$MODULE_PCR] with $MODULE and parameters '$*' before loading" | ||
# Extend with the module parameters (even if they are empty) and the | ||
# module. Changing the parameters or the module content will result in a | ||
# different PCR measurement. | ||
if [ -n "$*" ]; then | ||
TRACE_FUNC | ||
DEBUG "Extending with module parameters and the module's content" | ||
tpmr extend -ix "$MODULE_PCR" -ic "$*" | ||
tpmr extend -ix "$MODULE_PCR" -if "$MODULE" \ | ||
|| die "$MODULE: tpm extend failed" | ||
else | ||
TRACE_FUNC | ||
DEBUG "No module parameters, extending only with the module's content" | ||
tpmr extend -ix "$MODULE_PCR" -if "$MODULE" \ | ||
|| die "$MODULE: tpm extend failed" | ||
fi | ||
Comment on lines
+52
to
+57
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't see any need to have a second code path through here, just more code to test/break. You can extend a PCR with an empty string, so the above code path works even if the module parameters are empty. Can we delete this path again? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @JonathonHall-Purism then end users/auditors will see a call twice with nothing. If you insist, I can remove, yes. |
||
fi | ||
|
||
# Since we have replaced the real insmod, we must invoke | ||
|
Uh oh!
There was an error while loading. Please reload this page.