fapi_crypto.3 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559
  1. .TH "fapi_crypto" 3 "Fri Oct 7 2022" "Version 3.2.0" "tpm2-tss" \" -*- nroff -*-
  2. .ad l
  3. .nh
  4. .SH NAME
  5. fapi_crypto
  6. .SH SYNOPSIS
  7. .br
  8. .PP
  9. .SS "Functions"
  10. .in +1c
  11. .ti -1c
  12. .RI "TSS2_RC \fBget_crl_from_cert\fP (X509 *cert, X509_CRL **crl)"
  13. .br
  14. .ti -1c
  15. .RI "TSS2_RC \fBifapi_cert_to_pem\fP (const uint8_t *certBuffer, size_t certBufferSize, char **pemCert, TPM2_ALG_ID *certAlgorithmId, TPM2B_PUBLIC *tpmPublic)"
  16. .br
  17. .ti -1c
  18. .RI "void \fBifapi_crypto_hash_abort\fP (\fBIFAPI_CRYPTO_CONTEXT_BLOB\fP **context)"
  19. .br
  20. .ti -1c
  21. .RI "TSS2_RC \fBifapi_crypto_hash_finish\fP (\fBIFAPI_CRYPTO_CONTEXT_BLOB\fP **context, uint8_t *digest, size_t *digestSize)"
  22. .br
  23. .ti -1c
  24. .RI "TSS2_RC \fBifapi_crypto_hash_start\fP (\fBIFAPI_CRYPTO_CONTEXT_BLOB\fP **context, TPM2_ALG_ID hashAlgorithm)"
  25. .br
  26. .ti -1c
  27. .RI "TSS2_RC \fBifapi_crypto_hash_update\fP (\fBIFAPI_CRYPTO_CONTEXT_BLOB\fP *context, const uint8_t *buffer, size_t size)"
  28. .br
  29. .ti -1c
  30. .RI "TSS2_RC \fBifapi_der_sig_to_tpm\fP (const TPMT_PUBLIC *tpmPublic, const unsigned char *signature, size_t signatureSize, TPMI_ALG_HASH hashAlgorithm, TPMT_SIGNATURE *tpmSignature)"
  31. .br
  32. .ti -1c
  33. .RI "TSS2_RC \fBifapi_get_hash_alg_for_size\fP (uint16_t size, TPMI_ALG_HASH *hashAlgorithm)"
  34. .br
  35. .ti -1c
  36. .RI "TPM2_RC \fBifapi_get_profile_sig_scheme\fP (const \fBIFAPI_PROFILE\fP *profile, const TPMT_PUBLIC *tpmPublic, TPMT_SIG_SCHEME *signatureScheme)"
  37. .br
  38. .ti -1c
  39. .RI "TSS2_RC \fBifapi_get_public_from_pem_cert\fP (const char *pem_cert, TPM2B_PUBLIC *tpm_public)"
  40. .br
  41. .ti -1c
  42. .RI "TPM2_ALG_ID \fBifapi_get_signature_algorithm_from_pem\fP (const char *pemKey)"
  43. .br
  44. .ti -1c
  45. .RI "TSS2_RC \fBifapi_get_tpm2b_public_from_pem\fP (const char *pemKey, TPM2B_PUBLIC *tpmPublic)"
  46. .br
  47. .ti -1c
  48. .RI "TSS2_RC \fBifapi_get_tpm_key_fingerprint\fP (const TPM2B_PUBLIC *tpmPublicKey, TPMI_ALG_HASH hashAlg, TPM2B_DIGEST *fingerprint)"
  49. .br
  50. .ti -1c
  51. .RI "size_t \fBifapi_hash_get_digest_size\fP (TPM2_ALG_ID hashAlgorithm)"
  52. .br
  53. .ti -1c
  54. .RI "TSS2_RC \fBifapi_initialize_sign_public\fP (TPM2_ALG_ID signatureAlgorithm, TPM2B_PUBLIC *public)"
  55. .br
  56. .ti -1c
  57. .RI "TSS2_RC \fBifapi_pub_pem_key_from_tpm\fP (const TPM2B_PUBLIC *tpmPublicKey, char **pemKey, int *pemKeySize)"
  58. .br
  59. .ti -1c
  60. .RI "TSS2_RC \fBifapi_tpm_ecc_sig_to_der\fP (const TPMT_SIGNATURE *tpmSignature, uint8_t **signature, size_t *signatureSize)"
  61. .br
  62. .ti -1c
  63. .RI "TSS2_RC \fBifapi_verify_ek_cert\fP (char *root_cert_pem, char *intermed_cert_pem, char *ek_cert_pem)"
  64. .br
  65. .ti -1c
  66. .RI "TSS2_RC \fBifapi_verify_signature\fP (const \fBIFAPI_OBJECT\fP *keyObject, const uint8_t *signature, size_t signatureSize, const uint8_t *digest, size_t digestSize)"
  67. .br
  68. .ti -1c
  69. .RI "TSS2_RC \fBifapi_verify_signature_quote\fP (const \fBIFAPI_OBJECT\fP *keyObject, const uint8_t *signature, size_t signatureSize, const uint8_t *digest, size_t digestSize, const TPMT_SIG_SCHEME *signatureScheme)"
  70. .br
  71. .in -1c
  72. .SH "Detailed Description"
  73. .PP
  74. The types and functions used internally by FAPI for cryptographic operations\&. Multiple implementations of these functions for different cryptographic backends may exist\&.
  75. .SH "Function Documentation"
  76. .PP
  77. .SS "TSS2_RC get_crl_from_cert (X509 * cert, X509_CRL ** crl)"
  78. Get url to download crl from certificate\&.
  79. .PP
  80. \fBReturn values:\fP
  81. .RS 4
  82. \fITSS2_FAPI_RC_MEMORY\fP if not enough memory can be allocated\&.
  83. .br
  84. \fITSS2_FAPI_RC_BAD_VALUE\fP if an invalid value was passed into the function\&.
  85. .br
  86. \fITSS2_FAPI_RC_GENERAL_FAILURE\fP if an internal error occurred\&.
  87. .br
  88. \fITSS2_FAPI_RC_NO_CERT\fP if an error did occur during certificate downloading\&.
  89. .RE
  90. .PP
  91. .SS "TSS2_RC ifapi_cert_to_pem (const uint8_t * certBuffer, size_t certBufferSize, char ** pemCert, TPM2_ALG_ID * certAlgorithmId, TPM2B_PUBLIC * tpmPublic)"
  92. Converts a TPM certificate buffer to the PEM format\&.
  93. .PP
  94. \fBParameters:\fP
  95. .RS 4
  96. \fIcertBuffer\fP A byte buffer holding the certificate
  97. .br
  98. \fIcertBufferSize\fP The size of certBuffer in bytes
  99. .br
  100. \fIpemCert\fP A byte buffer where the PEM-formatted certificate is stored
  101. .br
  102. \fIcertAlgorithmId\fP The key type of the certified key
  103. .br
  104. \fItpmPublic\fP The public key of the certificate in TPM format\&.
  105. .RE
  106. .PP
  107. \fBReturn values:\fP
  108. .RS 4
  109. \fITSS2_RC_SUCCESS\fP on success
  110. .br
  111. \fITSS2_FAPI_RC_BAD_REFERENCE\fP if certBuffer or pemCert is NULL
  112. .br
  113. \fITSS2_FAPI_RC_MEMORY\fP if memory could not be allocated
  114. .br
  115. \fITSS2_FAPI_RC_BAD_VALUE\fP if the certificate is invalid
  116. .br
  117. \fITSS2_FAPI_RC_GENERAL_FAILURE\fP if an error occurs in the crypto library
  118. .RE
  119. .PP
  120. .SS "void ifapi_crypto_hash_abort (\fBIFAPI_CRYPTO_CONTEXT_BLOB\fP ** context)"
  121. Aborts a hash operation and finalizes the hash context\&. It will be set to NULL\&.
  122. .PP
  123. \fBParameters:\fP
  124. .RS 4
  125. \fIcontext\fP The context of the digest object\&.
  126. .RE
  127. .PP
  128. .SS "TSS2_RC ifapi_crypto_hash_finish (\fBIFAPI_CRYPTO_CONTEXT_BLOB\fP ** context, uint8_t * digest, size_t * digestSize)"
  129. Gets the digest value from a hash context and closes it\&.
  130. .PP
  131. \fBParameters:\fP
  132. .RS 4
  133. \fIcontext\fP The hash context that is released
  134. .br
  135. \fIdigest\fP The buffer for the digest value
  136. .br
  137. \fIdigestSize\fP The size of digest in bytes\&. Can be NULL
  138. .RE
  139. .PP
  140. \fBReturn values:\fP
  141. .RS 4
  142. \fITSS2_RC_SUCCESS\fP on success
  143. .br
  144. \fITSS2_FAPI_RC_BAD_REFERENCE\fP if context or digest is NULL
  145. .br
  146. \fITSS2_FAPI_RC_GENERAL_FAILURE\fP if an error occurs in the crypto library
  147. .RE
  148. .PP
  149. .SS "TSS2_RC ifapi_crypto_hash_start (\fBIFAPI_CRYPTO_CONTEXT_BLOB\fP ** context, TPM2_ALG_ID hashAlgorithm)"
  150. Starts the computation of a hash digest\&.
  151. .PP
  152. \fBParameters:\fP
  153. .RS 4
  154. \fIcontext\fP The created hash context (callee-allocated)\&.
  155. .br
  156. \fIhashAlgorithm\fP The TSS hash identifier for the hash algorithm to use\&.
  157. .RE
  158. .PP
  159. \fBReturn values:\fP
  160. .RS 4
  161. \fITSS2_RC_SUCCESS\fP on success\&.
  162. .br
  163. \fITSS2_FAPI_RC_BAD_VALUE\fP if hashAlgorithm is invalid
  164. .br
  165. \fITSS2_FAPI_RC_BAD_REFERENCE\fP if context is NULL
  166. .br
  167. \fITSS2_FAPI_RC_MEMORY\fP if memory cannot be allocated
  168. .br
  169. \fITSS2_FAPI_RC_GENERAL_FAILURE\fP if an error occurs in the crypto library
  170. .RE
  171. .PP
  172. .SS "TSS2_RC ifapi_crypto_hash_update (\fBIFAPI_CRYPTO_CONTEXT_BLOB\fP * context, const uint8_t * buffer, size_t size)"
  173. Updates the digest value of a hash object with data from a byte buffer\&.
  174. .PP
  175. \fBParameters:\fP
  176. .RS 4
  177. \fIcontext\fP The hash context that will be updated
  178. .br
  179. \fIbuffer\fP The data for the update
  180. .br
  181. \fIsize\fP The size of data in bytes
  182. .RE
  183. .PP
  184. \fBReturn values:\fP
  185. .RS 4
  186. \fITSS2_RC_SUCCESS\fP on success\&.
  187. .br
  188. \fITSS2_FAPI_RC_BAD_REFERENCE\fP for invalid parameters\&.
  189. .br
  190. \fITSS2_FAPI_RC_GENERAL_FAILURE\fP if an error occurs in the crypto library
  191. .RE
  192. .PP
  193. .SS "TSS2_RC ifapi_der_sig_to_tpm (const TPMT_PUBLIC * tpmPublic, const unsigned char * signature, size_t signatureSize, TPMI_ALG_HASH hashAlgorithm, TPMT_SIGNATURE * tpmSignature)"
  194. Convert signature from DER to TPM format\&.
  195. .PP
  196. The signature in DER format is converted to TPM format to enable verification by the TPM\&.
  197. .PP
  198. \fBParameters:\fP
  199. .RS 4
  200. \fItpmPublic\fP The public information of the signature key
  201. .br
  202. \fIsignature\fP A byte buffer holding the DER encoded signature
  203. .br
  204. \fIsignatureSize\fP The size of signature in bytes
  205. .br
  206. \fIhashAlgorithm\fP The TSS identifier for the hash algorithm used to compute the digest
  207. .br
  208. \fItpmSignature\fP The signature in TPM format
  209. .RE
  210. .PP
  211. \fBReturn values:\fP
  212. .RS 4
  213. \fITSS2_RC_SUCCESS\fP on success
  214. .br
  215. \fITSS2_FAPI_RC_GENERAL_FAILURE\fP if an error occurs in the crypto library
  216. .br
  217. \fITSS2_FAPI_RC_BAD_REFERENCE\fP if tpmPublic, signature or tpmSignature is NULL
  218. .br
  219. \fITSS2_FAPI_RC_MEMORY\fP if memory could not be allocated
  220. .br
  221. \fITSS2_FAPI_RC_BAD_VALUE\fP if an invalid value was passed into the function\&.
  222. .RE
  223. .PP
  224. .SS "TSS2_RC ifapi_get_hash_alg_for_size (uint16_t size, TPMI_ALG_HASH * hashAlgorithm)"
  225. Returns a suitable hash algorithm for a given digest size\&.
  226. .PP
  227. \fBParameters:\fP
  228. .RS 4
  229. \fIsize\fP The size of the digest
  230. .br
  231. \fIhashAlgorithm\fP A suitable hash algorithm for the digest size
  232. .RE
  233. .PP
  234. \fBReturn values:\fP
  235. .RS 4
  236. \fITSS2_RC_SUCCESS\fP on success
  237. .br
  238. \fITSS2_FAPI_RC_BAD_REFERENCE\fP if hashAlgorithm is NULL
  239. .br
  240. \fITSS2_FAPI_RC_BAD_VALUE\fP if the digest size is invalid
  241. .RE
  242. .PP
  243. .SS "TPM2_RC ifapi_get_profile_sig_scheme (const \fBIFAPI_PROFILE\fP * profile, const TPMT_PUBLIC * tpmPublic, TPMT_SIG_SCHEME * signatureScheme)"
  244. Returns the signature scheme that is currently used in the FAPI context\&.
  245. .PP
  246. \fBParameters:\fP
  247. .RS 4
  248. \fIprofile\fP The FAPI profile from which the signing scheme is retrieved
  249. .br
  250. \fItpmPublic\fP The public key for which the signing key is fetched from the FAPI
  251. .br
  252. \fIsignatureScheme\fP The currently used signature scheme
  253. .RE
  254. .PP
  255. \fBReturn values:\fP
  256. .RS 4
  257. \fITSS2_RC_SUCCESS\fP if the signature scheme was successfully fetched
  258. .br
  259. \fITSS2_FAPI_RC_BAD_REFERENCE\fP if one of the parameters is NULL
  260. .br
  261. \fITSS2_FAPI_RC_BAD_VALUE\fP if the key type is not TPM2_ALG_RSA or TPM2_ALG_ECC
  262. .RE
  263. .PP
  264. .SS "TSS2_RC ifapi_get_public_from_pem_cert (const char * pem_cert, TPM2B_PUBLIC * tpm_public)"
  265. Get public information for key of a pem certificate\&.
  266. .PP
  267. \fBParameters:\fP
  268. .RS 4
  269. \fIpem_cert\fP The pem certificate\&.
  270. .br
  271. \fItpm_public\fP The public information of the key in TPM format\&.
  272. .RE
  273. .PP
  274. \fBReturn values:\fP
  275. .RS 4
  276. \fITSS2_RC_SUCCESS\fP on success
  277. .br
  278. \fITSS2_FAPI_RC_BAD_VALUE\fP if the conversion fails\&.
  279. .br
  280. \fITSS2_FAPI_RC_GENERAL_FAILURE\fP if openssl errors occur\&.
  281. .br
  282. \fITSS2_FAPI_RC_BAD_REFERENCE\fP a invalid null pointer is passed\&.
  283. .br
  284. \fITSS2_FAPI_RC_MEMORY\fP if not enough memory can be allocated\&.
  285. .RE
  286. .PP
  287. .SS "TPM2_ALG_ID ifapi_get_signature_algorithm_from_pem (const char * pemKey)"
  288. Returns the TPM algorithm identifier that matches to the signature algorithm of a given PEM key\&.
  289. .PP
  290. \fBParameters:\fP
  291. .RS 4
  292. \fIpemKey\fP The public key from which the signature algorithm is retrieved
  293. .RE
  294. .PP
  295. \fBReturn values:\fP
  296. .RS 4
  297. \fITPM2_ALG_RSA\fP if pemKey holds an RSA key
  298. .br
  299. \fITPM2_ALG_ECC\fP if pemKey holds an ECC key
  300. .br
  301. \fITPM2_ALG_ERROR\fP if the signature algorithm could not be determined
  302. .br
  303. \fITSS2_FAPI_RC_BAD_REFERENCE\fP a invalid null pointer is passed\&.
  304. .br
  305. \fITSS2_FAPI_RC_MEMORY\fP if not enough memory can be allocated\&.
  306. .br
  307. \fITSS2_FAPI_RC_BAD_VALUE\fP if an invalid value was passed into the function\&.
  308. .RE
  309. .PP
  310. .SS "TSS2_RC ifapi_get_tpm2b_public_from_pem (const char * pemKey, TPM2B_PUBLIC * tpmPublic)"
  311. Gets an object with the TPM-relevant public information of a PEM encoded public key\&. The information is gathered from the key itself and the currently used FAPI profile\&.
  312. .PP
  313. \fBParameters:\fP
  314. .RS 4
  315. \fIpemKey\fP A byte buffer holding the PEM encoded public key for which the public information is retrieved
  316. .br
  317. \fItpmPublic\fP The public information of pemKey
  318. .RE
  319. .PP
  320. \fBReturn values:\fP
  321. .RS 4
  322. \fITSS2_RC_SUCCESS\fP on success
  323. .br
  324. \fITSS2_FAPI_RC_BAD_REFERENCE\fP if profile, pemKey or tpmPublic is NULL
  325. .br
  326. \fITSS2_FAPI_RC_MEMORY\fP if memory could not be allocated
  327. .br
  328. \fITSS2_FAPI_RC_GENERAL_FAILURE\fP if an error occurs in the crypto library
  329. .br
  330. \fITSS2_FAPI_RC_BAD_VALUE\fP if an invalid value was passed into the function\&.
  331. .RE
  332. .PP
  333. .SS "TSS2_RC ifapi_get_tpm_key_fingerprint (const TPM2B_PUBLIC * tpmPublicKey, TPMI_ALG_HASH hashAlg, TPM2B_DIGEST * fingerprint)"
  334. Compute the fingerprint of a TPM public key\&.
  335. .PP
  336. \fBParameters:\fP
  337. .RS 4
  338. \fItpmPublicKey\fP The public key created by the TPM
  339. .br
  340. \fIhashAlg\fP The hash algorithm used for fingerprint computation\&.
  341. .br
  342. \fIfingerprint\fP The fingerprint digest\&.
  343. .RE
  344. .PP
  345. \fBReturn values:\fP
  346. .RS 4
  347. \fITSS2_RC_SUCCESS\fP on success
  348. .br
  349. \fITSS2_FAPI_RC_GENERAL_FAILURE\fP if an error occurs in the crypto library
  350. .br
  351. \fITSS2_FAPI_RC_MEMORY\fP if memory could not be allocated
  352. .br
  353. \fITSS2_FAPI_BAD_REFERENCE\fP if tpmPublicKey or pemKeySize are NULL
  354. .br
  355. \fITSS2_FAPI_RC_BAD_REFERENCE\fP a invalid null pointer is passed\&.
  356. .br
  357. \fITSS2_FAPI_RC_BAD_VALUE\fP if an invalid value was passed into the function\&.
  358. .RE
  359. .PP
  360. .SS "size_t ifapi_hash_get_digest_size (TPM2_ALG_ID hashAlgorithm)"
  361. Returns the digest size of a given hash algorithm\&.
  362. .PP
  363. \fBParameters:\fP
  364. .RS 4
  365. \fIhashAlgorithm\fP The TSS identifier of the hash algorithm
  366. .RE
  367. .PP
  368. \fBReturns:\fP
  369. .RS 4
  370. The size of the digest produced by the hash algorithm if hashAlgorithm is valid
  371. .RE
  372. .PP
  373. \fBReturn values:\fP
  374. .RS 4
  375. \fI0\fP if hashAlgorithm is invalid
  376. .RE
  377. .PP
  378. .SS "TSS2_RC ifapi_initialize_sign_public (TPM2_ALG_ID signatureAlgorithm, TPM2B_PUBLIC * public)"
  379. Initializes a FAPI key template for a given signature algorithm\&.
  380. .PP
  381. \fBParameters:\fP
  382. .RS 4
  383. \fIsignatureAlgorithm\fP The signature algorithm to use\&. Must be TPM2_ALG_RSA or TPM2_ALG_ECC
  384. .br
  385. \fIpublic\fP The template to initialize
  386. .RE
  387. .PP
  388. \fBReturn values:\fP
  389. .RS 4
  390. \fITSS2_RC_SUCCESS\fP on success
  391. .br
  392. \fITSS2_FAPI_RC_BAD_REFERENCE\fP if template is NULL
  393. .br
  394. \fITSS2_FAPI_RC_BAD_VALUE\fP if signatureAlgorithm is not TPM2_ALG_RSA or TPM2_ALG_ECC
  395. .RE
  396. .PP
  397. .SS "TSS2_RC ifapi_pub_pem_key_from_tpm (const TPM2B_PUBLIC * tpmPublicKey, char ** pemKey, int * pemKeySize)"
  398. Convert a TPM public key into a PEM formatted byte buffer\&. This can be used by TLS libraries\&.
  399. .PP
  400. \fBParameters:\fP
  401. .RS 4
  402. \fItpmPublicKey\fP The public key created by the TPM
  403. .br
  404. \fIpemKey\fP A byte buffer that will hold the PEM representation of the public key (callee allocated)
  405. .br
  406. \fIpemKeySize\fP The size of pemKey in bytes
  407. .RE
  408. .PP
  409. \fBReturn values:\fP
  410. .RS 4
  411. \fITSS2_RC_SUCCESS\fP on success
  412. .br
  413. \fITSS2_FAPI_RC_GENERAL_FAILURE\fP if an error occurs in the crypto library
  414. .br
  415. \fITSS2_FAPI_RC_MEMORY\fP if memory could not be allocated
  416. .br
  417. \fITSS2_FAPI_BAD_REFERENCE\fP if tpmPublicKey or pemKeySize are NULL
  418. .br
  419. \fITSS2_FAPI_RC_BAD_REFERENCE\fP a invalid null pointer is passed\&.
  420. .br
  421. \fITSS2_FAPI_RC_BAD_VALUE\fP if an invalid value was passed into the function\&.
  422. .RE
  423. .PP
  424. .SS "TSS2_RC ifapi_tpm_ecc_sig_to_der (const TPMT_SIGNATURE * tpmSignature, uint8_t ** signature, size_t * signatureSize)"
  425. Convert a TPM ECDSA signature into a DER formatted byte buffer\&. This can be used by TLS libraries\&.
  426. .PP
  427. \fBParameters:\fP
  428. .RS 4
  429. \fItpmSignature\fP The signature created by the TPM
  430. .br
  431. \fIsignature\fP A byte buffer that will hold the DER representation of the signature (callee allocated)
  432. .br
  433. \fIsignatureSize\fP The size of signature in bytes\&. May be NULL
  434. .RE
  435. .PP
  436. \fBReturn values:\fP
  437. .RS 4
  438. \fITSS2_RC_SUCCESS\fP on success
  439. .br
  440. \fITSS2_FAPI_RC_BAD_REFERENCE\fP if tpmSignature is NULL
  441. .br
  442. \fITSS2_FAPI_RC_MEMORY\fP if memory could not be allocated
  443. .br
  444. \fITSS2_FAPI_RC_GENERAL_FAILURE\fP if an error occurs in the crypto library
  445. .RE
  446. .PP
  447. .SS "TSS2_RC ifapi_verify_ek_cert (char * root_cert_pem, char * intermed_cert_pem, char * ek_cert_pem)"
  448. Verify EK certificate read from TPM\&.
  449. .PP
  450. \fBParameters:\fP
  451. .RS 4
  452. \fIroot_cert_pem\fP The vendor root certificate\&.
  453. .br
  454. \fIintermed_cert_pem\fP The vendor intermediate certificate\&.
  455. .br
  456. \fIek_cert_pem\fP The ek certificate from TPM\&.
  457. .RE
  458. .PP
  459. \fBReturn values:\fP
  460. .RS 4
  461. \fITSS2_RC_SUCCESS\fP on success
  462. .br
  463. \fITSS2_FAPI_RC_BAD_VALUE\fP if the verification was no successful\&.
  464. .br
  465. \fITSS2_FAPI_RC_NO_CERT\fP if an error did occur during certificate downloading\&.
  466. .br
  467. \fITSS2_FAPI_RC_GENERAL_FAILURE\fP if an internal error occurred\&.
  468. .br
  469. \fITSS2_FAPI_RC_MEMORY\fP if not enough memory can be allocated\&.
  470. .RE
  471. .PP
  472. .SS "TSS2_RC ifapi_verify_signature (const \fBIFAPI_OBJECT\fP * keyObject, const uint8_t * signature, size_t signatureSize, const uint8_t * digest, size_t digestSize)"
  473. Verifies a signature using a given FAPI public key\&.
  474. .PP
  475. \fBParameters:\fP
  476. .RS 4
  477. \fIkeyObject\fP The FAPI public key used for verification
  478. .br
  479. \fIsignature\fP The signature to verify
  480. .br
  481. \fIsignatureSize\fP The size of signature in bytes
  482. .br
  483. \fIdigest\fP The digest of the signature
  484. .br
  485. \fIdigestSize\fP The size of digest in bytes
  486. .RE
  487. .PP
  488. \fBReturn values:\fP
  489. .RS 4
  490. \fITSS2_RC_SUCCESS\fP In case of success
  491. .br
  492. \fITSS2_FAPI_RC_BAD_REFERENCE\fP if keyObject, signature or digest is NULL
  493. .br
  494. \fITSS2_FAPI_RC_BAD_VALUE\fP if the type of the key is wrong
  495. .br
  496. \fITSS2_FAPI_RC_MEMORY\fP if memory could not be allocated
  497. .br
  498. \fITSS2_FAPI_RC_GENERAL_FAILURE\fP if an error occurs in the crypto library
  499. .br
  500. \fITSS2_FAPI_RC_SIGNATURE_VERIFICATION_FAILED\fP if the verification of the signature fails
  501. .RE
  502. .PP
  503. .SS "TSS2_RC ifapi_verify_signature_quote (const \fBIFAPI_OBJECT\fP * keyObject, const uint8_t * signature, size_t signatureSize, const uint8_t * digest, size_t digestSize, const TPMT_SIG_SCHEME * signatureScheme)"
  504. Verifies the signature created by a Quote command\&.
  505. .PP
  506. \fBParameters:\fP
  507. .RS 4
  508. \fIkeyObject\fP A FAPI key with which the signature is verified
  509. .br
  510. \fIsignature\fP A byte buffer holding the signature
  511. .br
  512. \fIsignatureSize\fP The size of signature in bytes
  513. .br
  514. \fIdigest\fP The digest of the signature
  515. .br
  516. \fIdigestSize\fP The size of digest in bytes
  517. .br
  518. \fIsignatureScheme\fP The signature scheme
  519. .RE
  520. .PP
  521. \fBReturn values:\fP
  522. .RS 4
  523. \fITSS2_RC_SUCCESS\fP on success
  524. .br
  525. \fITSS2_FAPI_RC_BAD_REFERENCE\fP if keyObject, signature, digest or signatureScheme is NULL
  526. .br
  527. \fITSS2_FAPI_RC_MEMORY\fP if memory could not be allocated
  528. .br
  529. \fITSS2_FAPI_RC_BAD_VALUE\fP if the PEM encoded key could not be decoded
  530. .br
  531. \fITSS2_FAPI_RC_GENERAL_FAILURE\fP if an error occurs in the crypto library
  532. .br
  533. \fITSS2_FAPI_RC_SIGNATURE_VERIFICATION_FAILED\fP if the verification of the signature fails
  534. .RE
  535. .PP
  536. .SH "Author"
  537. .PP
  538. Generated automatically by Doxygen for tpm2-tss from the source code\&.