Tss2_TctiLdr_GetInfo.3.in 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. .\" Process this file with
  2. .\" groff -man -Tascii foo.1
  3. .\"
  4. .TH Tss2_TctiLdr_GetInfo 3 "JUNE 2019" "TPM2 Software Stack"
  5. .SH NAME
  6. Tss2_TctiLdr_GetInfo \- Query TctiLdr library for the TSS2_TCTI_INFO
  7. structure associated with a TCTI library.
  8. .SH SYNOPSIS
  9. .B #include <tss2/tss2_tctildr.h>
  10. .sp
  11. .sp
  12. .BI "TSS2_RC Tss2_TctiLdr_GetInfo ("const char " "*name" ", TSS2_TCTI_INFO " "**info" ");"
  13. .sp
  14. .SH DESCRIPTION
  15. The
  16. .BR Tss2_TctiLdr_GetInfo ()
  17. function attempts to instantiate a TSS2_TCTI_INFO structure appropriate
  18. for the TCTI library associated with the provided
  19. .I name.
  20. The TSS2_TCTI_INFO* reference returned by this function must be freed by
  21. the
  22. .I Tss2_TctiLdr_FreeInfo ()
  23. function.
  24. .sp
  25. The
  26. .I name
  27. parameter is a C string. If this string is
  28. .BR NULL
  29. then the library will select a default TCTI for the caller. This is the same
  30. TCTI library that will be used to initialize the context returned by
  31. .B Tss2_TctiLdr_Initialize
  32. when passed a NULL
  33. .I name.
  34. If non-NULL,
  35. the
  36. .B Tss2_TctiLdr_GetInfo ()
  37. uses the same algorithm to map the string to the name of an installed TCTI
  38. library as the
  39. .B Tss2_TctiLdr_Initialize ()
  40. function.
  41. .sp
  42. The
  43. .I info
  44. parameter is a reference to a
  45. .I TSS2_TCTI_INFO*.
  46. The reference returned will be allocated by the function and must be freed
  47. by the caller.
  48. .SH RETURN VALUE
  49. A successful call to this function will return TSS2_RC_SUCCESS. An
  50. unsuccessful call to this function will return a response code described
  51. below in section
  52. .B ERRORS.
  53. .SH ERRORS
  54. .B TSS2_TCTI_RC_MEMORY
  55. is returned if memory allocation fails
  56. .sp
  57. .B TSS2_TCTI_RC_NOT_SUPPORTED
  58. is returned when the loader is unable to locate a TCTI library with the
  59. provided
  60. .I name
  61. .sp
  62. .B TSS2_TCTI_RC_IO_ERROR
  63. is returned if a failure occurs in the underlying library loading mechanism
  64. .sp
  65. .B TSS2_TCTI_RC_BAD_REFERENCE
  66. is returned if the
  67. .I info
  68. parameter is NULL
  69. .sp
  70. .SH EXAMPLE
  71. Example code.
  72. .sp
  73. .nf
  74. #include <inttypes.h>
  75. #include <stdlib.h>
  76. #include <stdio.h>
  77. #include <tss2/tss2_tctildr.h>
  78. TSS2_TCTI_INFO *info = NULL;
  79. TSS2_RC rc = Tss2_TctiLdr_GetInfo (NULL, &info);
  80. if (rc != TSS2_RC_SUCCESS) {
  81. fprintf (stderr, "Initialization of default TCTI context failed with "
  82. "response code: 0x%" PRIx32 "\n", rc);
  83. exit (EXIT_FAILURE);
  84. }
  85. if (info != NULL) {
  86. Tss2_TctiLdr_FreeInfo (info);
  87. info = NULL;
  88. }
  89. exit (EXIT_SUCCESS);
  90. .fi