printtss.c 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. /*############################################################################
  2. # Copyright 2017 Intel Corporation
  3. #
  4. # Licensed under the Apache License, Version 2.0 (the "License");
  5. # you may not use this file except in compliance with the License.
  6. # You may obtain a copy of the License at
  7. #
  8. # http://www.apache.org/licenses/LICENSE-2.0
  9. #
  10. # Unless required by applicable law or agreed to in writing, software
  11. # distributed under the License is distributed on an "AS IS" BASIS,
  12. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. # See the License for the specific language governing permissions and
  14. # limitations under the License.
  15. ############################################################################*/
  16. /// TPM context implementation.
  17. /*! \file */
  18. #ifndef EPID_ENABLE_DEBUG_PRINT
  19. #define EPID_ENABLE_DEBUG_PRINT
  20. #endif
  21. #include "epid/member/tpm2/ibm_tss/printtss.h"
  22. #include <tss2/TPM_Types.h>
  23. #include <tss2/tss.h>
  24. #include <tss2/tssresponsecode.h>
  25. void print_tpm2_response_code(char const* operation, TPM_RC rc) {
  26. const char* msg;
  27. const char* submsg;
  28. const char* num;
  29. TSS_ResponseCode_toString(&msg, &submsg, &num, rc);
  30. printf("%s: %s%s%s\n", operation, msg, submsg, num);
  31. }
  32. #ifdef EPID_ENABLE_DEBUG_PRINT
  33. #undef EPID_ENABLE_DEBUG_PRINT
  34. #endif