tpm2_cc_util.h 891 B

123456789101112131415161718192021222324252627282930313233
  1. /* SPDX-License-Identifier: BSD-3-Clause */
  2. #ifndef LIB_TPM2_CC_UTIL_H_
  3. #define LIB_TPM2_CC_UTIL_H_
  4. #include <stdbool.h>
  5. #include <tss2/tss2_tpm2_types.h>
  6. /**
  7. * Converts a string to a command code.
  8. * @param str
  9. * The string to convert. The string is either the macro name
  10. * of the command code provided by the tss2_tpm2_types.h header file or
  11. * a numerical string understood by strtoul() with a base of 0.
  12. * @param cc
  13. * The command code value.
  14. * @return
  15. * True if successful, false otherwise.
  16. */
  17. bool tpm2_cc_util_from_str(const char *str, TPM2_CC *cc);
  18. /**
  19. * Given a command code, returns the name of the command as defined by the macro
  20. * names in tss2_tpm2_types.h. If the command is unknown, NULL is returned.
  21. * @param cc
  22. * The command to decode.
  23. * @return
  24. * A string or NULL.
  25. */
  26. const char *tpm2_cc_util_to_str(TPM2_CC cc);
  27. #endif /* LIB_TPM2_CC_UTIL_H_ */