EVP_KDF-TLS13_KDF.7ossl 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  1. .\" -*- mode: troff; coding: utf-8 -*-
  2. .\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43)
  3. .\"
  4. .\" Standard preamble:
  5. .\" ========================================================================
  6. .de Sp \" Vertical space (when we can't use .PP)
  7. .if t .sp .5v
  8. .if n .sp
  9. ..
  10. .de Vb \" Begin verbatim text
  11. .ft CW
  12. .nf
  13. .ne \\$1
  14. ..
  15. .de Ve \" End verbatim text
  16. .ft R
  17. .fi
  18. ..
  19. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>.
  20. .ie n \{\
  21. . ds C` ""
  22. . ds C' ""
  23. 'br\}
  24. .el\{\
  25. . ds C`
  26. . ds C'
  27. 'br\}
  28. .\"
  29. .\" Escape single quotes in literal strings from groff's Unicode transform.
  30. .ie \n(.g .ds Aq \(aq
  31. .el .ds Aq '
  32. .\"
  33. .\" If the F register is >0, we'll generate index entries on stderr for
  34. .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
  35. .\" entries marked with X<> in POD. Of course, you'll have to process the
  36. .\" output yourself in some meaningful fashion.
  37. .\"
  38. .\" Avoid warning from groff about undefined register 'F'.
  39. .de IX
  40. ..
  41. .nr rF 0
  42. .if \n(.g .if rF .nr rF 1
  43. .if (\n(rF:(\n(.g==0)) \{\
  44. . if \nF \{\
  45. . de IX
  46. . tm Index:\\$1\t\\n%\t"\\$2"
  47. ..
  48. . if !\nF==2 \{\
  49. . nr % 0
  50. . nr F 2
  51. . \}
  52. . \}
  53. .\}
  54. .rr rF
  55. .\" ========================================================================
  56. .\"
  57. .IX Title "EVP_KDF-TLS13_KDF 7ossl"
  58. .TH EVP_KDF-TLS13_KDF 7ossl 2025-01-17 3.4.0 OpenSSL
  59. .\" For nroff, turn off justification. Always turn off hyphenation; it makes
  60. .\" way too many mistakes in technical documents.
  61. .if n .ad l
  62. .nh
  63. .SH NAME
  64. EVP_KDF\-TLS13_KDF \- The TLS 1.3 EVP_KDF implementation
  65. .SH DESCRIPTION
  66. .IX Header "DESCRIPTION"
  67. Support for computing the TLS 1.3 version of the \fBHKDF\fR KDF through
  68. the \fBEVP_KDF\fR API.
  69. .PP
  70. The EVP_KDF\-TLS13_KDF algorithm implements the HKDF key derivation function
  71. as used by TLS 1.3.
  72. .PP
  73. The output is considered to be keying material.
  74. .SS Identity
  75. .IX Subsection "Identity"
  76. "TLS13\-KDF" is the name for this implementation; it
  77. can be used with the \fBEVP_KDF_fetch()\fR function.
  78. .SS "Supported parameters"
  79. .IX Subsection "Supported parameters"
  80. The supported parameters are:
  81. .IP """properties"" (\fBOSSL_KDF_PARAM_PROPERTIES\fR) <UTF8 string>" 4
  82. .IX Item """properties"" (OSSL_KDF_PARAM_PROPERTIES) <UTF8 string>"
  83. .PD 0
  84. .IP """digest"" (\fBOSSL_KDF_PARAM_DIGEST\fR) <UTF8 string>" 4
  85. .IX Item """digest"" (OSSL_KDF_PARAM_DIGEST) <UTF8 string>"
  86. .IP """key"" (\fBOSSL_KDF_PARAM_KEY\fR) <octet string>" 4
  87. .IX Item """key"" (OSSL_KDF_PARAM_KEY) <octet string>"
  88. .IP """salt"" (\fBOSSL_KDF_PARAM_SALT\fR) <octet string>" 4
  89. .IX Item """salt"" (OSSL_KDF_PARAM_SALT) <octet string>"
  90. .PD
  91. These parameters work as described in "PARAMETERS" in \fBEVP_KDF\fR\|(3).
  92. .IP """prefix"" (\fBOSSL_KDF_PARAM_PREFIX\fR) <octet string>" 4
  93. .IX Item """prefix"" (OSSL_KDF_PARAM_PREFIX) <octet string>"
  94. This parameter sets the label prefix on the specified TLS 1.3 KDF context.
  95. For TLS 1.3 this should be set to the ASCII string "tls13 " without a
  96. trailing zero byte. Refer to RFC 8446 section 7.1 "Key Schedule" for details.
  97. .IP """label"" (\fBOSSL_KDF_PARAM_LABEL\fR) <octet string>" 4
  98. .IX Item """label"" (OSSL_KDF_PARAM_LABEL) <octet string>"
  99. This parameter sets the label on the specified TLS 1.3 KDF context.
  100. Refer to RFC 8446 section 7.1 "Key Schedule" for details.
  101. .IP """data"" (\fBOSSL_KDF_PARAM_DATA\fR) <octet string>" 4
  102. .IX Item """data"" (OSSL_KDF_PARAM_DATA) <octet string>"
  103. This parameter sets the context data on the specified TLS 1.3 KDF context.
  104. Refer to RFC 8446 section 7.1 "Key Schedule" for details.
  105. .IP """mode"" (\fBOSSL_KDF_PARAM_MODE\fR) <UTF8 string> or <integer>" 4
  106. .IX Item """mode"" (OSSL_KDF_PARAM_MODE) <UTF8 string> or <integer>"
  107. This parameter sets the mode for the TLS 1.3 KDF operation.
  108. There are two modes that are currently defined:
  109. .RS 4
  110. .IP """EXTRACT_ONLY"" or \fBEVP_KDF_HKDF_MODE_EXTRACT_ONLY\fR" 4
  111. .IX Item """EXTRACT_ONLY"" or EVP_KDF_HKDF_MODE_EXTRACT_ONLY"
  112. In this mode calling \fBEVP_KDF_derive\fR\|(3) will just perform the extract
  113. operation. The value returned will be the intermediate fixed-length pseudorandom
  114. key K. The \fIkeylen\fR parameter must match the size of K, which can be looked
  115. up by calling \fBEVP_KDF_CTX_get_kdf_size()\fR after setting the mode and digest.
  116. .Sp
  117. The digest, key and salt values must be set before a key is derived otherwise
  118. an error will occur.
  119. .IP """EXPAND_ONLY"" or \fBEVP_KDF_HKDF_MODE_EXPAND_ONLY\fR" 4
  120. .IX Item """EXPAND_ONLY"" or EVP_KDF_HKDF_MODE_EXPAND_ONLY"
  121. In this mode calling \fBEVP_KDF_derive\fR\|(3) will just perform the expand
  122. operation. The input key should be set to the intermediate fixed-length
  123. pseudorandom key K returned from a previous extract operation.
  124. .Sp
  125. The digest, key and info values must be set before a key is derived otherwise
  126. an error will occur.
  127. .RE
  128. .RS 4
  129. .RE
  130. .PP
  131. The OpenSSL FIPS provider also supports the following parameters:
  132. .IP """fips-indicator"" (\fBOSSL_KDF_PARAM_FIPS_APPROVED_INDICATOR\fR) <integer>" 4
  133. .IX Item """fips-indicator"" (OSSL_KDF_PARAM_FIPS_APPROVED_INDICATOR) <integer>"
  134. A getter that returns 1 if the operation is FIPS approved, or 0 otherwise.
  135. This may be used after calling EVP_KDF_derive. It returns 0 if any "***\-check"
  136. related parameter is set to 0 and the check fails.
  137. .IP """digest-check"" (\fBOSSL_KDF_PARAM_FIPS_DIGEST_CHECK\fR) <integer>" 4
  138. .IX Item """digest-check"" (OSSL_KDF_PARAM_FIPS_DIGEST_CHECK) <integer>"
  139. The default value of 1 causes an error during \fBEVP_KDF_CTX_set_params()\fR if
  140. used digest is not approved.
  141. Setting this to zero will ignore the error and set the approved
  142. "fips-indicator" to 0.
  143. This option breaks FIPS compliance if it causes the approved "fips-indicator"
  144. to return 0.
  145. .Sp
  146. According to RFC 8446, the following are approved digest algorithms: SHA2\-256,
  147. SHA2\-384.
  148. .IP """key-check"" (\fBOSSL_KDF_PARAM_FIPS_KEY_CHECK\fR) <integer>" 4
  149. .IX Item """key-check"" (OSSL_KDF_PARAM_FIPS_KEY_CHECK) <integer>"
  150. The default value of 1 causes an error during \fBEVP_KDF_CTX_set_params()\fR if the
  151. length of used key-derivation key (\fBOSSL_KDF_PARAM_KEY\fR) is shorter than 112
  152. bits.
  153. Setting this to zero will ignore the error and set the approved
  154. "fips-indicator" to 0.
  155. This option breaks FIPS compliance if it causes the approved "fips-indicator"
  156. to return 0.
  157. .SH NOTES
  158. .IX Header "NOTES"
  159. This KDF is intended for use by the TLS 1.3 implementation in libssl.
  160. It does not support all the options and capabilities that HKDF does.
  161. .PP
  162. The \fIOSSL_PARAM\fR array passed to \fBEVP_KDF_derive\fR\|(3) or
  163. \&\fBEVP_KDF_CTX_set_params\fR\|(3) must specify all of the parameters required.
  164. This KDF does not support a piecemeal approach to providing these.
  165. .PP
  166. A context for a TLS 1.3 KDF can be obtained by calling:
  167. .PP
  168. .Vb 2
  169. \& EVP_KDF *kdf = EVP_KDF_fetch(NULL, "TLS13\-KDF", NULL);
  170. \& EVP_KDF_CTX *kctx = EVP_KDF_CTX_new(kdf);
  171. .Ve
  172. .PP
  173. The output length of a TLS 1.3 KDF expand operation is specified via the
  174. \&\fIkeylen\fR parameter to the \fBEVP_KDF_derive\fR\|(3) function. When using
  175. EVP_KDF_HKDF_MODE_EXTRACT_ONLY the \fIkeylen\fR parameter must equal the size of
  176. the intermediate fixed-length pseudorandom key otherwise an error will occur.
  177. For that mode, the fixed output size can be looked up by calling
  178. \&\fBEVP_KDF_CTX_get_kdf_size()\fR after setting the mode and digest on the
  179. \&\fBEVP_KDF_CTX\fR.
  180. .SH "CONFORMING TO"
  181. .IX Header "CONFORMING TO"
  182. RFC 8446
  183. .SH "SEE ALSO"
  184. .IX Header "SEE ALSO"
  185. \&\fBEVP_KDF\fR\|(3),
  186. \&\fBEVP_KDF_CTX_new\fR\|(3),
  187. \&\fBEVP_KDF_CTX_free\fR\|(3),
  188. \&\fBEVP_KDF_CTX_get_kdf_size\fR\|(3),
  189. \&\fBEVP_KDF_CTX_set_params\fR\|(3),
  190. \&\fBEVP_KDF_derive\fR\|(3),
  191. "PARAMETERS" in \fBEVP_KDF\fR\|(3),
  192. \&\fBEVP_KDF\-HKDF\fR\|(7)
  193. .SH HISTORY
  194. .IX Header "HISTORY"
  195. This functionality was added in OpenSSL 3.0.
  196. .SH COPYRIGHT
  197. .IX Header "COPYRIGHT"
  198. Copyright 2021\-2024 The OpenSSL Project Authors. All Rights Reserved.
  199. .PP
  200. Licensed under the Apache License 2.0 (the "License"). You may not use
  201. this file except in compliance with the License. You can obtain a copy
  202. in the file LICENSE in the source distribution or at
  203. <https://www.openssl.org/source/license.html>.