getpolicydigest.sh 444 B

123456789101112131415161718192021222324252627
  1. # SPDX-License-Identifier: BSD-3-Clause
  2. source helpers.sh
  3. cleanup() {
  4. rm -f policy.out test.policy
  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. # Create a reference policy and compare
  13. tpm2 startauthsession -S session.ctx
  14. tpm2 policypassword -S session.ctx -L test.policy
  15. tpm2 getpolicydigest -S session.ctx -o policy.out
  16. tpm2 flushcontext session.ctx
  17. exit 0