Debian Codegraph @

upstream/debian-unstable/man7/EVP_KDF-SS.7ssl

raw
1 .\" -*- mode: troff; coding: utf-8 -*-
2 .\" Automatically generated by Pod::Man 5.0102 (Pod::Simple 3.45)
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-SS 7SSL"
58 .TH EVP_KDF-SS 7SSL 2026-04-07 3.6.2 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\-SS \- The Single Step / One Step EVP_KDF implementation
65 .SH DESCRIPTION
66 .IX Header "DESCRIPTION"
67 The EVP_KDF\-SS algorithm implements the Single Step key derivation function (SSKDF).
68 SSKDF derives a key using input such as a shared secret key (that was generated
69 during the execution of a key establishment scheme) and fixedinfo.
70 SSKDF is also informally referred to as 'Concat KDF'.
71 .PP
72 The output is considered to be keying material.
73 .SS "Auxiliary function"
74 .IX Subsection "Auxiliary function"
75 The implementation uses a selectable auxiliary function H, which can be one of:
76 .IP "\fBH(x) = hash(x, digest=md)\fR" 4
77 .IX Item "H(x) = hash(x, digest=md)"
78 .PD 0
79 .IP "\fBH(x) = HMAC_hash(x, key=salt, digest=md)\fR" 4
80 .IX Item "H(x) = HMAC_hash(x, key=salt, digest=md)"
81 .IP "\fBH(x) = KMACxxx(x, key=salt, custom=""KDF"", outlen=mac_size)\fR" 4
82 .IX Item "H(x) = KMACxxx(x, key=salt, custom=""KDF"", outlen=mac_size)"
83 .PD
84 .PP
85 Both the HMAC and KMAC implementations set the key using the 'salt' value.
86 The hash and HMAC also require the digest to be set.
87 .SS Identity
88 .IX Subsection "Identity"
89 "SSKDF" is the name for this implementation; it
90 can be used with the \fBEVP_KDF_fetch()\fR function.
91 .SS "Supported parameters"
92 .IX Subsection "Supported parameters"
93 The supported parameters are:
94 .IP """properties"" (\fBOSSL_KDF_PARAM_PROPERTIES\fR) <UTF8 string>" 4
95 .IX Item """properties"" (OSSL_KDF_PARAM_PROPERTIES) <UTF8 string>"
96 .PD 0
97 .IP """digest"" (\fBOSSL_KDF_PARAM_DIGEST\fR) <UTF8 string>" 4
98 .IX Item """digest"" (OSSL_KDF_PARAM_DIGEST) <UTF8 string>"
99 .PD
100 This parameter is ignored for KMAC.
101 .IP """mac"" (\fBOSSL_KDF_PARAM_MAC\fR) <UTF8 string>" 4
102 .IX Item """mac"" (OSSL_KDF_PARAM_MAC) <UTF8 string>"
103 .PD 0
104 .IP """maclen"" (\fBOSSL_KDF_PARAM_MAC_SIZE\fR) <unsigned integer>" 4
105 .IX Item """maclen"" (OSSL_KDF_PARAM_MAC_SIZE) <unsigned integer>"
106 .IP """salt"" (\fBOSSL_KDF_PARAM_SALT\fR) <octet string>" 4
107 .IX Item """salt"" (OSSL_KDF_PARAM_SALT) <octet string>"
108 .PD
109 These parameters work as described in "PARAMETERS" in \fBEVP_KDF\fR\|(3).
110 .IP """key"" (\fBOSSL_KDF_PARAM_SECRET\fR) <octet string>" 4
111 .IX Item """key"" (OSSL_KDF_PARAM_SECRET) <octet string>"
112 This parameter set the shared secret that is used for key derivation.
113 .IP """info"" (\fBOSSL_KDF_PARAM_INFO\fR) <octet string>" 4
114 .IX Item """info"" (OSSL_KDF_PARAM_INFO) <octet string>"
115 This parameter sets an optional value for fixedinfo, also known as otherinfo.
116 .PP
117 The OpenSSL FIPS provider also supports the following parameters:
118 .IP """fips-indicator"" (\fBOSSL_KDF_PARAM_FIPS_APPROVED_INDICATOR\fR) <integer>" 4
119 .IX Item """fips-indicator"" (OSSL_KDF_PARAM_FIPS_APPROVED_INDICATOR) <integer>"
120 A getter that returns 1 if the operation is FIPS approved, or 0 otherwise.
121 This may be used after calling EVP_KDF_derive. It returns 0 if "key-check"
122 is set to 0 and the check fails.
123 .IP """key-check"" (\fBOSSL_KDF_PARAM_FIPS_KEY_CHECK\fR) <integer>" 4
124 .IX Item """key-check"" (OSSL_KDF_PARAM_FIPS_KEY_CHECK) <integer>"
125 The default value of 1 causes an error during \fBEVP_KDF_CTX_set_params()\fR if the
126 length of used key-derivation key (\fBOSSL_KDF_PARAM_KEY\fR) is shorter than 112
127 bits.
128 Setting this to zero will ignore the error and set the approved
129 "fips-indicator" to 0.
130 This option breaks FIPS compliance if it causes the approved "fips-indicator"
131 to return 0.
132 .SH NOTES
133 .IX Header "NOTES"
134 A context for SSKDF can be obtained by calling:
135 .PP
136 .Vb 2
137 \& EVP_KDF *kdf = EVP_KDF_fetch(NULL, "SSKDF", NULL);
138 \& EVP_KDF_CTX *kctx = EVP_KDF_CTX_new(kdf);
139 .Ve
140 .PP
141 The output length of an SSKDF is specified via the \fIkeylen\fR
142 parameter to the \fBEVP_KDF_derive\fR\|(3) function.
143 .SH EXAMPLES
144 .IX Header "EXAMPLES"
145 This example derives 10 bytes using H(x) = SHA\-256, with the secret key "secret"
146 and fixedinfo value "label":
147 .PP
148 .Vb 4
149 \& EVP_KDF *kdf;
150 \& EVP_KDF_CTX *kctx;
151 \& unsigned char out[10];
152 \& OSSL_PARAM params[4], *p = params;
153 \&
154 \& kdf = EVP_KDF_fetch(NULL, "SSKDF", NULL);
155 \& kctx = EVP_KDF_CTX_new(kdf);
156 \& EVP_KDF_free(kdf);
157 \&
158 \& *p++ = OSSL_PARAM_construct_utf8_string(OSSL_KDF_PARAM_DIGEST,
159 \& SN_sha256, strlen(SN_sha256));
160 \& *p++ = OSSL_PARAM_construct_octet_string(OSSL_KDF_PARAM_KEY,
161 \& "secret", (size_t)6);
162 \& *p++ = OSSL_PARAM_construct_octet_string(OSSL_KDF_PARAM_INFO,
163 \& "label", (size_t)5);
164 \& *p = OSSL_PARAM_construct_end();
165 \& if (EVP_KDF_derive(kctx, out, sizeof(out), params) <= 0) {
166 \& error("EVP_KDF_derive");
167 \& }
168 \&
169 \& EVP_KDF_CTX_free(kctx);
170 .Ve
171 .PP
172 This example derives 10 bytes using H(x) = HMAC(SHA\-256), with the secret key "secret",
173 fixedinfo value "label" and salt "salt":
174 .PP
175 .Vb 4
176 \& EVP_KDF *kdf;
177 \& EVP_KDF_CTX *kctx;
178 \& unsigned char out[10];
179 \& OSSL_PARAM params[6], *p = params;
180 \&
181 \& kdf = EVP_KDF_fetch(NULL, "SSKDF", NULL);
182 \& kctx = EVP_KDF_CTX_new(kdf);
183 \& EVP_KDF_free(kdf);
184 \&
185 \& *p++ = OSSL_PARAM_construct_utf8_string(OSSL_KDF_PARAM_MAC,
186 \& SN_hmac, strlen(SN_hmac));
187 \& *p++ = OSSL_PARAM_construct_utf8_string(OSSL_KDF_PARAM_DIGEST,
188 \& SN_sha256, strlen(SN_sha256));
189 \& *p++ = OSSL_PARAM_construct_octet_string(OSSL_KDF_PARAM_SECRET,
190 \& "secret", (size_t)6);
191 \& *p++ = OSSL_PARAM_construct_octet_string(OSSL_KDF_PARAM_INFO,
192 \& "label", (size_t)5);
193 \& *p++ = OSSL_PARAM_construct_octet_string(OSSL_KDF_PARAM_SALT,
194 \& "salt", (size_t)4);
195 \& *p = OSSL_PARAM_construct_end();
196 \& if (EVP_KDF_derive(kctx, out, sizeof(out), params) <= 0) {
197 \& error("EVP_KDF_derive");
198 \& }
199 \&
200 \& EVP_KDF_CTX_free(kctx);
201 .Ve
202 .PP
203 This example derives 10 bytes using H(x) = KMAC128(x,salt,outlen), with the secret key "secret"
204 fixedinfo value "label", salt of "salt" and KMAC outlen of 20:
205 .PP
206 .Vb 4
207 \& EVP_KDF *kdf;
208 \& EVP_KDF_CTX *kctx;
209 \& unsigned char out[10];
210 \& OSSL_PARAM params[6], *p = params;
211 \&
212 \& kdf = EVP_KDF_fetch(NULL, "SSKDF", NULL);
213 \& kctx = EVP_KDF_CTX_new(kdf);
214 \& EVP_KDF_free(kdf);
215 \&
216 \& *p++ = OSSL_PARAM_construct_utf8_string(OSSL_KDF_PARAM_MAC,
217 \& SN_kmac128, strlen(SN_kmac128));
218 \& *p++ = OSSL_PARAM_construct_octet_string(OSSL_KDF_PARAM_SECRET,
219 \& "secret", (size_t)6);
220 \& *p++ = OSSL_PARAM_construct_octet_string(OSSL_KDF_PARAM_INFO,
221 \& "label", (size_t)5);
222 \& *p++ = OSSL_PARAM_construct_octet_string(OSSL_KDF_PARAM_SALT,
223 \& "salt", (size_t)4);
224 \& *p++ = OSSL_PARAM_construct_size_t(OSSL_KDF_PARAM_MAC_SIZE, (size_t)20);
225 \& *p = OSSL_PARAM_construct_end();
226 \& if (EVP_KDF_derive(kctx, out, sizeof(out), params) <= 0) {
227 \& error("EVP_KDF_derive");
228 \& }
229 \&
230 \& EVP_KDF_CTX_free(kctx);
231 .Ve
232 .SH "CONFORMING TO"
233 .IX Header "CONFORMING TO"
234 NIST SP800\-56Cr1.
235 .SH "SEE ALSO"
236 .IX Header "SEE ALSO"
237 \&\fBEVP_KDF\fR\|(3),
238 \&\fBEVP_KDF_CTX_new\fR\|(3),
239 \&\fBEVP_KDF_CTX_free\fR\|(3),
240 \&\fBEVP_KDF_CTX_set_params\fR\|(3),
241 \&\fBEVP_KDF_CTX_get_kdf_size\fR\|(3),
242 \&\fBEVP_KDF_derive\fR\|(3),
243 "PARAMETERS" in \fBEVP_KDF\fR\|(3)
244 .SH HISTORY
245 .IX Header "HISTORY"
246 This functionality was added in OpenSSL 3.0.
247 .SH COPYRIGHT
248 .IX Header "COPYRIGHT"
249 Copyright 2019\-2024 The OpenSSL Project Authors. All Rights Reserved. Copyright
250 (c) 2019, Oracle and/or its affiliates. All rights reserved.
251 .PP
252 Licensed under the Apache License 2.0 (the "License"). You may not use
253 this file except in compliance with the License. You can obtain a copy
254 in the file LICENSE in the source distribution or at
255 <https://www.openssl.org/source/license.html>.