tool_rc.h 728 B

12345678910111213141516171819202122232425262728293031
  1. /* SPDX-License-Identifier: BSD-3-Clause */
  2. #ifndef LIB_TOOL_RC_H_
  3. #define LIB_TOOL_RC_H_
  4. /* do not port to TSS below here */
  5. typedef enum tool_rc tool_rc;
  6. enum tool_rc {
  7. /* do not reorder or change, part of returned codes to exit */
  8. /* maps to common/returns.md */
  9. tool_rc_success = 0,
  10. tool_rc_general_error,
  11. tool_rc_option_error,
  12. tool_rc_auth_error,
  13. tool_rc_tcti_error,
  14. tool_rc_unsupported
  15. };
  16. /**
  17. * Flattens a TSS generated RC into it's error component and converts it to a tool_rc suitable for tool return
  18. * use.
  19. * @note
  20. * Do not port me to TSS.
  21. * @param rc
  22. * The rc to convert.
  23. * @return
  24. * A valid tool_rc.
  25. */
  26. tool_rc tool_rc_from_tpm(TSS2_RC rc);
  27. #endif /* LIB_TOOL_RC_H_ */