provider-kdf.7ossl 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482
  1. .\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.42)
  2. .\"
  3. .\" Standard preamble:
  4. .\" ========================================================================
  5. .de Sp \" Vertical space (when we can't use .PP)
  6. .if t .sp .5v
  7. .if n .sp
  8. ..
  9. .de Vb \" Begin verbatim text
  10. .ft CW
  11. .nf
  12. .ne \\$1
  13. ..
  14. .de Ve \" End verbatim text
  15. .ft R
  16. .fi
  17. ..
  18. .\" Set up some character translations and predefined strings. \*(-- will
  19. .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
  20. .\" double quote, and \*(R" will give a right double quote. \*(C+ will
  21. .\" give a nicer C++. Capital omega is used to do unbreakable dashes and
  22. .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
  23. .\" nothing in troff, for use with C<>.
  24. .tr \(*W-
  25. .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
  26. .ie n \{\
  27. . ds -- \(*W-
  28. . ds PI pi
  29. . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
  30. . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
  31. . ds L" ""
  32. . ds R" ""
  33. . ds C` ""
  34. . ds C' ""
  35. 'br\}
  36. .el\{\
  37. . ds -- \|\(em\|
  38. . ds PI \(*p
  39. . ds L" ``
  40. . ds R" ''
  41. . ds C`
  42. . ds C'
  43. 'br\}
  44. .\"
  45. .\" Escape single quotes in literal strings from groff's Unicode transform.
  46. .ie \n(.g .ds Aq \(aq
  47. .el .ds Aq '
  48. .\"
  49. .\" If the F register is >0, we'll generate index entries on stderr for
  50. .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
  51. .\" entries marked with X<> in POD. Of course, you'll have to process the
  52. .\" output yourself in some meaningful fashion.
  53. .\"
  54. .\" Avoid warning from groff about undefined register 'F'.
  55. .de IX
  56. ..
  57. .nr rF 0
  58. .if \n(.g .if rF .nr rF 1
  59. .if (\n(rF:(\n(.g==0)) \{\
  60. . if \nF \{\
  61. . de IX
  62. . tm Index:\\$1\t\\n%\t"\\$2"
  63. ..
  64. . if !\nF==2 \{\
  65. . nr % 0
  66. . nr F 2
  67. . \}
  68. . \}
  69. .\}
  70. .rr rF
  71. .\"
  72. .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
  73. .\" Fear. Run. Save yourself. No user-serviceable parts.
  74. . \" fudge factors for nroff and troff
  75. .if n \{\
  76. . ds #H 0
  77. . ds #V .8m
  78. . ds #F .3m
  79. . ds #[ \f1
  80. . ds #] \fP
  81. .\}
  82. .if t \{\
  83. . ds #H ((1u-(\\\\n(.fu%2u))*.13m)
  84. . ds #V .6m
  85. . ds #F 0
  86. . ds #[ \&
  87. . ds #] \&
  88. .\}
  89. . \" simple accents for nroff and troff
  90. .if n \{\
  91. . ds ' \&
  92. . ds ` \&
  93. . ds ^ \&
  94. . ds , \&
  95. . ds ~ ~
  96. . ds /
  97. .\}
  98. .if t \{\
  99. . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
  100. . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
  101. . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
  102. . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
  103. . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
  104. . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
  105. .\}
  106. . \" troff and (daisy-wheel) nroff accents
  107. .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
  108. .ds 8 \h'\*(#H'\(*b\h'-\*(#H'
  109. .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
  110. .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
  111. .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
  112. .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
  113. .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
  114. .ds ae a\h'-(\w'a'u*4/10)'e
  115. .ds Ae A\h'-(\w'A'u*4/10)'E
  116. . \" corrections for vroff
  117. .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
  118. .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
  119. . \" for low resolution devices (crt and lpr)
  120. .if \n(.H>23 .if \n(.V>19 \
  121. \{\
  122. . ds : e
  123. . ds 8 ss
  124. . ds o a
  125. . ds d- d\h'-1'\(ga
  126. . ds D- D\h'-1'\(hy
  127. . ds th \o'bp'
  128. . ds Th \o'LP'
  129. . ds ae ae
  130. . ds Ae AE
  131. .\}
  132. .rm #[ #] #H #V #F C
  133. .\" ========================================================================
  134. .\"
  135. .IX Title "PROVIDER-KDF 7ossl"
  136. .TH PROVIDER-KDF 7ossl "2024-09-03" "3.3.2" "OpenSSL"
  137. .\" For nroff, turn off justification. Always turn off hyphenation; it makes
  138. .\" way too many mistakes in technical documents.
  139. .if n .ad l
  140. .nh
  141. .SH "NAME"
  142. provider\-kdf \- The KDF library <\-> provider functions
  143. .SH "SYNOPSIS"
  144. .IX Header "SYNOPSIS"
  145. .Vb 2
  146. \& #include <openssl/core_dispatch.h>
  147. \& #include <openssl/core_names.h>
  148. \&
  149. \& /*
  150. \& * None of these are actual functions, but are displayed like this for
  151. \& * the function signatures for functions that are offered as function
  152. \& * pointers in OSSL_DISPATCH arrays.
  153. \& */
  154. \&
  155. \& /* Context management */
  156. \& void *OSSL_FUNC_kdf_newctx(void *provctx);
  157. \& void OSSL_FUNC_kdf_freectx(void *kctx);
  158. \& void *OSSL_FUNC_kdf_dupctx(void *src);
  159. \&
  160. \& /* Encryption/decryption */
  161. \& int OSSL_FUNC_kdf_reset(void *kctx);
  162. \& int OSSL_FUNC_kdf_derive(void *kctx, unsigned char *key, size_t keylen,
  163. \& const OSSL_PARAM params[]);
  164. \&
  165. \& /* KDF parameter descriptors */
  166. \& const OSSL_PARAM *OSSL_FUNC_kdf_gettable_params(void *provctx);
  167. \& const OSSL_PARAM *OSSL_FUNC_kdf_gettable_ctx_params(void *kcxt, void *provctx);
  168. \& const OSSL_PARAM *OSSL_FUNC_kdf_settable_ctx_params(void *kcxt, void *provctx);
  169. \&
  170. \& /* KDF parameters */
  171. \& int OSSL_FUNC_kdf_get_params(OSSL_PARAM params[]);
  172. \& int OSSL_FUNC_kdf_get_ctx_params(void *kctx, OSSL_PARAM params[]);
  173. \& int OSSL_FUNC_kdf_set_ctx_params(void *kctx, const OSSL_PARAM params[]);
  174. .Ve
  175. .SH "DESCRIPTION"
  176. .IX Header "DESCRIPTION"
  177. This documentation is primarily aimed at provider authors. See \fBprovider\fR\|(7)
  178. for further information.
  179. .PP
  180. The \s-1KDF\s0 operation enables providers to implement \s-1KDF\s0 algorithms and make
  181. them available to applications via the \s-1API\s0 functions \fBEVP_KDF_CTX_reset\fR\|(3),
  182. and \fBEVP_KDF_derive\fR\|(3).
  183. .PP
  184. All \*(L"functions\*(R" mentioned here are passed as function pointers between
  185. \&\fIlibcrypto\fR and the provider in \s-1\fBOSSL_DISPATCH\s0\fR\|(3) arrays via
  186. \&\s-1\fBOSSL_ALGORITHM\s0\fR\|(3) arrays that are returned by the provider's
  187. \&\fBprovider_query_operation()\fR function
  188. (see \*(L"Provider Functions\*(R" in \fBprovider\-base\fR\|(7)).
  189. .PP
  190. All these \*(L"functions\*(R" have a corresponding function type definition
  191. named \fBOSSL_FUNC_{name}_fn\fR, and a helper function to retrieve the
  192. function pointer from an \s-1\fBOSSL_DISPATCH\s0\fR\|(3) element named
  193. \&\fBOSSL_FUNC_{name}\fR.
  194. For example, the \*(L"function\*(R" \fBOSSL_FUNC_kdf_newctx()\fR has these:
  195. .PP
  196. .Vb 3
  197. \& typedef void *(OSSL_FUNC_kdf_newctx_fn)(void *provctx);
  198. \& static ossl_inline OSSL_FUNC_kdf_newctx_fn
  199. \& OSSL_FUNC_kdf_newctx(const OSSL_DISPATCH *opf);
  200. .Ve
  201. .PP
  202. \&\s-1\fBOSSL_DISPATCH\s0\fR\|(3) array entries are identified by numbers that are provided as
  203. macros in \fBopenssl\-core_dispatch.h\fR\|(7), as follows:
  204. .PP
  205. .Vb 3
  206. \& OSSL_FUNC_kdf_newctx OSSL_FUNC_KDF_NEWCTX
  207. \& OSSL_FUNC_kdf_freectx OSSL_FUNC_KDF_FREECTX
  208. \& OSSL_FUNC_kdf_dupctx OSSL_FUNC_KDF_DUPCTX
  209. \&
  210. \& OSSL_FUNC_kdf_reset OSSL_FUNC_KDF_RESET
  211. \& OSSL_FUNC_kdf_derive OSSL_FUNC_KDF_DERIVE
  212. \&
  213. \& OSSL_FUNC_kdf_get_params OSSL_FUNC_KDF_GET_PARAMS
  214. \& OSSL_FUNC_kdf_get_ctx_params OSSL_FUNC_KDF_GET_CTX_PARAMS
  215. \& OSSL_FUNC_kdf_set_ctx_params OSSL_FUNC_KDF_SET_CTX_PARAMS
  216. \&
  217. \& OSSL_FUNC_kdf_gettable_params OSSL_FUNC_KDF_GETTABLE_PARAMS
  218. \& OSSL_FUNC_kdf_gettable_ctx_params OSSL_FUNC_KDF_GETTABLE_CTX_PARAMS
  219. \& OSSL_FUNC_kdf_settable_ctx_params OSSL_FUNC_KDF_SETTABLE_CTX_PARAMS
  220. .Ve
  221. .PP
  222. A \s-1KDF\s0 algorithm implementation may not implement all of these functions.
  223. In order to be a consistent set of functions, at least the following functions
  224. must be implemented: \fBOSSL_FUNC_kdf_newctx()\fR, \fBOSSL_FUNC_kdf_freectx()\fR,
  225. \&\fBOSSL_FUNC_kdf_set_ctx_params()\fR, \fBOSSL_FUNC_kdf_derive()\fR.
  226. All other functions are optional.
  227. .SS "Context Management Functions"
  228. .IX Subsection "Context Management Functions"
  229. \&\fBOSSL_FUNC_kdf_newctx()\fR should create and return a pointer to a provider side
  230. structure for holding context information during a \s-1KDF\s0 operation.
  231. A pointer to this context will be passed back in a number of the other \s-1KDF\s0
  232. operation function calls.
  233. The parameter \fIprovctx\fR is the provider context generated during provider
  234. initialisation (see \fBprovider\fR\|(7)).
  235. .PP
  236. \&\fBOSSL_FUNC_kdf_freectx()\fR is passed a pointer to the provider side \s-1KDF\s0 context in
  237. the \fIkctx\fR parameter.
  238. If it receives \s-1NULL\s0 as \fIkctx\fR value, it should not do anything other than
  239. return.
  240. This function should free any resources associated with that context.
  241. .PP
  242. \&\fBOSSL_FUNC_kdf_dupctx()\fR should duplicate the provider side \s-1KDF\s0 context in the
  243. \&\fIkctx\fR parameter and return the duplicate copy.
  244. .SS "Encryption/Decryption Functions"
  245. .IX Subsection "Encryption/Decryption Functions"
  246. \&\fBOSSL_FUNC_kdf_reset()\fR initialises a \s-1KDF\s0 operation given a provider
  247. side \s-1KDF\s0 context in the \fIkctx\fR parameter.
  248. .PP
  249. \&\fBOSSL_FUNC_kdf_derive()\fR performs the \s-1KDF\s0 operation after processing the
  250. \&\fIparams\fR as per \fBOSSL_FUNC_kdf_set_ctx_params()\fR.
  251. The \fIkctx\fR parameter contains a pointer to the provider side context.
  252. The resulting key of the desired \fIkeylen\fR should be written to \fIkey\fR.
  253. If the algorithm does not support the requested \fIkeylen\fR the function must
  254. return error.
  255. .SS "\s-1KDF\s0 Parameters"
  256. .IX Subsection "KDF Parameters"
  257. See \s-1\fBOSSL_PARAM\s0\fR\|(3) for further details on the parameters structure used by
  258. these functions.
  259. .PP
  260. \&\fBOSSL_FUNC_kdf_get_params()\fR gets details of parameter values associated with the
  261. provider algorithm and stores them in \fIparams\fR.
  262. .PP
  263. \&\fBOSSL_FUNC_kdf_set_ctx_params()\fR sets \s-1KDF\s0 parameters associated with the given
  264. provider side \s-1KDF\s0 context \fIkctx\fR to \fIparams\fR.
  265. Any parameter settings are additional to any that were previously set.
  266. Passing \s-1NULL\s0 for \fIparams\fR should return true.
  267. .PP
  268. \&\fBOSSL_FUNC_kdf_get_ctx_params()\fR retrieves gettable parameter values associated
  269. with the given provider side \s-1KDF\s0 context \fIkctx\fR and stores them in \fIparams\fR.
  270. Passing \s-1NULL\s0 for \fIparams\fR should return true.
  271. .PP
  272. \&\fBOSSL_FUNC_kdf_gettable_params()\fR, \fBOSSL_FUNC_kdf_gettable_ctx_params()\fR,
  273. and \fBOSSL_FUNC_kdf_settable_ctx_params()\fR all return constant \s-1\fBOSSL_PARAM\s0\fR\|(3)
  274. arrays as descriptors of the parameters that \fBOSSL_FUNC_kdf_get_params()\fR,
  275. \&\fBOSSL_FUNC_kdf_get_ctx_params()\fR, and \fBOSSL_FUNC_kdf_set_ctx_params()\fR
  276. can handle, respectively. \fBOSSL_FUNC_kdf_gettable_ctx_params()\fR and
  277. \&\fBOSSL_FUNC_kdf_settable_ctx_params()\fR will return the parameters associated
  278. with the provider side context \fIkctx\fR in its current state if it is
  279. not \s-1NULL.\s0 Otherwise, they return the parameters associated with the
  280. provider side algorithm \fIprovctx\fR.
  281. .PP
  282. Parameters currently recognised by built-in KDFs are as follows. Not all
  283. parameters are relevant to, or are understood by all KDFs:
  284. .ie n .IP """size"" (\fB\s-1OSSL_KDF_PARAM_SIZE\s0\fR) <unsigned integer>" 4
  285. .el .IP "``size'' (\fB\s-1OSSL_KDF_PARAM_SIZE\s0\fR) <unsigned integer>" 4
  286. .IX Item "size (OSSL_KDF_PARAM_SIZE) <unsigned integer>"
  287. Gets the output size from the associated \s-1KDF\s0 ctx.
  288. If the algorithm produces a variable amount of output, \s-1SIZE_MAX\s0 should be
  289. returned.
  290. If the input parameters required to calculate the fixed output size have not yet
  291. been supplied, 0 should be returned indicating an error.
  292. .ie n .IP """key"" (\fB\s-1OSSL_KDF_PARAM_KEY\s0\fR) <octet string>" 4
  293. .el .IP "``key'' (\fB\s-1OSSL_KDF_PARAM_KEY\s0\fR) <octet string>" 4
  294. .IX Item "key (OSSL_KDF_PARAM_KEY) <octet string>"
  295. Sets the key in the associated \s-1KDF\s0 ctx.
  296. .ie n .IP """secret"" (\fB\s-1OSSL_KDF_PARAM_SECRET\s0\fR) <octet string>" 4
  297. .el .IP "``secret'' (\fB\s-1OSSL_KDF_PARAM_SECRET\s0\fR) <octet string>" 4
  298. .IX Item "secret (OSSL_KDF_PARAM_SECRET) <octet string>"
  299. Sets the secret in the associated \s-1KDF\s0 ctx.
  300. .ie n .IP """pass"" (\fB\s-1OSSL_KDF_PARAM_PASSWORD\s0\fR) <octet string>" 4
  301. .el .IP "``pass'' (\fB\s-1OSSL_KDF_PARAM_PASSWORD\s0\fR) <octet string>" 4
  302. .IX Item "pass (OSSL_KDF_PARAM_PASSWORD) <octet string>"
  303. Sets the password in the associated \s-1KDF\s0 ctx.
  304. .ie n .IP """cipher"" (\fB\s-1OSSL_KDF_PARAM_CIPHER\s0\fR) <\s-1UTF8\s0 string>" 4
  305. .el .IP "``cipher'' (\fB\s-1OSSL_KDF_PARAM_CIPHER\s0\fR) <\s-1UTF8\s0 string>" 4
  306. .IX Item "cipher (OSSL_KDF_PARAM_CIPHER) <UTF8 string>"
  307. .PD 0
  308. .ie n .IP """digest"" (\fB\s-1OSSL_KDF_PARAM_DIGEST\s0\fR) <\s-1UTF8\s0 string>" 4
  309. .el .IP "``digest'' (\fB\s-1OSSL_KDF_PARAM_DIGEST\s0\fR) <\s-1UTF8\s0 string>" 4
  310. .IX Item "digest (OSSL_KDF_PARAM_DIGEST) <UTF8 string>"
  311. .ie n .IP """mac"" (\fB\s-1OSSL_KDF_PARAM_MAC\s0\fR) <\s-1UTF8\s0 string>" 4
  312. .el .IP "``mac'' (\fB\s-1OSSL_KDF_PARAM_MAC\s0\fR) <\s-1UTF8\s0 string>" 4
  313. .IX Item "mac (OSSL_KDF_PARAM_MAC) <UTF8 string>"
  314. .PD
  315. Sets the name of the underlying cipher, digest or \s-1MAC\s0 to be used.
  316. It must name a suitable algorithm for the \s-1KDF\s0 that's being used.
  317. .ie n .IP """maclen"" (\fB\s-1OSSL_KDF_PARAM_MAC_SIZE\s0\fR) <octet string>" 4
  318. .el .IP "``maclen'' (\fB\s-1OSSL_KDF_PARAM_MAC_SIZE\s0\fR) <octet string>" 4
  319. .IX Item "maclen (OSSL_KDF_PARAM_MAC_SIZE) <octet string>"
  320. Sets the length of the \s-1MAC\s0 in the associated \s-1KDF\s0 ctx.
  321. .ie n .IP """properties"" (\fB\s-1OSSL_KDF_PARAM_PROPERTIES\s0\fR) <\s-1UTF8\s0 string>" 4
  322. .el .IP "``properties'' (\fB\s-1OSSL_KDF_PARAM_PROPERTIES\s0\fR) <\s-1UTF8\s0 string>" 4
  323. .IX Item "properties (OSSL_KDF_PARAM_PROPERTIES) <UTF8 string>"
  324. Sets the properties to be queried when trying to fetch the underlying algorithm.
  325. This must be given together with the algorithm naming parameter to be
  326. considered valid.
  327. .ie n .IP """iter"" (\fB\s-1OSSL_KDF_PARAM_ITER\s0\fR) <unsigned integer>" 4
  328. .el .IP "``iter'' (\fB\s-1OSSL_KDF_PARAM_ITER\s0\fR) <unsigned integer>" 4
  329. .IX Item "iter (OSSL_KDF_PARAM_ITER) <unsigned integer>"
  330. Sets the number of iterations in the associated \s-1KDF\s0 ctx.
  331. .ie n .IP """mode"" (\fB\s-1OSSL_KDF_PARAM_MODE\s0\fR) <\s-1UTF8\s0 string>" 4
  332. .el .IP "``mode'' (\fB\s-1OSSL_KDF_PARAM_MODE\s0\fR) <\s-1UTF8\s0 string>" 4
  333. .IX Item "mode (OSSL_KDF_PARAM_MODE) <UTF8 string>"
  334. Sets the mode in the associated \s-1KDF\s0 ctx.
  335. .ie n .IP """pkcs5"" (\fB\s-1OSSL_KDF_PARAM_PKCS5\s0\fR) <integer>" 4
  336. .el .IP "``pkcs5'' (\fB\s-1OSSL_KDF_PARAM_PKCS5\s0\fR) <integer>" 4
  337. .IX Item "pkcs5 (OSSL_KDF_PARAM_PKCS5) <integer>"
  338. Enables or disables the \s-1SP800\-132\s0 compliance checks.
  339. A mode of 0 enables the compliance checks.
  340. .Sp
  341. The checks performed are:
  342. .RS 4
  343. .IP "\- the iteration count is at least 1000." 4
  344. .IX Item "- the iteration count is at least 1000."
  345. .PD 0
  346. .IP "\- the salt length is at least 128 bits." 4
  347. .IX Item "- the salt length is at least 128 bits."
  348. .IP "\- the derived key length is at least 112 bits." 4
  349. .IX Item "- the derived key length is at least 112 bits."
  350. .RE
  351. .RS 4
  352. .RE
  353. .ie n .IP """ukm"" (\fB\s-1OSSL_KDF_PARAM_UKM\s0\fR) <octet string>" 4
  354. .el .IP "``ukm'' (\fB\s-1OSSL_KDF_PARAM_UKM\s0\fR) <octet string>" 4
  355. .IX Item "ukm (OSSL_KDF_PARAM_UKM) <octet string>"
  356. .PD
  357. Sets an optional random string that is provided by the sender called
  358. \&\*(L"partyAInfo\*(R". In \s-1CMS\s0 this is the user keying material.
  359. .ie n .IP """cekalg"" (\fB\s-1OSSL_KDF_PARAM_CEK_ALG\s0\fR) <\s-1UTF8\s0 string>" 4
  360. .el .IP "``cekalg'' (\fB\s-1OSSL_KDF_PARAM_CEK_ALG\s0\fR) <\s-1UTF8\s0 string>" 4
  361. .IX Item "cekalg (OSSL_KDF_PARAM_CEK_ALG) <UTF8 string>"
  362. Sets the \s-1CEK\s0 wrapping algorithm name in the associated \s-1KDF\s0 ctx.
  363. .ie n .IP """n"" (\fB\s-1OSSL_KDF_PARAM_SCRYPT_N\s0\fR) <unsigned integer>" 4
  364. .el .IP "``n'' (\fB\s-1OSSL_KDF_PARAM_SCRYPT_N\s0\fR) <unsigned integer>" 4
  365. .IX Item "n (OSSL_KDF_PARAM_SCRYPT_N) <unsigned integer>"
  366. Sets the scrypt work factor parameter N in the associated \s-1KDF\s0 ctx.
  367. .ie n .IP """r"" (\fB\s-1OSSL_KDF_PARAM_SCRYPT_R\s0\fR) <unsigned integer>" 4
  368. .el .IP "``r'' (\fB\s-1OSSL_KDF_PARAM_SCRYPT_R\s0\fR) <unsigned integer>" 4
  369. .IX Item "r (OSSL_KDF_PARAM_SCRYPT_R) <unsigned integer>"
  370. Sets the scrypt work factor parameter r in the associated \s-1KDF\s0 ctx.
  371. .ie n .IP """p"" (\fB\s-1OSSL_KDF_PARAM_SCRYPT_P\s0\fR) <unsigned integer>" 4
  372. .el .IP "``p'' (\fB\s-1OSSL_KDF_PARAM_SCRYPT_P\s0\fR) <unsigned integer>" 4
  373. .IX Item "p (OSSL_KDF_PARAM_SCRYPT_P) <unsigned integer>"
  374. Sets the scrypt work factor parameter p in the associated \s-1KDF\s0 ctx.
  375. .ie n .IP """maxmem_bytes"" (\fB\s-1OSSL_KDF_PARAM_SCRYPT_MAXMEM\s0\fR) <unsigned integer>" 4
  376. .el .IP "``maxmem_bytes'' (\fB\s-1OSSL_KDF_PARAM_SCRYPT_MAXMEM\s0\fR) <unsigned integer>" 4
  377. .IX Item "maxmem_bytes (OSSL_KDF_PARAM_SCRYPT_MAXMEM) <unsigned integer>"
  378. Sets the scrypt work factor parameter maxmem in the associated \s-1KDF\s0 ctx.
  379. .ie n .IP """prefix"" (\fB\s-1OSSL_KDF_PARAM_PREFIX\s0\fR) <octet string>" 4
  380. .el .IP "``prefix'' (\fB\s-1OSSL_KDF_PARAM_PREFIX\s0\fR) <octet string>" 4
  381. .IX Item "prefix (OSSL_KDF_PARAM_PREFIX) <octet string>"
  382. Sets the prefix string using by the \s-1TLS 1.3\s0 version of \s-1HKDF\s0 in the
  383. associated \s-1KDF\s0 ctx.
  384. .ie n .IP """label"" (\fB\s-1OSSL_KDF_PARAM_LABEL\s0\fR) <octet string>" 4
  385. .el .IP "``label'' (\fB\s-1OSSL_KDF_PARAM_LABEL\s0\fR) <octet string>" 4
  386. .IX Item "label (OSSL_KDF_PARAM_LABEL) <octet string>"
  387. Sets the label string using by the \s-1TLS 1.3\s0 version of \s-1HKDF\s0 in the
  388. associated \s-1KDF\s0 ctx.
  389. .ie n .IP """data"" (\fB\s-1OSSL_KDF_PARAM_DATA\s0\fR) <octet string>" 4
  390. .el .IP "``data'' (\fB\s-1OSSL_KDF_PARAM_DATA\s0\fR) <octet string>" 4
  391. .IX Item "data (OSSL_KDF_PARAM_DATA) <octet string>"
  392. Sets the context string using by the \s-1TLS 1.3\s0 version of \s-1HKDF\s0 in the
  393. associated \s-1KDF\s0 ctx.
  394. .ie n .IP """info"" (\fB\s-1OSSL_KDF_PARAM_INFO\s0\fR) <octet string>" 4
  395. .el .IP "``info'' (\fB\s-1OSSL_KDF_PARAM_INFO\s0\fR) <octet string>" 4
  396. .IX Item "info (OSSL_KDF_PARAM_INFO) <octet string>"
  397. Sets the optional shared info in the associated \s-1KDF\s0 ctx.
  398. .ie n .IP """seed"" (\fB\s-1OSSL_KDF_PARAM_SEED\s0\fR) <octet string>" 4
  399. .el .IP "``seed'' (\fB\s-1OSSL_KDF_PARAM_SEED\s0\fR) <octet string>" 4
  400. .IX Item "seed (OSSL_KDF_PARAM_SEED) <octet string>"
  401. Sets the \s-1IV\s0 in the associated \s-1KDF\s0 ctx.
  402. .ie n .IP """xcghash"" (\fB\s-1OSSL_KDF_PARAM_SSHKDF_XCGHASH\s0\fR) <octet string>" 4
  403. .el .IP "``xcghash'' (\fB\s-1OSSL_KDF_PARAM_SSHKDF_XCGHASH\s0\fR) <octet string>" 4
  404. .IX Item "xcghash (OSSL_KDF_PARAM_SSHKDF_XCGHASH) <octet string>"
  405. Sets the xcghash in the associated \s-1KDF\s0 ctx.
  406. .ie n .IP """session_id"" (\fB\s-1OSSL_KDF_PARAM_SSHKDF_SESSION_ID\s0\fR) <octet string>" 4
  407. .el .IP "``session_id'' (\fB\s-1OSSL_KDF_PARAM_SSHKDF_SESSION_ID\s0\fR) <octet string>" 4
  408. .IX Item "session_id (OSSL_KDF_PARAM_SSHKDF_SESSION_ID) <octet string>"
  409. Sets the session \s-1ID\s0 in the associated \s-1KDF\s0 ctx.
  410. .ie n .IP """type"" (\fB\s-1OSSL_KDF_PARAM_SSHKDF_TYPE\s0\fR) <\s-1UTF8\s0 string>" 4
  411. .el .IP "``type'' (\fB\s-1OSSL_KDF_PARAM_SSHKDF_TYPE\s0\fR) <\s-1UTF8\s0 string>" 4
  412. .IX Item "type (OSSL_KDF_PARAM_SSHKDF_TYPE) <UTF8 string>"
  413. Sets the \s-1SSH KDF\s0 type parameter in the associated \s-1KDF\s0 ctx.
  414. There are six supported types:
  415. .RS 4
  416. .IP "\s-1EVP_KDF_SSHKDF_TYPE_INITIAL_IV_CLI_TO_SRV\s0" 4
  417. .IX Item "EVP_KDF_SSHKDF_TYPE_INITIAL_IV_CLI_TO_SRV"
  418. The Initial \s-1IV\s0 from client to server.
  419. A single char of value 65 (\s-1ASCII\s0 char 'A').
  420. .IP "\s-1EVP_KDF_SSHKDF_TYPE_INITIAL_IV_SRV_TO_CLI\s0" 4
  421. .IX Item "EVP_KDF_SSHKDF_TYPE_INITIAL_IV_SRV_TO_CLI"
  422. The Initial \s-1IV\s0 from server to client
  423. A single char of value 66 (\s-1ASCII\s0 char 'B').
  424. .IP "\s-1EVP_KDF_SSHKDF_TYPE_ENCRYPTION_KEY_CLI_TO_SRV\s0" 4
  425. .IX Item "EVP_KDF_SSHKDF_TYPE_ENCRYPTION_KEY_CLI_TO_SRV"
  426. The Encryption Key from client to server
  427. A single char of value 67 (\s-1ASCII\s0 char 'C').
  428. .IP "\s-1EVP_KDF_SSHKDF_TYPE_ENCRYPTION_KEY_SRV_TO_CLI\s0" 4
  429. .IX Item "EVP_KDF_SSHKDF_TYPE_ENCRYPTION_KEY_SRV_TO_CLI"
  430. The Encryption Key from server to client
  431. A single char of value 68 (\s-1ASCII\s0 char 'D').
  432. .IP "\s-1EVP_KDF_SSHKDF_TYPE_INTEGRITY_KEY_CLI_TO_SRV\s0" 4
  433. .IX Item "EVP_KDF_SSHKDF_TYPE_INTEGRITY_KEY_CLI_TO_SRV"
  434. The Integrity Key from client to server
  435. A single char of value 69 (\s-1ASCII\s0 char 'E').
  436. .IP "\s-1EVP_KDF_SSHKDF_TYPE_INTEGRITY_KEY_SRV_TO_CLI\s0" 4
  437. .IX Item "EVP_KDF_SSHKDF_TYPE_INTEGRITY_KEY_SRV_TO_CLI"
  438. The Integrity Key from client to server
  439. A single char of value 70 (\s-1ASCII\s0 char 'F').
  440. .RE
  441. .RS 4
  442. .RE
  443. .ie n .IP """constant"" (\fB\s-1OSSL_KDF_PARAM_CONSTANT\s0\fR) <octet string>" 4
  444. .el .IP "``constant'' (\fB\s-1OSSL_KDF_PARAM_CONSTANT\s0\fR) <octet string>" 4
  445. .IX Item "constant (OSSL_KDF_PARAM_CONSTANT) <octet string>"
  446. Sets the constant value in the associated \s-1KDF\s0 ctx.
  447. .ie n .IP """id"" (\fB\s-1OSSL_KDF_PARAM_PKCS12_ID\s0\fR) <integer>" 4
  448. .el .IP "``id'' (\fB\s-1OSSL_KDF_PARAM_PKCS12_ID\s0\fR) <integer>" 4
  449. .IX Item "id (OSSL_KDF_PARAM_PKCS12_ID) <integer>"
  450. Sets the intended usage of the output bits in the associated \s-1KDF\s0 ctx.
  451. It is defined as per \s-1RFC 7292\s0 section B.3.
  452. .SH "RETURN VALUES"
  453. .IX Header "RETURN VALUES"
  454. \&\fBOSSL_FUNC_kdf_newctx()\fR and \fBOSSL_FUNC_kdf_dupctx()\fR should return the newly created
  455. provider side \s-1KDF\s0 context, or \s-1NULL\s0 on failure.
  456. .PP
  457. \&\fBOSSL_FUNC_kdf_derive()\fR, \fBOSSL_FUNC_kdf_get_params()\fR,
  458. \&\fBOSSL_FUNC_kdf_get_ctx_params()\fR and \fBOSSL_FUNC_kdf_set_ctx_params()\fR should return 1 for
  459. success or 0 on error.
  460. .PP
  461. \&\fBOSSL_FUNC_kdf_gettable_params()\fR, \fBOSSL_FUNC_kdf_gettable_ctx_params()\fR and
  462. \&\fBOSSL_FUNC_kdf_settable_ctx_params()\fR should return a constant \s-1\fBOSSL_PARAM\s0\fR\|(3)
  463. array, or \s-1NULL\s0 if none is offered.
  464. .SH "NOTES"
  465. .IX Header "NOTES"
  466. The \s-1KDF\s0 life-cycle is described in \fBlife_cycle\-kdf\fR\|(7). Providers should
  467. ensure that the various transitions listed there are supported. At some point
  468. the \s-1EVP\s0 layer will begin enforcing the listed transitions.
  469. .SH "SEE ALSO"
  470. .IX Header "SEE ALSO"
  471. \&\fBprovider\fR\|(7), \fBlife_cycle\-kdf\fR\|(7), \s-1\fBEVP_KDF\s0\fR\|(3).
  472. .SH "HISTORY"
  473. .IX Header "HISTORY"
  474. The provider \s-1KDF\s0 interface was introduced in OpenSSL 3.0.
  475. .SH "COPYRIGHT"
  476. .IX Header "COPYRIGHT"
  477. Copyright 2020\-2022 The OpenSSL Project Authors. All Rights Reserved.
  478. .PP
  479. Licensed under the Apache License 2.0 (the \*(L"License\*(R"). You may not use
  480. this file except in compliance with the License. You can obtain a copy
  481. in the file \s-1LICENSE\s0 in the source distribution or at
  482. <https://www.openssl.org/source/license.html>.