EVP_KDF-X963.7ossl 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  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-X963 7ossl"
  58. .TH EVP_KDF-X963 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\-X963 \- The X9.63\-2001 EVP_KDF implementation
  65. .SH DESCRIPTION
  66. .IX Header "DESCRIPTION"
  67. The EVP_KDF\-X963 algorithm implements the key derivation function (X963KDF).
  68. X963KDF is used by Cryptographic Message Syntax (CMS) for EC KeyAgreement, to
  69. derive a key using input such as a shared secret key and shared info.
  70. .PP
  71. The output is considered to be keying material.
  72. .SS Identity
  73. .IX Subsection "Identity"
  74. "X963KDF" is the name for this implementation; it
  75. can be used with the \fBEVP_KDF_fetch()\fR function.
  76. .SS "Supported parameters"
  77. .IX Subsection "Supported parameters"
  78. The supported parameters are:
  79. .IP """properties"" (\fBOSSL_KDF_PARAM_PROPERTIES\fR) <UTF8 string>" 4
  80. .IX Item """properties"" (OSSL_KDF_PARAM_PROPERTIES) <UTF8 string>"
  81. .PD 0
  82. .IP """digest"" (\fBOSSL_KDF_PARAM_DIGEST\fR) <UTF8 string>" 4
  83. .IX Item """digest"" (OSSL_KDF_PARAM_DIGEST) <UTF8 string>"
  84. .PD
  85. These parameters work as described in "PARAMETERS" in \fBEVP_KDF\fR\|(3).
  86. .IP """key"" (\fBOSSL_KDF_PARAM_KEY\fR) <octet string>" 4
  87. .IX Item """key"" (OSSL_KDF_PARAM_KEY) <octet string>"
  88. The shared secret used for key derivation.
  89. This parameter sets the secret.
  90. .IP """info"" (\fBOSSL_KDF_PARAM_INFO\fR) <octet string>" 4
  91. .IX Item """info"" (OSSL_KDF_PARAM_INFO) <octet string>"
  92. This parameter specifies an optional value for shared info.
  93. .PP
  94. The OpenSSL FIPS provider also supports the following parameters:
  95. .IP """fips-indicator"" (\fBOSSL_KDF_PARAM_FIPS_APPROVED_INDICATOR\fR) <integer>" 4
  96. .IX Item """fips-indicator"" (OSSL_KDF_PARAM_FIPS_APPROVED_INDICATOR) <integer>"
  97. A getter that returns 1 if the operation is FIPS approved, or 0 otherwise.
  98. This may be used after calling EVP_KDF_derive. It returns 0 if any "***\-check"
  99. related parameter is set to 0 and the check fails.
  100. .IP """digest-check"" (\fBOSSL_KDF_PARAM_FIPS_DIGEST_CHECK\fR) <int>" 4
  101. .IX Item """digest-check"" (OSSL_KDF_PARAM_FIPS_DIGEST_CHECK) <int>"
  102. The default value of 1 causes an error during \fBEVP_KDF_CTX_set_params()\fR if
  103. used digest is not approved.
  104. Setting this to zero will ignore the error and set the approved
  105. "fips-indicator" to 0.
  106. This option breaks FIPS compliance if it causes the approved "fips-indicator"
  107. to return 0.
  108. .Sp
  109. According to ANSI X9.63\-2001, the following are approved digest algorithms:
  110. SHA2\-224, SHA2\-256, SHA2\-384, SHA2\-512, SHA2\-512/224, SHA2\-512/256, SHA3\-224,
  111. SHA3\-256, SHA3\-384, SHA3\-512.
  112. .IP """key-check"" (\fBOSSL_KDF_PARAM_FIPS_KEY_CHECK\fR) <integer>" 4
  113. .IX Item """key-check"" (OSSL_KDF_PARAM_FIPS_KEY_CHECK) <integer>"
  114. The default value of 1 causes an error during \fBEVP_KDF_CTX_set_params()\fR if the
  115. length of used key-derivation key (\fBOSSL_KDF_PARAM_KEY\fR) is shorter than 112
  116. bits.
  117. Setting this to zero will ignore the error and set the approved
  118. "fips-indicator" to 0.
  119. This option breaks FIPS compliance if it causes the approved "fips-indicator"
  120. to return 0.
  121. .SH NOTES
  122. .IX Header "NOTES"
  123. X963KDF is very similar to the SSKDF that uses a digest as the auxiliary function,
  124. X963KDF appends the counter to the secret, whereas SSKDF prepends the counter.
  125. .PP
  126. A context for X963KDF can be obtained by calling:
  127. .PP
  128. .Vb 2
  129. \& EVP_KDF *kdf = EVP_KDF_fetch(NULL, "X963KDF", NULL);
  130. \& EVP_KDF_CTX *kctx = EVP_KDF_CTX_new(kdf);
  131. .Ve
  132. .PP
  133. The output length of an X963KDF is specified via the \fIkeylen\fR
  134. parameter to the \fBEVP_KDF_derive\fR\|(3) function.
  135. .SH EXAMPLES
  136. .IX Header "EXAMPLES"
  137. This example derives 10 bytes, with the secret key "secret" and sharedinfo
  138. value "label":
  139. .PP
  140. .Vb 4
  141. \& EVP_KDF *kdf;
  142. \& EVP_KDF_CTX *kctx;
  143. \& unsigned char out[10];
  144. \& OSSL_PARAM params[4], *p = params;
  145. \&
  146. \& kdf = EVP_KDF_fetch(NULL, "X963KDF", NULL);
  147. \& kctx = EVP_KDF_CTX_new(kdf);
  148. \& EVP_KDF_free(kdf);
  149. \&
  150. \& *p++ = OSSL_PARAM_construct_utf8_string(OSSL_KDF_PARAM_DIGEST,
  151. \& SN_sha256, strlen(SN_sha256));
  152. \& *p++ = OSSL_PARAM_construct_octet_string(OSSL_KDF_PARAM_SECRET,
  153. \& "secret", (size_t)6);
  154. \& *p++ = OSSL_PARAM_construct_octet_string(OSSL_KDF_PARAM_INFO,
  155. \& "label", (size_t)5);
  156. \& *p = OSSL_PARAM_construct_end();
  157. \& if (EVP_KDF_derive(kctx, out, sizeof(out), params) <= 0) {
  158. \& error("EVP_KDF_derive");
  159. \& }
  160. \&
  161. \& EVP_KDF_CTX_free(kctx);
  162. .Ve
  163. .SH "CONFORMING TO"
  164. .IX Header "CONFORMING TO"
  165. "SEC 1: Elliptic Curve Cryptography"
  166. .SH "SEE ALSO"
  167. .IX Header "SEE ALSO"
  168. \&\fBEVP_KDF\fR\|(3),
  169. \&\fBEVP_KDF_CTX_new\fR\|(3),
  170. \&\fBEVP_KDF_CTX_free\fR\|(3),
  171. \&\fBEVP_KDF_CTX_set_params\fR\|(3),
  172. \&\fBEVP_KDF_CTX_get_kdf_size\fR\|(3),
  173. \&\fBEVP_KDF_derive\fR\|(3),
  174. "PARAMETERS" in \fBEVP_KDF\fR\|(3)
  175. .SH HISTORY
  176. .IX Header "HISTORY"
  177. This functionality was added in OpenSSL 3.0.
  178. .SH COPYRIGHT
  179. .IX Header "COPYRIGHT"
  180. Copyright 2019\-2024 The OpenSSL Project Authors. All Rights Reserved.
  181. .PP
  182. Licensed under the Apache License 2.0 (the "License"). You may not use
  183. this file except in compliance with the License. You can obtain a copy
  184. in the file LICENSE in the source distribution or at
  185. <https://www.openssl.org/source/license.html>.