EVP_KDF.3ossl 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439
  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 "EVP_KDF 3ossl"
  136. .TH EVP_KDF 3ossl "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. EVP_KDF, EVP_KDF_fetch, EVP_KDF_free, EVP_KDF_up_ref,
  143. EVP_KDF_CTX, EVP_KDF_CTX_new, EVP_KDF_CTX_free, EVP_KDF_CTX_dup,
  144. EVP_KDF_CTX_reset, EVP_KDF_derive,
  145. EVP_KDF_CTX_get_kdf_size,
  146. EVP_KDF_get0_provider, EVP_KDF_CTX_kdf, EVP_KDF_is_a,
  147. EVP_KDF_get0_name, EVP_KDF_names_do_all, EVP_KDF_get0_description,
  148. EVP_KDF_CTX_get_params, EVP_KDF_CTX_set_params, EVP_KDF_do_all_provided,
  149. EVP_KDF_get_params, EVP_KDF_gettable_params,
  150. EVP_KDF_gettable_ctx_params, EVP_KDF_settable_ctx_params,
  151. EVP_KDF_CTX_gettable_params, EVP_KDF_CTX_settable_params \- EVP KDF routines
  152. .SH "SYNOPSIS"
  153. .IX Header "SYNOPSIS"
  154. .Vb 1
  155. \& #include <openssl/kdf.h>
  156. \&
  157. \& typedef struct evp_kdf_st EVP_KDF;
  158. \& typedef struct evp_kdf_ctx_st EVP_KDF_CTX;
  159. \&
  160. \& EVP_KDF_CTX *EVP_KDF_CTX_new(EVP_KDF *kdf);
  161. \& const EVP_KDF *EVP_KDF_CTX_kdf(EVP_KDF_CTX *ctx);
  162. \& void EVP_KDF_CTX_free(EVP_KDF_CTX *ctx);
  163. \& EVP_KDF_CTX *EVP_KDF_CTX_dup(const EVP_KDF_CTX *src);
  164. \& void EVP_KDF_CTX_reset(EVP_KDF_CTX *ctx);
  165. \& size_t EVP_KDF_CTX_get_kdf_size(EVP_KDF_CTX *ctx);
  166. \& int EVP_KDF_derive(EVP_KDF_CTX *ctx, unsigned char *key, size_t keylen,
  167. \& const OSSL_PARAM params[]);
  168. \& int EVP_KDF_up_ref(EVP_KDF *kdf);
  169. \& void EVP_KDF_free(EVP_KDF *kdf);
  170. \& EVP_KDF *EVP_KDF_fetch(OSSL_LIB_CTX *libctx, const char *algorithm,
  171. \& const char *properties);
  172. \& int EVP_KDF_is_a(const EVP_KDF *kdf, const char *name);
  173. \& const char *EVP_KDF_get0_name(const EVP_KDF *kdf);
  174. \& const char *EVP_KDF_get0_description(const EVP_KDF *kdf);
  175. \& const OSSL_PROVIDER *EVP_KDF_get0_provider(const EVP_KDF *kdf);
  176. \& void EVP_KDF_do_all_provided(OSSL_LIB_CTX *libctx,
  177. \& void (*fn)(EVP_KDF *kdf, void *arg),
  178. \& void *arg);
  179. \& int EVP_KDF_names_do_all(const EVP_KDF *kdf,
  180. \& void (*fn)(const char *name, void *data),
  181. \& void *data);
  182. \& int EVP_KDF_get_params(EVP_KDF *kdf, OSSL_PARAM params[]);
  183. \& int EVP_KDF_CTX_get_params(EVP_KDF_CTX *ctx, OSSL_PARAM params[]);
  184. \& int EVP_KDF_CTX_set_params(EVP_KDF_CTX *ctx, const OSSL_PARAM params[]);
  185. \& const OSSL_PARAM *EVP_KDF_gettable_params(const EVP_KDF *kdf);
  186. \& const OSSL_PARAM *EVP_KDF_gettable_ctx_params(const EVP_KDF *kdf);
  187. \& const OSSL_PARAM *EVP_KDF_settable_ctx_params(const EVP_KDF *kdf);
  188. \& const OSSL_PARAM *EVP_KDF_CTX_gettable_params(const EVP_KDF *kdf);
  189. \& const OSSL_PARAM *EVP_KDF_CTX_settable_params(const EVP_KDF *kdf);
  190. \& const OSSL_PROVIDER *EVP_KDF_get0_provider(const EVP_KDF *kdf);
  191. .Ve
  192. .SH "DESCRIPTION"
  193. .IX Header "DESCRIPTION"
  194. The \s-1EVP KDF\s0 routines are a high-level interface to Key Derivation Function
  195. algorithms and should be used instead of algorithm-specific functions.
  196. .PP
  197. After creating a \fB\s-1EVP_KDF_CTX\s0\fR for the required algorithm using
  198. \&\fBEVP_KDF_CTX_new()\fR, inputs to the algorithm are supplied either by
  199. passing them as part of the \fBEVP_KDF_derive()\fR call or using calls
  200. to \fBEVP_KDF_CTX_set_params()\fR before calling \fBEVP_KDF_derive()\fR to derive
  201. the key.
  202. .SS "Types"
  203. .IX Subsection "Types"
  204. \&\fB\s-1EVP_KDF\s0\fR is a type that holds the implementation of a \s-1KDF.\s0
  205. .PP
  206. \&\fB\s-1EVP_KDF_CTX\s0\fR is a context type that holds the algorithm inputs.
  207. .SS "Algorithm implementation fetching"
  208. .IX Subsection "Algorithm implementation fetching"
  209. \&\fBEVP_KDF_fetch()\fR fetches an implementation of a \s-1KDF\s0 \fIalgorithm\fR, given
  210. a library context \fIlibctx\fR and a set of \fIproperties\fR.
  211. See \*(L"\s-1ALGORITHM FETCHING\*(R"\s0 in \fBcrypto\fR\|(7) for further information.
  212. .PP
  213. See \*(L"Key Derivation Function (\s-1KDF\s0)\*(R" in \fBOSSL_PROVIDER\-default\fR\|(7) for the lists of
  214. algorithms supported by the default provider.
  215. .PP
  216. The returned value must eventually be freed with
  217. \&\fBEVP_KDF_free\fR\|(3).
  218. .PP
  219. \&\fBEVP_KDF_up_ref()\fR increments the reference count of an already fetched
  220. \&\s-1KDF.\s0
  221. .PP
  222. \&\fBEVP_KDF_free()\fR frees a fetched algorithm.
  223. \&\s-1NULL\s0 is a valid parameter, for which this function is a no-op.
  224. .SS "Context manipulation functions"
  225. .IX Subsection "Context manipulation functions"
  226. \&\fBEVP_KDF_CTX_new()\fR creates a new context for the \s-1KDF\s0 implementation \fIkdf\fR.
  227. .PP
  228. \&\fBEVP_KDF_CTX_free()\fR frees up the context \fIctx\fR. If \fIctx\fR is \s-1NULL,\s0 nothing
  229. is done.
  230. .PP
  231. \&\fBEVP_KDF_CTX_kdf()\fR returns the \fB\s-1EVP_KDF\s0\fR associated with the context
  232. \&\fIctx\fR.
  233. .SS "Computing functions"
  234. .IX Subsection "Computing functions"
  235. \&\fBEVP_KDF_CTX_reset()\fR resets the context to the default state as if the context
  236. had just been created.
  237. .PP
  238. \&\fBEVP_KDF_derive()\fR processes any parameters in \fIParams\fR and then derives
  239. \&\fIkeylen\fR bytes of key material and places it in the \fIkey\fR buffer.
  240. If the algorithm produces a fixed amount of output then an error will
  241. occur unless the \fIkeylen\fR parameter is equal to that output size,
  242. as returned by \fBEVP_KDF_CTX_get_kdf_size()\fR.
  243. .PP
  244. \&\fBEVP_KDF_get_params()\fR retrieves details about the implementation
  245. \&\fIkdf\fR.
  246. The set of parameters given with \fIparams\fR determine exactly what
  247. parameters should be retrieved.
  248. Note that a parameter that is unknown in the underlying context is
  249. simply ignored.
  250. .PP
  251. \&\fBEVP_KDF_CTX_get_params()\fR retrieves chosen parameters, given the
  252. context \fIctx\fR and its underlying context.
  253. The set of parameters given with \fIparams\fR determine exactly what
  254. parameters should be retrieved.
  255. Note that a parameter that is unknown in the underlying context is
  256. simply ignored.
  257. .PP
  258. \&\fBEVP_KDF_CTX_set_params()\fR passes chosen parameters to the underlying
  259. context, given a context \fIctx\fR.
  260. The set of parameters given with \fIparams\fR determine exactly what
  261. parameters are passed down.
  262. Note that a parameter that is unknown in the underlying context is
  263. simply ignored.
  264. Also, what happens when a needed parameter isn't passed down is
  265. defined by the implementation.
  266. .PP
  267. \&\fBEVP_KDF_gettable_params()\fR returns an \s-1\fBOSSL_PARAM\s0\fR\|(3) array that describes
  268. the retrievable and settable parameters. \fBEVP_KDF_gettable_params()\fR
  269. returns parameters that can be used with \fBEVP_KDF_get_params()\fR.
  270. .PP
  271. \&\fBEVP_KDF_gettable_ctx_params()\fR and \fBEVP_KDF_CTX_gettable_params()\fR
  272. return constant \s-1\fBOSSL_PARAM\s0\fR\|(3) arrays that describe the retrievable
  273. parameters that can be used with \fBEVP_KDF_CTX_get_params()\fR.
  274. \&\fBEVP_KDF_gettable_ctx_params()\fR returns the parameters that can be retrieved
  275. from the algorithm, whereas \fBEVP_KDF_CTX_gettable_params()\fR returns
  276. the parameters that can be retrieved in the context's current state.
  277. .PP
  278. \&\fBEVP_KDF_settable_ctx_params()\fR and \fBEVP_KDF_CTX_settable_params()\fR return
  279. constant \s-1\fBOSSL_PARAM\s0\fR\|(3) arrays that describe the settable parameters that
  280. can be used with \fBEVP_KDF_CTX_set_params()\fR. \fBEVP_KDF_settable_ctx_params()\fR
  281. returns the parameters that can be retrieved from the algorithm,
  282. whereas \fBEVP_KDF_CTX_settable_params()\fR returns the parameters that can
  283. be retrieved in the context's current state.
  284. .SS "Information functions"
  285. .IX Subsection "Information functions"
  286. \&\fBEVP_KDF_CTX_get_kdf_size()\fR returns the output size if the algorithm produces a fixed amount
  287. of output and \fB\s-1SIZE_MAX\s0\fR otherwise. If an error occurs then 0 is returned.
  288. For some algorithms an error may result if input parameters necessary to
  289. calculate a fixed output size have not yet been supplied.
  290. .PP
  291. \&\fBEVP_KDF_is_a()\fR returns 1 if \fIkdf\fR is an implementation of an
  292. algorithm that's identifiable with \fIname\fR, otherwise 0.
  293. .PP
  294. \&\fBEVP_KDF_get0_provider()\fR returns the provider that holds the implementation
  295. of the given \fIkdf\fR.
  296. .PP
  297. \&\fBEVP_KDF_do_all_provided()\fR traverses all \s-1KDF\s0 implemented by all activated
  298. providers in the given library context \fIlibctx\fR, and for each of the
  299. implementations, calls the given function \fIfn\fR with the implementation method
  300. and the given \fIarg\fR as argument.
  301. .PP
  302. \&\fBEVP_KDF_get0_name()\fR return the name of the given \s-1KDF.\s0 For fetched KDFs
  303. with multiple names, only one of them is returned; it's
  304. recommended to use \fBEVP_KDF_names_do_all()\fR instead.
  305. .PP
  306. \&\fBEVP_KDF_names_do_all()\fR traverses all names for \fIkdf\fR, and calls
  307. \&\fIfn\fR with each name and \fIdata\fR.
  308. .PP
  309. \&\fBEVP_KDF_get0_description()\fR returns a description of the \fIkdf\fR, meant for
  310. display and human consumption. The description is at the discretion of
  311. the \fIkdf\fR implementation.
  312. .SH "PARAMETERS"
  313. .IX Header "PARAMETERS"
  314. The standard parameter names are:
  315. .ie n .IP """pass"" (\fB\s-1OSSL_KDF_PARAM_PASSWORD\s0\fR) <octet string>" 4
  316. .el .IP "``pass'' (\fB\s-1OSSL_KDF_PARAM_PASSWORD\s0\fR) <octet string>" 4
  317. .IX Item "pass (OSSL_KDF_PARAM_PASSWORD) <octet string>"
  318. Some \s-1KDF\s0 implementations require a password.
  319. For those \s-1KDF\s0 implementations that support it, this parameter sets the password.
  320. .ie n .IP """salt"" (\fB\s-1OSSL_KDF_PARAM_SALT\s0\fR) <octet string>" 4
  321. .el .IP "``salt'' (\fB\s-1OSSL_KDF_PARAM_SALT\s0\fR) <octet string>" 4
  322. .IX Item "salt (OSSL_KDF_PARAM_SALT) <octet string>"
  323. Some \s-1KDF\s0 implementations can take a non-secret unique cryptographic salt.
  324. For those \s-1KDF\s0 implementations that support it, this parameter sets the salt.
  325. .Sp
  326. The default value, if any, is implementation dependent.
  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. Some \s-1KDF\s0 implementations require an iteration count.
  331. For those \s-1KDF\s0 implementations that support it, this parameter sets the
  332. iteration count.
  333. .Sp
  334. The default value, if any, is implementation dependent.
  335. .ie n .IP """properties"" (\fB\s-1OSSL_KDF_PARAM_PROPERTIES\s0\fR) <\s-1UTF8\s0 string>" 4
  336. .el .IP "``properties'' (\fB\s-1OSSL_KDF_PARAM_PROPERTIES\s0\fR) <\s-1UTF8\s0 string>" 4
  337. .IX Item "properties (OSSL_KDF_PARAM_PROPERTIES) <UTF8 string>"
  338. .PD 0
  339. .ie n .IP """mac"" (\fB\s-1OSSL_KDF_PARAM_MAC\s0\fR) <\s-1UTF8\s0 string>" 4
  340. .el .IP "``mac'' (\fB\s-1OSSL_KDF_PARAM_MAC\s0\fR) <\s-1UTF8\s0 string>" 4
  341. .IX Item "mac (OSSL_KDF_PARAM_MAC) <UTF8 string>"
  342. .ie n .IP """digest"" (\fB\s-1OSSL_KDF_PARAM_DIGEST\s0\fR) <\s-1UTF8\s0 string>" 4
  343. .el .IP "``digest'' (\fB\s-1OSSL_KDF_PARAM_DIGEST\s0\fR) <\s-1UTF8\s0 string>" 4
  344. .IX Item "digest (OSSL_KDF_PARAM_DIGEST) <UTF8 string>"
  345. .ie n .IP """cipher"" (\fB\s-1OSSL_KDF_PARAM_CIPHER\s0\fR) <\s-1UTF8\s0 string>" 4
  346. .el .IP "``cipher'' (\fB\s-1OSSL_KDF_PARAM_CIPHER\s0\fR) <\s-1UTF8\s0 string>" 4
  347. .IX Item "cipher (OSSL_KDF_PARAM_CIPHER) <UTF8 string>"
  348. .PD
  349. For \s-1KDF\s0 implementations that use an underlying computation \s-1MAC,\s0 digest or
  350. cipher, these parameters set what the algorithm should be.
  351. .Sp
  352. The value is always the name of the intended algorithm,
  353. or the properties.
  354. .Sp
  355. Note that not all algorithms may support all possible underlying
  356. implementations.
  357. .ie n .IP """key"" (\fB\s-1OSSL_KDF_PARAM_KEY\s0\fR) <octet string>" 4
  358. .el .IP "``key'' (\fB\s-1OSSL_KDF_PARAM_KEY\s0\fR) <octet string>" 4
  359. .IX Item "key (OSSL_KDF_PARAM_KEY) <octet string>"
  360. Some \s-1KDF\s0 implementations require a key.
  361. For those \s-1KDF\s0 implementations that support it, this octet string parameter
  362. sets the key.
  363. .ie n .IP """info"" (\fB\s-1OSSL_KDF_PARAM_INFO\s0\fR) <octet string>" 4
  364. .el .IP "``info'' (\fB\s-1OSSL_KDF_PARAM_INFO\s0\fR) <octet string>" 4
  365. .IX Item "info (OSSL_KDF_PARAM_INFO) <octet string>"
  366. Some \s-1KDF\s0 implementations, such as \s-1\fBEVP_KDF\-HKDF\s0\fR\|(7), take an 'info' parameter
  367. for binding the derived key material
  368. to application\- and context-specific information.
  369. This parameter sets the info, fixed info, other info or shared info argument.
  370. You can specify this parameter multiple times, and each instance will
  371. be concatenated to form the final value.
  372. .ie n .IP """maclen"" (\fB\s-1OSSL_KDF_PARAM_MAC_SIZE\s0\fR) <unsigned integer>" 4
  373. .el .IP "``maclen'' (\fB\s-1OSSL_KDF_PARAM_MAC_SIZE\s0\fR) <unsigned integer>" 4
  374. .IX Item "maclen (OSSL_KDF_PARAM_MAC_SIZE) <unsigned integer>"
  375. Used by implementations that use a \s-1MAC\s0 with a variable output size (\s-1KMAC\s0).
  376. For those \s-1KDF\s0 implementations that support it, this parameter
  377. sets the \s-1MAC\s0 output size.
  378. .Sp
  379. The default value, if any, is implementation dependent.
  380. The length must never exceed what can be given with a \fBsize_t\fR.
  381. .ie n .IP """maxmem_bytes"" (\fB\s-1OSSL_KDF_PARAM_SCRYPT_MAXMEM\s0\fR) <unsigned integer>" 4
  382. .el .IP "``maxmem_bytes'' (\fB\s-1OSSL_KDF_PARAM_SCRYPT_MAXMEM\s0\fR) <unsigned integer>" 4
  383. .IX Item "maxmem_bytes (OSSL_KDF_PARAM_SCRYPT_MAXMEM) <unsigned integer>"
  384. Memory-hard password-based \s-1KDF\s0 algorithms, such as scrypt, use an amount of
  385. memory that depends on the load factors provided as input.
  386. For those \s-1KDF\s0 implementations that support it, this \fBuint64_t\fR parameter sets
  387. an upper limit on the amount of memory that may be consumed while performing
  388. a key derivation.
  389. If this memory usage limit is exceeded because the load factors are chosen
  390. too high, the key derivation will fail.
  391. .Sp
  392. The default value is implementation dependent.
  393. The memory size must never exceed what can be given with a \fBsize_t\fR.
  394. .SH "RETURN VALUES"
  395. .IX Header "RETURN VALUES"
  396. \&\fBEVP_KDF_fetch()\fR returns a pointer to a newly fetched \fB\s-1EVP_KDF\s0\fR, or
  397. \&\s-1NULL\s0 if allocation failed.
  398. .PP
  399. \&\fBEVP_KDF_get0_provider()\fR returns a pointer to the provider for the \s-1KDF,\s0 or
  400. \&\s-1NULL\s0 on error.
  401. .PP
  402. \&\fBEVP_KDF_up_ref()\fR returns 1 on success, 0 on error.
  403. .PP
  404. \&\fBEVP_KDF_CTX_new()\fR returns either the newly allocated
  405. \&\fB\s-1EVP_KDF_CTX\s0\fR structure or \s-1NULL\s0 if an error occurred.
  406. .PP
  407. \&\fBEVP_KDF_CTX_free()\fR and \fBEVP_KDF_CTX_reset()\fR do not return a value.
  408. .PP
  409. \&\fBEVP_KDF_CTX_get_kdf_size()\fR returns the output size. \fB\s-1SIZE_MAX\s0\fR is returned to indicate
  410. that the algorithm produces a variable amount of output; 0 to indicate failure.
  411. .PP
  412. \&\fBEVP_KDF_get0_name()\fR returns the name of the \s-1KDF,\s0 or \s-1NULL\s0 on error.
  413. .PP
  414. \&\fBEVP_KDF_names_do_all()\fR returns 1 if the callback was called for all names. A
  415. return value of 0 means that the callback was not called for any names.
  416. .PP
  417. The remaining functions return 1 for success and 0 or a negative value for
  418. failure. In particular, a return value of \-2 indicates the operation is not
  419. supported by the \s-1KDF\s0 algorithm.
  420. .SH "NOTES"
  421. .IX Header "NOTES"
  422. The \s-1KDF\s0 life-cycle is described in \fBlife_cycle\-kdf\fR\|(7). In the future,
  423. the transitions described there will be enforced. When this is done, it will
  424. not be considered a breaking change to the \s-1API.\s0
  425. .SH "SEE ALSO"
  426. .IX Header "SEE ALSO"
  427. \&\*(L"Key Derivation Function (\s-1KDF\s0)\*(R" in \fBOSSL_PROVIDER\-default\fR\|(7),
  428. \&\fBlife_cycle\-kdf\fR\|(7).
  429. .SH "HISTORY"
  430. .IX Header "HISTORY"
  431. This functionality was added in OpenSSL 3.0.
  432. .SH "COPYRIGHT"
  433. .IX Header "COPYRIGHT"
  434. Copyright 2019\-2024 The OpenSSL Project Authors. All Rights Reserved.
  435. .PP
  436. Licensed under the Apache License 2.0 (the \*(L"License\*(R"). You may not use
  437. this file except in compliance with the License. You can obtain a copy
  438. in the file \s-1LICENSE\s0 in the source distribution or at
  439. <https://www.openssl.org/source/license.html>.