EVP_KDF-TLS1_PRF.7ossl 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  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-TLS1_PRF 7ossl"
  58. .TH EVP_KDF-TLS1_PRF 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\-TLS1_PRF \- The TLS1 PRF EVP_KDF implementation
  65. .SH DESCRIPTION
  66. .IX Header "DESCRIPTION"
  67. Support for computing the \fBTLS1\fR PRF through the \fBEVP_KDF\fR API.
  68. .PP
  69. The EVP_KDF\-TLS1_PRF algorithm implements the PRF used by TLS versions up to
  70. and including TLS 1.2.
  71. .PP
  72. The output is considered to be keying material.
  73. .SS Identity
  74. .IX Subsection "Identity"
  75. "TLS1\-PRF" is the name for this implementation; it
  76. can be used with the \fBEVP_KDF_fetch()\fR function.
  77. .SS "Supported parameters"
  78. .IX Subsection "Supported parameters"
  79. The supported parameters are:
  80. .IP """properties"" (\fBOSSL_KDF_PARAM_PROPERTIES\fR) <UTF8 string>" 4
  81. .IX Item """properties"" (OSSL_KDF_PARAM_PROPERTIES) <UTF8 string>"
  82. .PD 0
  83. .IP """digest"" (\fBOSSL_KDF_PARAM_DIGEST\fR) <UTF8 string>" 4
  84. .IX Item """digest"" (OSSL_KDF_PARAM_DIGEST) <UTF8 string>"
  85. .PD
  86. These parameters work as described in "PARAMETERS" in \fBEVP_KDF\fR\|(3).
  87. .Sp
  88. The \fBOSSL_KDF_PARAM_DIGEST\fR parameter is used to set the message digest
  89. associated with the TLS PRF.
  90. \&\fBEVP_md5_sha1()\fR is treated as a special case which uses the
  91. PRF algorithm using both \fBMD5\fR and \fBSHA1\fR as used in TLS 1.0 and 1.1.
  92. .IP """secret"" (\fBOSSL_KDF_PARAM_SECRET\fR) <octet string>" 4
  93. .IX Item """secret"" (OSSL_KDF_PARAM_SECRET) <octet string>"
  94. This parameter sets the secret value of the TLS PRF.
  95. Any existing secret value is replaced.
  96. .IP """seed"" (\fBOSSL_KDF_PARAM_SEED\fR) <octet string>" 4
  97. .IX Item """seed"" (OSSL_KDF_PARAM_SEED) <octet string>"
  98. This parameter sets the context seed.
  99. The length of the context seed cannot exceed 1024 bytes;
  100. this should be more than enough for any normal use of the TLS PRF.
  101. .PP
  102. The OpenSSL FIPS provider also supports the following parameters:
  103. .IP """fips-indicator"" (\fBOSSL_KDF_PARAM_FIPS_APPROVED_INDICATOR\fR) <integer>" 4
  104. .IX Item """fips-indicator"" (OSSL_KDF_PARAM_FIPS_APPROVED_INDICATOR) <integer>"
  105. A getter that returns 1 if the operation is FIPS approved, or 0 otherwise.
  106. This may be used after calling EVP_KDF_derive. It returns 0 if any "***\-check"
  107. related parameter is set to 0 and the check fails.
  108. .IP """ems_check"" (\fBOSSL_KDF_PARAM_FIPS_EMS_CHECK\fR) <integer>" 4
  109. .IX Item """ems_check"" (OSSL_KDF_PARAM_FIPS_EMS_CHECK) <integer>"
  110. The default value of 1 causes an error during \fBEVP_KDF_derive()\fR if
  111. "master secret" is used instead of "extended master secret" Setting this to zero
  112. will ignore the error and set the approved "fips-indicator" to 0.
  113. This option breaks FIPS compliance if it causes the approved "fips-indicator"
  114. to return 0.
  115. .IP """digest-check"" (\fBOSSL_KDF_PARAM_FIPS_DIGEST_CHECK\fR) <integer>" 4
  116. .IX Item """digest-check"" (OSSL_KDF_PARAM_FIPS_DIGEST_CHECK) <integer>"
  117. The default value of 1 causes an error during \fBEVP_KDF_CTX_set_params()\fR if
  118. used digest is not approved.
  119. Setting this to zero will ignore the error and set the approved
  120. "fips-indicator" to 0.
  121. This option breaks FIPS compliance if it causes the approved "fips-indicator"
  122. to return 0.
  123. .Sp
  124. According to SP 800\-135r1, the following are approved digest algorithms:
  125. SHA2\-256, SHA2\-384, SHA2\-512.
  126. .IP """key-check"" (\fBOSSL_KDF_PARAM_FIPS_KEY_CHECK\fR) <integer>" 4
  127. .IX Item """key-check"" (OSSL_KDF_PARAM_FIPS_KEY_CHECK) <integer>"
  128. The default value of 1 causes an error during \fBEVP_KDF_CTX_set_params()\fR if the
  129. length of used key-derivation key (\fBOSSL_KDF_PARAM_SECRET\fR) is shorter than 112
  130. bits.
  131. Setting this to zero will ignore the error and set the approved
  132. "fips-indicator" to 0.
  133. This option breaks FIPS compliance if it causes the approved "fips-indicator"
  134. to return 0.
  135. .SH NOTES
  136. .IX Header "NOTES"
  137. A context for the TLS PRF can be obtained by calling:
  138. .PP
  139. .Vb 2
  140. \& EVP_KDF *kdf = EVP_KDF_fetch(NULL, "TLS1\-PRF", NULL);
  141. \& EVP_KDF_CTX *kctx = EVP_KDF_CTX_new(kdf);
  142. .Ve
  143. .PP
  144. The digest, secret value and seed must be set before a key is derived otherwise
  145. an error will occur.
  146. .PP
  147. The output length of the PRF is specified by the \fIkeylen\fR parameter to the
  148. \&\fBEVP_KDF_derive()\fR function.
  149. .SH EXAMPLES
  150. .IX Header "EXAMPLES"
  151. This example derives 10 bytes using SHA\-256 with the secret key "secret"
  152. and seed value "seed":
  153. .PP
  154. .Vb 4
  155. \& EVP_KDF *kdf;
  156. \& EVP_KDF_CTX *kctx;
  157. \& unsigned char out[10];
  158. \& OSSL_PARAM params[4], *p = params;
  159. \&
  160. \& kdf = EVP_KDF_fetch(NULL, "TLS1\-PRF", NULL);
  161. \& kctx = EVP_KDF_CTX_new(kdf);
  162. \& EVP_KDF_free(kdf);
  163. \&
  164. \& *p++ = OSSL_PARAM_construct_utf8_string(OSSL_KDF_PARAM_DIGEST,
  165. \& SN_sha256, strlen(SN_sha256));
  166. \& *p++ = OSSL_PARAM_construct_octet_string(OSSL_KDF_PARAM_SECRET,
  167. \& "secret", (size_t)6);
  168. \& *p++ = OSSL_PARAM_construct_octet_string(OSSL_KDF_PARAM_SEED,
  169. \& "seed", (size_t)4);
  170. \& *p = OSSL_PARAM_construct_end();
  171. \& if (EVP_KDF_derive(kctx, out, sizeof(out), params) <= 0) {
  172. \& error("EVP_KDF_derive");
  173. \& }
  174. \& EVP_KDF_CTX_free(kctx);
  175. .Ve
  176. .SH "CONFORMING TO"
  177. .IX Header "CONFORMING TO"
  178. RFC 2246, RFC 5246 and NIST SP 800\-135 r1
  179. .SH "SEE ALSO"
  180. .IX Header "SEE ALSO"
  181. \&\fBEVP_KDF\fR\|(3),
  182. \&\fBEVP_KDF_CTX_new\fR\|(3),
  183. \&\fBEVP_KDF_CTX_free\fR\|(3),
  184. \&\fBEVP_KDF_CTX_set_params\fR\|(3),
  185. \&\fBEVP_KDF_derive\fR\|(3),
  186. "PARAMETERS" in \fBEVP_KDF\fR\|(3)
  187. .SH HISTORY
  188. .IX Header "HISTORY"
  189. This functionality was added in OpenSSL 3.0.
  190. .SH COPYRIGHT
  191. .IX Header "COPYRIGHT"
  192. Copyright 2018\-2024 The OpenSSL Project Authors. All Rights Reserved.
  193. .PP
  194. Licensed under the Apache License 2.0 (the "License"). You may not use
  195. this file except in compliance with the License. You can obtain a copy
  196. in the file LICENSE in the source distribution or at
  197. <https://www.openssl.org/source/license.html>.