iesys_crypto.3 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605
  1. .TH "iesys_crypto" 3 "Fri Oct 7 2022" "Version 3.2.0" "tpm2-tss" \" -*- nroff -*-
  2. .ad l
  3. .nh
  4. .SH NAME
  5. iesys_crypto
  6. .SH SYNOPSIS
  7. .br
  8. .PP
  9. .SS "Functions"
  10. .in +1c
  11. .ti -1c
  12. .RI "TSS2_RC \fBiesys_crypto_hash_get_digest_size\fP (TPM2_ALG_ID hashAlg, size_t *size)"
  13. .br
  14. .ti -1c
  15. .RI "TSS2_RC \fBiesys_cryptossl_hash_start\fP (\fBIESYS_CRYPTO_CONTEXT_BLOB\fP **context, TPM2_ALG_ID hashAlg)"
  16. .br
  17. .ti -1c
  18. .RI "TSS2_RC \fBiesys_cryptossl_hash_update\fP (\fBIESYS_CRYPTO_CONTEXT_BLOB\fP *context, const uint8_t *buffer, size_t size)"
  19. .br
  20. .ti -1c
  21. .RI "TSS2_RC \fBiesys_cryptossl_hash_update2b\fP (\fBIESYS_CRYPTO_CONTEXT_BLOB\fP *context, TPM2B *b)"
  22. .br
  23. .ti -1c
  24. .RI "TSS2_RC \fBiesys_cryptossl_hash_finish\fP (\fBIESYS_CRYPTO_CONTEXT_BLOB\fP **context, uint8_t *buffer, size_t *size)"
  25. .br
  26. .ti -1c
  27. .RI "TSS2_RC \fBiesys_cryptossl_hash_finish2b\fP (\fBIESYS_CRYPTO_CONTEXT_BLOB\fP **context, TPM2B *b)"
  28. .br
  29. .ti -1c
  30. .RI "TSS2_RC \fBiesys_cryptossl_hmac_start\fP (\fBIESYS_CRYPTO_CONTEXT_BLOB\fP **context, TPM2_ALG_ID hashAlg, const uint8_t *key, size_t size)"
  31. .br
  32. .ti -1c
  33. .RI "TSS2_RC \fBiesys_cryptossl_hmac_start2b\fP (\fBIESYS_CRYPTO_CONTEXT_BLOB\fP **context, TPM2_ALG_ID hmacAlg, TPM2B *b)"
  34. .br
  35. .ti -1c
  36. .RI "TSS2_RC \fBiesys_cryptossl_hmac_update\fP (\fBIESYS_CRYPTO_CONTEXT_BLOB\fP *context, const uint8_t *buffer, size_t size)"
  37. .br
  38. .ti -1c
  39. .RI "TSS2_RC \fBiesys_cryptossl_hmac_update2b\fP (\fBIESYS_CRYPTO_CONTEXT_BLOB\fP *context, TPM2B *b)"
  40. .br
  41. .ti -1c
  42. .RI "TSS2_RC \fBiesys_cryptossl_hmac_finish\fP (\fBIESYS_CRYPTO_CONTEXT_BLOB\fP **context, uint8_t *buffer, size_t *size)"
  43. .br
  44. .ti -1c
  45. .RI "TSS2_RC \fBiesys_cryptossl_hmac_finish2b\fP (\fBIESYS_CRYPTO_CONTEXT_BLOB\fP **context, TPM2B *hmac)"
  46. .br
  47. .ti -1c
  48. .RI "void \fBiesys_cryptossl_hmac_abort\fP (\fBIESYS_CRYPTO_CONTEXT_BLOB\fP **context)"
  49. .br
  50. .ti -1c
  51. .RI "TSS2_RC \fBiesys_crypto_pHash\fP (TPM2_ALG_ID alg, const uint8_t rcBuffer[4], const uint8_t ccBuffer[4], const TPM2B_NAME *name1, const TPM2B_NAME *name2, const TPM2B_NAME *name3, const uint8_t *pBuffer, size_t pBuffer_size, uint8_t *pHash, size_t *pHash_size)"
  52. .br
  53. .ti -1c
  54. .RI "TSS2_RC \fBiesys_crypto_authHmac\fP (TPM2_ALG_ID alg, uint8_t *hmacKey, size_t hmacKeySize, const uint8_t *pHash, size_t pHash_size, const TPM2B_NONCE *nonceNewer, const TPM2B_NONCE *nonceOlder, const TPM2B_NONCE *nonceDecrypt, const TPM2B_NONCE *nonceEncrypt, TPMA_SESSION sessionAttributes, TPM2B_AUTH *hmac)"
  55. .br
  56. .ti -1c
  57. .RI "TSS2_RC \fBiesys_cryptossl_random2b\fP (TPM2B_NONCE *nonce, size_t num_bytes)"
  58. .br
  59. .ti -1c
  60. .RI "TSS2_RC \fBiesys_cryptossl_pk_encrypt\fP (TPM2B_PUBLIC *pub_tpm_key, size_t in_size, BYTE *in_buffer, size_t max_out_size, BYTE *out_buffer, size_t *out_size, const char *label)"
  61. .br
  62. .ti -1c
  63. .RI "TSS2_RC \fBiesys_crypto_KDFaHmac\fP (TPM2_ALG_ID alg, uint8_t *hmacKey, size_t hmacKeySize, uint32_t counter, const char *label, TPM2B_NONCE *contextU, TPM2B_NONCE *contextV, uint32_t bitlength, uint8_t *hmac, size_t *hmacSize)"
  64. .br
  65. .ti -1c
  66. .RI "TSS2_RC \fBiesys_crypto_KDFa\fP (TPM2_ALG_ID hashAlg, uint8_t *hmacKey, size_t hmacKeySize, const char *label, TPM2B_NONCE *contextU, TPM2B_NONCE *contextV, uint32_t bitLength, uint32_t *counterInOut, BYTE *outKey, BOOL use_digest_size)"
  67. .br
  68. .ti -1c
  69. .RI "TSS2_RC \fBiesys_crypto_KDFe\fP (TPM2_ALG_ID hashAlg, TPM2B_ECC_PARAMETER *Z, const char *label, TPM2B_ECC_PARAMETER *partyUInfo, TPM2B_ECC_PARAMETER *partyVInfo, UINT32 bit_size, BYTE *key)"
  70. .br
  71. .ti -1c
  72. .RI "TSS2_RC \fBiesys_xor_parameter_obfuscation\fP (TPM2_ALG_ID hash_alg, uint8_t *key, size_t key_size, TPM2B_NONCE *contextU, TPM2B_NONCE *contextV, BYTE *data, size_t data_size)"
  73. .br
  74. .ti -1c
  75. .RI "TSS2_RC \fBiesys_cryptossl_get_ecdh_point\fP (TPM2B_PUBLIC *key, size_t max_out_size, TPM2B_ECC_PARAMETER *Z, TPMS_ECC_POINT *Q, BYTE *out_buffer, size_t *out_size)"
  76. .br
  77. .in -1c
  78. .SH "Detailed Description"
  79. .PP
  80. The types and functions used internally by ESAPI for cryptographic operations\&. Multiple implementations of these functions may exist for different cryptographic backends\&.
  81. .SH "Function Documentation"
  82. .PP
  83. .SS "TSS2_RC iesys_crypto_authHmac (TPM2_ALG_ID alg, uint8_t * hmacKey, size_t hmacKeySize, const uint8_t * pHash, size_t pHash_size, const TPM2B_NONCE * nonceNewer, const TPM2B_NONCE * nonceOlder, const TPM2B_NONCE * nonceDecrypt, const TPM2B_NONCE * nonceEncrypt, TPMA_SESSION sessionAttributes, TPM2B_AUTH * hmac)"
  84. Compute the HMAC for authorization\&.
  85. .PP
  86. Based on the session nonces, caller nonce, TPM nonce, if used encryption and decryption nonce, the command parameter hash, and the session attributes the HMAC used for authorization is computed\&.
  87. .PP
  88. \fBParameters:\fP
  89. .RS 4
  90. \fIalg\fP The hash algorithm used for HMAC computation\&.
  91. .br
  92. \fIhmacKey\fP The HMAC key byte buffer\&.
  93. .br
  94. \fIhmacKeySize\fP The size of the HMAC key byte buffer\&.
  95. .br
  96. \fIpHash\fP The command parameter hash byte buffer\&.
  97. .br
  98. \fIpHash_size\fP The size of the command parameter hash byte buffer\&.
  99. .br
  100. \fInonceNewer\fP The TPM nonce\&.
  101. .br
  102. \fInonceOlder\fP The caller nonce\&.
  103. .br
  104. \fInonceDecrypt\fP The decrypt nonce (NULL if not used)\&.
  105. .br
  106. \fInonceEncrypt\fP The encrypt nonce (NULL if not used)\&.
  107. .br
  108. \fIsessionAttributes\fP The attributes used for the current authentication\&.
  109. .br
  110. \fIhmac\fP The computed HMAC\&.
  111. .RE
  112. .PP
  113. \fBReturn values:\fP
  114. .RS 4
  115. \fITSS2_RC_SUCCESS\fP on success
  116. .br
  117. \fITSS2_ESYS_RC_BAD_REFERENCE\fP If a pointer is invalid\&.
  118. .RE
  119. .PP
  120. .SS "TSS2_RC iesys_crypto_hash_get_digest_size (TPM2_ALG_ID hashAlg, size_t * size)"
  121. Provide the digest size for a given hash algorithm\&.
  122. .PP
  123. This function provides the size of the digest for a given hash algorithm\&.
  124. .PP
  125. \fBParameters:\fP
  126. .RS 4
  127. \fIhashAlg\fP The hash algorithm to get the size for\&.
  128. .br
  129. \fIsize\fP The side of a digest of the hash algorithm\&.
  130. .RE
  131. .PP
  132. \fBReturn values:\fP
  133. .RS 4
  134. \fITSS2_RC_SUCCESS\fP on success\&.
  135. .br
  136. \fITSS2_ESYS_RC_BAD_VALUE\fP if hashAlg is unknown or unsupported\&.
  137. .RE
  138. .PP
  139. .SS "TSS2_RC iesys_crypto_KDFa (TPM2_ALG_ID hashAlg, uint8_t * hmacKey, size_t hmacKeySize, const char * label, TPM2B_NONCE * contextU, TPM2B_NONCE * contextV, uint32_t bitLength, uint32_t * counterInOut, BYTE * outKey, BOOL use_digest_size)"
  140. KDFa Key derivation\&.
  141. .PP
  142. Except of ECDH this function is used for key derivation\&.
  143. .PP
  144. \fBParameters:\fP
  145. .RS 4
  146. \fIhashAlg\fP The hash algorithm to use\&.
  147. .br
  148. \fIhmacKey\fP The hmacKey used in KDFa\&.
  149. .br
  150. \fIhmacKeySize\fP The size of the HMAC key\&.
  151. .br
  152. \fIlabel\fP Indicates the use of the produced key\&.
  153. .br
  154. \fIcontextU,contextV\fP are used for construction of a binary string containing information related to the derived key\&.
  155. .br
  156. \fIbitLength\fP The size of generated key in bits\&.
  157. .br
  158. \fIcounterInOut\fP Counter for the KDFa iterations\&. If set, the value will be used for the firt iteration step\&. The final counter value will be written to counterInOut\&.
  159. .br
  160. \fIoutKey\fP Byte buffer for the derived key (caller-allocated)\&.
  161. .br
  162. \fIuse_digest_size\fP Indicate whether the digest size of hashAlg is used as size of the generated key or the bitLength parameter is used\&.
  163. .RE
  164. .PP
  165. \fBReturn values:\fP
  166. .RS 4
  167. \fITSS2_RC_SUCCESS\fP on success\&.
  168. .br
  169. \fITSS2_ESYS_RC_BAD_VALUE\fP if hashAlg is unknown or unsupported\&.
  170. .RE
  171. .PP
  172. .SS "TSS2_RC iesys_crypto_KDFaHmac (TPM2_ALG_ID alg, uint8_t * hmacKey, size_t hmacKeySize, uint32_t counter, const char * label, TPM2B_NONCE * contextU, TPM2B_NONCE * contextV, uint32_t bitlength, uint8_t * hmac, size_t * hmacSize)"
  173. HMAC computation for inner loop of KDFa key derivation\&.
  174. .PP
  175. Except of ECDH this function is used for key derivation\&.
  176. .PP
  177. \fBParameters:\fP
  178. .RS 4
  179. \fIalg\fP The algorithm used for the HMAC\&.
  180. .br
  181. \fIhmacKey\fP The hmacKey used in KDFa\&.
  182. .br
  183. \fIhmacKeySize\fP The size of the HMAC key\&.
  184. .br
  185. \fIcounter\fP The curren iteration step\&.
  186. .br
  187. \fIlabel\fP Indicates the use of the produced key\&.
  188. .br
  189. \fIcontextU,contextV\fP are used for construction of a binary string containing information related to the derived key\&.
  190. .br
  191. \fIbitlength\fP The size of the generated key in bits\&.
  192. .br
  193. \fIhmac\fP Byte buffer for the generated HMAC key (caller-allocated)\&.
  194. .br
  195. \fIhmacSize\fP Size of the generated HMAC key\&.
  196. .RE
  197. .PP
  198. \fBReturn values:\fP
  199. .RS 4
  200. \fITSS2_RC_SUCCESS\fP on success\&.
  201. .br
  202. \fITSS2_ESYS_RC_BAD_REFERENCE\fP for invalid parameters\&.
  203. .RE
  204. .PP
  205. .SS "TSS2_RC iesys_crypto_KDFe (TPM2_ALG_ID hashAlg, TPM2B_ECC_PARAMETER * Z, const char * label, TPM2B_ECC_PARAMETER * partyUInfo, TPM2B_ECC_PARAMETER * partyVInfo, UINT32 bit_size, BYTE * key)"
  206. Compute KDFe as described in TPM spec part 1 C 6\&.1
  207. .PP
  208. \fBParameters:\fP
  209. .RS 4
  210. \fIhashAlg\fP [in] The nameAlg of the recipient key\&.
  211. .br
  212. \fIZ\fP [in] the x coordinate (xP) of the product (P) of a public point and a private key\&.
  213. .br
  214. \fIlabel\fP [in] KDF label\&.
  215. .br
  216. \fIpartyUInfo\fP [in] The x-coordinate of the secret exchange value (Qe,U)\&.
  217. .br
  218. \fIpartyVInfo\fP [in] The x-coordinate of a public key (Qs,V)\&.
  219. .br
  220. \fIbit_size\fP [in] Bit size of generated key\&.
  221. .br
  222. \fIkey\fP [out] Key buffer\&.
  223. .RE
  224. .PP
  225. \fBReturn values:\fP
  226. .RS 4
  227. \fITSS2_RC_SUCCESS\fP on success
  228. .br
  229. \fITSS2_ESYS_RC_BAD_REFERENCE\fP for invalid parameters
  230. .br
  231. \fITSS2_ESYS_RC_MEMORY\fP Memory cannot be allocated\&.
  232. .RE
  233. .PP
  234. .SS "TSS2_RC iesys_crypto_pHash (TPM2_ALG_ID alg, const uint8_t rcBuffer[4], const uint8_t ccBuffer[4], const TPM2B_NAME * name1, const TPM2B_NAME * name2, const TPM2B_NAME * name3, const uint8_t * pBuffer, size_t pBuffer_size, uint8_t * pHash, size_t * pHash_size)"
  235. Compute the command or response parameter hash\&.
  236. .PP
  237. These hashes are needed for the computation of the HMAC used for the authorization of commands, or for the HMAC used for checking the responses\&. The name parameters are only used for the command parameter hash (cp) and must be NULL for the computation of the response parameter rp hash (rp)\&.
  238. .PP
  239. \fBParameters:\fP
  240. .RS 4
  241. \fIalg\fP The hash algorithm\&.
  242. .br
  243. \fIrcBuffer\fP The response code in marshaled form\&.
  244. .br
  245. \fIccBuffer\fP The command code in marshaled form\&.
  246. .br
  247. \fIname1,name2,name3\fP The names associated with the corresponding handle\&. Must be NULL if no handle is passed\&.
  248. .br
  249. \fIpBuffer\fP The byte buffer or the command or the response\&.
  250. .br
  251. \fIpBuffer_size\fP The size of the command or response\&.
  252. .br
  253. \fIpHash\fP The result digest\&.
  254. .br
  255. \fIpHash_size\fP The size of the result digest\&.
  256. .RE
  257. .PP
  258. \fBReturn values:\fP
  259. .RS 4
  260. \fITSS2_RC_SUCCESS\fP on success\&.
  261. .br
  262. \fITSS2_ESYS_RC_BAD_REFERENCE\fP for invalid parameters\&.
  263. .RE
  264. .PP
  265. .SS "TSS2_RC iesys_cryptossl_get_ecdh_point (TPM2B_PUBLIC * key, size_t max_out_size, TPM2B_ECC_PARAMETER * Z, TPMS_ECC_POINT * Q, BYTE * out_buffer, size_t * out_size)"
  266. Computation of ephemeral ECC key and shared secret Z\&.
  267. .PP
  268. According to the description in TPM spec part 1 C 6\&.1 a shared secret between application and TPM is computed (ECDH)\&. An ephemeral ECC key and a TPM keyare used for the ECDH key exchange\&.
  269. .PP
  270. \fBParameters:\fP
  271. .RS 4
  272. \fIkey\fP The key to be used for ECDH key exchange\&.
  273. .br
  274. \fImax_out_size\fP the max size for the output of the public key of the computed ephemeral key\&.
  275. .br
  276. \fIZ\fP The computed shared secret\&.
  277. .br
  278. \fIQ\fP The public part of the ephemeral key in TPM format\&.
  279. .br
  280. \fIout_buffer\fP The public part of the ephemeral key will be marshaled to this buffer\&.
  281. .br
  282. \fIout_size\fP The size of the marshaled output\&.
  283. .RE
  284. .PP
  285. \fBReturn values:\fP
  286. .RS 4
  287. \fITSS2_RC_SUCCESS\fP on success
  288. .br
  289. \fITSS2_ESYS_RC_BAD_VALUE\fP The algorithm of key is not implemented\&.
  290. .br
  291. \fITSS2_ESYS_RC_GENERAL_FAILURE\fP The internal crypto engine failed\&.
  292. .RE
  293. .PP
  294. .SS "TSS2_RC iesys_cryptossl_hash_finish (\fBIESYS_CRYPTO_CONTEXT_BLOB\fP ** context, uint8_t * buffer, size_t * size)"
  295. Get the digest value of a digest object and close the context\&.
  296. .PP
  297. The digest value will written to a passed buffer and the resources of the digest object are released\&.
  298. .PP
  299. \fBParameters:\fP
  300. .RS 4
  301. \fIcontext\fP The context of the digest object to be released
  302. .br
  303. \fIbuffer\fP The buffer for the digest value (caller-allocated)\&.
  304. .br
  305. \fIsize\fP The size of the digest\&.
  306. .RE
  307. .PP
  308. \fBReturn values:\fP
  309. .RS 4
  310. \fITSS2_RC_SUCCESS\fP on success\&.
  311. .br
  312. \fITSS2_ESYS_RC_BAD_REFERENCE\fP for invalid parameters\&.
  313. .br
  314. \fITSS2_ESYS_RC_GENERAL_FAILURE\fP for errors of the crypto library\&.
  315. .RE
  316. .PP
  317. .SS "TSS2_RC iesys_cryptossl_hash_finish2b (\fBIESYS_CRYPTO_CONTEXT_BLOB\fP ** context, TPM2B * b)"
  318. void iesys_cryptossl_hash_abort(IESYS_CRYPTO_CONTEXT_BLOB **context)
  319. .SS "TSS2_RC iesys_cryptossl_hash_start (\fBIESYS_CRYPTO_CONTEXT_BLOB\fP ** context, TPM2_ALG_ID hashAlg)"
  320. Provide the context for the computation of a hash digest\&.
  321. .PP
  322. The context will be created and initialized according to the hash function\&.
  323. .PP
  324. \fBParameters:\fP
  325. .RS 4
  326. \fIcontext\fP The created context (callee-allocated)\&.
  327. .br
  328. \fIhashAlg\fP The hash algorithm for the creation of the context\&.
  329. .RE
  330. .PP
  331. \fBReturn values:\fP
  332. .RS 4
  333. \fITSS2_RC_SUCCESS\fP on success\&.
  334. .br
  335. \fITSS2_ESYS_RC_BAD_VALUE\fP or TSS2_ESYS_RC_BAD_REFERENCE for invalid parameters\&.
  336. .br
  337. \fITSS2_ESYS_RC_MEMORY\fP Memory cannot be allocated\&.
  338. .br
  339. \fITSS2_ESYS_RC_GENERAL_FAILURE\fP for errors of the crypto library\&.
  340. .RE
  341. .PP
  342. .SS "TSS2_RC iesys_cryptossl_hash_update (\fBIESYS_CRYPTO_CONTEXT_BLOB\fP * context, const uint8_t * buffer, size_t size)"
  343. Update the digest value of a digest object from a byte buffer\&.
  344. .PP
  345. The context of a digest object will be updated according to the hash algorithm of the context\&. <
  346. .PP
  347. \fBParameters:\fP
  348. .RS 4
  349. \fIcontext\fP The context of the digest object which will be updated\&.
  350. .br
  351. \fIbuffer\fP The data for the update\&.
  352. .br
  353. \fIsize\fP The size of the data buffer\&.
  354. .RE
  355. .PP
  356. \fBReturn values:\fP
  357. .RS 4
  358. \fITSS2_RC_SUCCESS\fP on success\&.
  359. .br
  360. \fITSS2_ESYS_RC_BAD_REFERENCE\fP for invalid parameters\&.
  361. .RE
  362. .PP
  363. .SS "TSS2_RC iesys_cryptossl_hash_update2b (\fBIESYS_CRYPTO_CONTEXT_BLOB\fP * context, TPM2B * b)"
  364. Update the digest value of a digest object from a TPM2B object\&.
  365. .PP
  366. The context of a digest object will be updated according to the hash algorithm of the context\&.
  367. .PP
  368. \fBParameters:\fP
  369. .RS 4
  370. \fIcontext\fP The context of the digest object which will be updated\&.
  371. .br
  372. \fIb\fP The TPM2B object for the update\&.
  373. .RE
  374. .PP
  375. \fBReturn values:\fP
  376. .RS 4
  377. \fITSS2_RC_SUCCESS\fP on success\&.
  378. .br
  379. \fITSS2_ESYS_RC_BAD_REFERENCE\fP for invalid parameters\&.
  380. .RE
  381. .PP
  382. .SS "void iesys_cryptossl_hmac_abort (\fBIESYS_CRYPTO_CONTEXT_BLOB\fP ** context)"
  383. Release the resources of an HAMC object\&.
  384. .PP
  385. The assigned resources will be released and the context will be set to NULL\&.
  386. .PP
  387. \fBParameters:\fP
  388. .RS 4
  389. \fIcontext\fP The context of the HMAC object\&.
  390. .RE
  391. .PP
  392. .SS "TSS2_RC iesys_cryptossl_hmac_finish (\fBIESYS_CRYPTO_CONTEXT_BLOB\fP ** context, uint8_t * buffer, size_t * size)"
  393. Write the HMAC digest value to a byte buffer and close the context\&.
  394. .PP
  395. The digest value will written to a passed buffer and the resources of the HMAC object are released\&.
  396. .PP
  397. \fBParameters:\fP
  398. .RS 4
  399. \fIcontext\fP The context of the HMAC object\&.
  400. .br
  401. \fIbuffer\fP The buffer for the digest value (caller-allocated)\&.
  402. .br
  403. \fIsize\fP The size of the digest\&.
  404. .RE
  405. .PP
  406. \fBReturn values:\fP
  407. .RS 4
  408. \fITSS2_RC_SUCCESS\fP on success\&.
  409. .br
  410. \fITSS2_ESYS_RC_BAD_REFERENCE\fP for invalid parameters\&.
  411. .br
  412. \fITSS2_ESYS_RC_BAD_SIZE\fP If the size passed is lower than the HMAC length\&.
  413. .br
  414. \fITSS2_ESYS_RC_GENERAL_FAILURE\fP for errors of the crypto library\&.
  415. .RE
  416. .PP
  417. .SS "TSS2_RC iesys_cryptossl_hmac_finish2b (\fBIESYS_CRYPTO_CONTEXT_BLOB\fP ** context, TPM2B * hmac)"
  418. Write the HMAC digest value to a TPM2B object and close the context\&.
  419. .PP
  420. The digest value will written to a passed TPM2B object and the resources of the HMAC object are released\&.
  421. .PP
  422. \fBParameters:\fP
  423. .RS 4
  424. \fIcontext\fP The context of the HMAC object\&.
  425. .br
  426. \fIhmac\fP The buffer for the digest value (caller-allocated)\&.
  427. .RE
  428. .PP
  429. \fBReturn values:\fP
  430. .RS 4
  431. \fITSS2_RC_SUCCESS\fP on success\&.
  432. .br
  433. \fITSS2_ESYS_RC_BAD_REFERENCE\fP for invalid parameters\&.
  434. .br
  435. \fITSS2_ESYS_RC_BAD_SIZE\fP if the size passed is lower than the HMAC length\&.
  436. .br
  437. \fITSS2_ESYS_RC_GENERAL_FAILURE\fP for errors of the crypto library\&.
  438. .RE
  439. .PP
  440. .SS "TSS2_RC iesys_cryptossl_hmac_start (\fBIESYS_CRYPTO_CONTEXT_BLOB\fP ** context, TPM2_ALG_ID hashAlg, const uint8_t * key, size_t size)"
  441. Provide the context an HMAC digest object from a byte buffer key\&.
  442. .PP
  443. The context will be created and initialized according to the hash function and the used HMAC key\&.
  444. .PP
  445. \fBParameters:\fP
  446. .RS 4
  447. \fIcontext\fP The created context (callee-allocated)\&.
  448. .br
  449. \fIhashAlg\fP The hash algorithm for the HMAC computation\&.
  450. .br
  451. \fIkey\fP The byte buffer of the HMAC key\&.
  452. .br
  453. \fIsize\fP The size of the HMAC key\&.
  454. .RE
  455. .PP
  456. \fBReturn values:\fP
  457. .RS 4
  458. \fITSS2_RC_SUCCESS\fP on success\&.
  459. .br
  460. \fITSS2_ESYS_RC_BAD_REFERENCE\fP for invalid parameters\&.
  461. .br
  462. \fITSS2_ESYS_RC_MEMORY\fP Memory cannot be allocated\&.
  463. .br
  464. \fITSS2_ESYS_RC_GENERAL_FAILURE\fP for errors of the crypto library\&.
  465. .RE
  466. .PP
  467. .SS "TSS2_RC iesys_cryptossl_hmac_update (\fBIESYS_CRYPTO_CONTEXT_BLOB\fP * context, const uint8_t * buffer, size_t size)"
  468. Update and HMAC digest value from a byte buffer\&.
  469. .PP
  470. The context of a digest object will be updated according to the hash algorithm and the key of the context\&.
  471. .PP
  472. \fBParameters:\fP
  473. .RS 4
  474. \fIcontext\fP The context of the digest object which will be updated\&.
  475. .br
  476. \fIbuffer\fP The data for the update\&.
  477. .br
  478. \fIsize\fP The size of the data buffer\&.
  479. .RE
  480. .PP
  481. \fBReturn values:\fP
  482. .RS 4
  483. \fITSS2_RC_SUCCESS\fP on success\&.
  484. .br
  485. \fITSS2_ESYS_RC_BAD_REFERENCE\fP for invalid parameters\&.
  486. .RE
  487. .PP
  488. .SS "TSS2_RC iesys_cryptossl_hmac_update2b (\fBIESYS_CRYPTO_CONTEXT_BLOB\fP * context, TPM2B * b)"
  489. Update and HMAC digest value from a TPM2B object\&.
  490. .PP
  491. The context of a digest object will be updated according to the hash algorithm and the key of the context\&.
  492. .PP
  493. \fBParameters:\fP
  494. .RS 4
  495. \fIcontext\fP The context of the digest object which will be updated\&.
  496. .br
  497. \fIb\fP The TPM2B object for the update\&.
  498. .RE
  499. .PP
  500. \fBReturn values:\fP
  501. .RS 4
  502. \fITSS2_RC_SUCCESS\fP on success\&.
  503. .br
  504. \fITSS2_ESYS_RC_BAD_REFERENCE\fP for invalid parameters\&.
  505. .RE
  506. .PP
  507. .SS "TSS2_RC iesys_cryptossl_pk_encrypt (TPM2B_PUBLIC * pub_tpm_key, size_t in_size, BYTE * in_buffer, size_t max_out_size, BYTE * out_buffer, size_t * out_size, const char * label)"
  508. Encryption of a buffer using a public (RSA) key\&.
  509. .PP
  510. Encrypting a buffer using a public key is used for example during Esys_StartAuthSession in order to encrypt the salt value\&.
  511. .PP
  512. \fBParameters:\fP
  513. .RS 4
  514. \fIpub_tpm_key\fP The key to be used for encryption\&.
  515. .br
  516. \fIin_size\fP The size of the buffer to be encrypted\&.
  517. .br
  518. \fIin_buffer\fP The data buffer to be encrypted\&.
  519. .br
  520. \fImax_out_size\fP The maximum size for the output encrypted buffer\&.
  521. .br
  522. \fIout_buffer\fP The encrypted buffer\&.
  523. .br
  524. \fIout_size\fP The size of the encrypted output\&.
  525. .br
  526. \fIlabel\fP The label used in the encryption scheme\&.
  527. .RE
  528. .PP
  529. \fBReturn values:\fP
  530. .RS 4
  531. \fITSS2_RC_SUCCESS\fP on success
  532. .br
  533. \fITSS2_ESYS_RC_BAD_VALUE\fP The algorithm of key is not implemented\&.
  534. .br
  535. \fITSS2_ESYS_RC_GENERAL_FAILURE\fP The internal crypto engine failed\&.
  536. .RE
  537. .PP
  538. .SS "TSS2_RC iesys_cryptossl_random2b (TPM2B_NONCE * nonce, size_t num_bytes)"
  539. Compute random TPM2B data\&.
  540. .PP
  541. The random data will be generated and written to a passed TPM2B structure\&.
  542. .PP
  543. \fBParameters:\fP
  544. .RS 4
  545. \fInonce\fP The TPM2B structure for the random data (caller-allocated)\&.
  546. .br
  547. \fInum_bytes\fP The number of bytes to be generated\&.
  548. .RE
  549. .PP
  550. \fBReturn values:\fP
  551. .RS 4
  552. \fITSS2_RC_SUCCESS\fP on success\&.
  553. .RE
  554. .PP
  555. NOTE: the TPM should not be used to obtain the random data
  556. .SS "TSS2_RC iesys_xor_parameter_obfuscation (TPM2_ALG_ID hash_alg, uint8_t * key, size_t key_size, TPM2B_NONCE * contextU, TPM2B_NONCE * contextV, BYTE * data, size_t data_size)"
  557. Encryption/Decryption using XOR obfuscation\&.
  558. .PP
  559. The application of this function to data encrypted with this function will produce the origin data\&. The key for XOR obfuscation will be derived with KDFa form the passed key the session nonces, and the hash algorithm\&.
  560. .PP
  561. \fBParameters:\fP
  562. .RS 4
  563. \fIhash_alg\fP The algorithm used for key derivation\&.
  564. .br
  565. \fIkey\fP key used for obfuscation
  566. .br
  567. \fIkey_size\fP Key size in bits\&.
  568. .br
  569. \fIcontextU,contextV\fP are used for construction of a binary string containing information related to the derived key\&.
  570. .br
  571. \fIdata\fP Data to be encrypted/decrypted the result will be will be stored in this buffer\&.
  572. .br
  573. \fIdata_size\fP size of data to be encrypted/decrypted\&.
  574. .RE
  575. .PP
  576. \fBReturn values:\fP
  577. .RS 4
  578. \fITSS2_RC_SUCCESS\fP on success, or TSS2_ESYS_RC_BAD_VALUE and
  579. .br
  580. \fITSS2_ESYS_RC_BAD_REFERENCE\fP for invalid parameters\&.
  581. .RE
  582. .PP
  583. .SH "Author"
  584. .PP
  585. Generated automatically by Doxygen for tpm2-tss from the source code\&.