fapi-nv-set-bits_ecc.sh 993 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. set -e
  2. source helpers.sh
  3. start_up
  4. CRYPTO_PROFILE="ECC"
  5. setup_fapi $CRYPTO_PROFILE
  6. function cleanup {
  7. tss2 delete --path=/
  8. shut_down
  9. }
  10. trap cleanup EXIT
  11. NV_PATH="/nv/Owner/NvBitmap"
  12. BITMAP="0x0102030405060608"
  13. tss2 provision
  14. tss2 createnv --path=$NV_PATH --type="noDa, bitfield" --size=0 --authValue=""
  15. tss2 nvsetbits --nvPath=$NV_PATH --bitmap=$BITMAP
  16. expect <<EOF
  17. # Try with missing nvPath
  18. spawn tss2 nvsetbits --bitmap=$BITMAP
  19. set ret [wait]
  20. if {[lindex \$ret 2] || [lindex \$ret 3] != 1} {
  21. Command has not failed as expected\n"
  22. exit 1
  23. }
  24. EOF
  25. expect <<EOF
  26. # Try with missing bitmap
  27. spawn tss2 nvsetbits --nvPath=$NV_PATH
  28. set ret [wait]
  29. if {[lindex \$ret 2] || [lindex \$ret 3] != 1} {
  30. Command has not failed as expected\n"
  31. exit 1
  32. }
  33. EOF
  34. expect <<EOF
  35. # Try with wrong bitmap
  36. spawn tss2 nvsetbits --nvPath=$NV_PATH --bitmap=abc
  37. set ret [wait]
  38. if {[lindex \$ret 2] || [lindex \$ret 3] != 1} {
  39. Command has not failed as expected\n"
  40. exit 1
  41. }
  42. EOF
  43. exit 0