pcrallocate.sh 753 B

123456789101112131415161718192021222324252627282930313233343536
  1. # SPDX-License-Identifier: BSD-3-Clause
  2. source helpers.sh
  3. cleanup() {
  4. rm -f pcrs.out
  5. if [ "$1" != "no-shut-down" ]; then
  6. shut_down
  7. fi
  8. }
  9. trap cleanup EXIT
  10. start_up
  11. cleanup "no-shut-down"
  12. # Store the old banks because e.g. some TPM-simuators don't support SHA512
  13. OLDBANKS=$(tpm2 getcap pcrs | grep bank | sed 's/.*bank\: \(.*\)/+\1:all/' | \
  14. tr -d "\n")
  15. echo "OLDBANKS: $OLDBANKS"
  16. tpm2 pcrallocate -P "" sha1:7,8,9,10,16,17,18,19+sha256:all \
  17. | tee out.yml
  18. yaml_verify out.yml
  19. tpm2 pcrallocate sha1:all+sha256:all | tee out.yml
  20. yaml_verify out.yml
  21. tpm2 pcrallocate ${OLDBANKS:1}
  22. #Note: We cannot check if the allocations were performed by the TPM, since they
  23. # will only take effect once the TPM reboots.
  24. exit 0