sessionconfig.sh 891 B

12345678910111213141516171819202122232425262728293031323334353637
  1. # SPDX-License-Identifier: BSD-3-Clause
  2. source helpers.sh
  3. cleanup() {
  4. rm -f session.ctx
  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. # Start a session and test if session attributes can be modified
  13. tpm2 startauthsession -S session.ctx
  14. ## Check default session attribute has continuesession set
  15. DEFAULT_SESSION_ATTRIBUTE=continuesession
  16. tpm2 sessionconfig session.ctx | grep $DEFAULT_SESSION_ATTRIBUTE
  17. # Check if session can be marked for encryption
  18. SESSION_ENCRYPT_SET=encrypt
  19. tpm2 sessionconfig session.ctx --enable-encrypt
  20. tpm2 sessionconfig session.ctx | grep $SESSION_ENCRYPT_SET
  21. # Check if session can be marked for decryption
  22. SESSION_DECRYPT_SET=decrypt
  23. tpm2 sessionconfig session.ctx --enable-decrypt
  24. tpm2 sessionconfig session.ctx | grep $SESSION_DECRYPT_SET
  25. tpm2 flushcontext session.ctx
  26. exit 0