tpm2_readclock.c 544 B

123456789101112131415161718192021
  1. /* SPDX-License-Identifier: BSD-3-Clause */
  2. #include "tpm2.h"
  3. #include "tpm2_tool.h"
  4. #include "tpm2_util.h"
  5. static tool_rc tpm2_tool_onrun(ESYS_CONTEXT *ectx, tpm2_option_flags flags) {
  6. UNUSED(flags);
  7. TPMS_TIME_INFO *current_time = NULL;
  8. tool_rc rc = tpm2_readclock(ectx, &current_time);
  9. if (rc == tool_rc_success) {
  10. tpm2_util_print_time(current_time);
  11. Esys_Free(current_time);
  12. }
  13. return rc;
  14. }
  15. // Register this tool with tpm2_tool.c
  16. TPM2_TOOL_REGISTER("readclock", NULL, tpm2_tool_onrun, NULL, NULL)