1EVP_PKEY_CTX_CTRL(3)                OpenSSL               EVP_PKEY_CTX_CTRL(3)
2
3
4

NAME

6       EVP_PKEY_CTX_ctrl, EVP_PKEY_CTX_ctrl_str, EVP_PKEY_CTX_ctrl_uint64,
7       EVP_PKEY_CTX_md, EVP_PKEY_CTX_set_signature_md,
8       EVP_PKEY_CTX_get_signature_md, EVP_PKEY_CTX_set_mac_key,
9       EVP_PKEY_CTX_set_rsa_padding, EVP_PKEY_CTX_get_rsa_padding,
10       EVP_PKEY_CTX_set_rsa_pss_saltlen, EVP_PKEY_CTX_get_rsa_pss_saltlen,
11       EVP_PKEY_CTX_set_rsa_keygen_bits, EVP_PKEY_CTX_set_rsa_keygen_pubexp,
12       EVP_PKEY_CTX_set_rsa_keygen_primes, EVP_PKEY_CTX_set_rsa_mgf1_md,
13       EVP_PKEY_CTX_get_rsa_mgf1_md, EVP_PKEY_CTX_set_rsa_oaep_md,
14       EVP_PKEY_CTX_get_rsa_oaep_md, EVP_PKEY_CTX_set0_rsa_oaep_label,
15       EVP_PKEY_CTX_get0_rsa_oaep_label, EVP_PKEY_CTX_set_dsa_paramgen_bits,
16       EVP_PKEY_CTX_set_dh_paramgen_prime_len,
17       EVP_PKEY_CTX_set_dh_paramgen_subprime_len,
18       EVP_PKEY_CTX_set_dh_paramgen_generator,
19       EVP_PKEY_CTX_set_dh_paramgen_type, EVP_PKEY_CTX_set_dh_rfc5114,
20       EVP_PKEY_CTX_set_dhx_rfc5114, EVP_PKEY_CTX_set_dh_pad,
21       EVP_PKEY_CTX_set_dh_nid, EVP_PKEY_CTX_set_dh_kdf_type,
22       EVP_PKEY_CTX_get_dh_kdf_type, EVP_PKEY_CTX_set0_dh_kdf_oid,
23       EVP_PKEY_CTX_get0_dh_kdf_oid, EVP_PKEY_CTX_set_dh_kdf_md,
24       EVP_PKEY_CTX_get_dh_kdf_md, EVP_PKEY_CTX_set_dh_kdf_outlen,
25       EVP_PKEY_CTX_get_dh_kdf_outlen, EVP_PKEY_CTX_set0_dh_kdf_ukm,
26       EVP_PKEY_CTX_get0_dh_kdf_ukm, EVP_PKEY_CTX_set_ec_paramgen_curve_nid,
27       EVP_PKEY_CTX_set_ec_param_enc, EVP_PKEY_CTX_set_ecdh_cofactor_mode,
28       EVP_PKEY_CTX_get_ecdh_cofactor_mode, EVP_PKEY_CTX_set_ecdh_kdf_type,
29       EVP_PKEY_CTX_get_ecdh_kdf_type, EVP_PKEY_CTX_set_ecdh_kdf_md,
30       EVP_PKEY_CTX_get_ecdh_kdf_md, EVP_PKEY_CTX_set_ecdh_kdf_outlen,
31       EVP_PKEY_CTX_get_ecdh_kdf_outlen, EVP_PKEY_CTX_set0_ecdh_kdf_ukm,
32       EVP_PKEY_CTX_get0_ecdh_kdf_ukm, EVP_PKEY_CTX_set1_id,
33       EVP_PKEY_CTX_get1_id, EVP_PKEY_CTX_get1_id_len - algorithm specific
34       control operations
35

SYNOPSIS

37        #include <openssl/evp.h>
38
39        int EVP_PKEY_CTX_ctrl(EVP_PKEY_CTX *ctx, int keytype, int optype,
40                              int cmd, int p1, void *p2);
41        int EVP_PKEY_CTX_ctrl_uint64(EVP_PKEY_CTX *ctx, int keytype, int optype,
42                                     int cmd, uint64_t value);
43        int EVP_PKEY_CTX_ctrl_str(EVP_PKEY_CTX *ctx, const char *type,
44                                  const char *value);
45
46        int EVP_PKEY_CTX_md(EVP_PKEY_CTX *ctx, int optype, int cmd, const char *md);
47
48        int EVP_PKEY_CTX_set_signature_md(EVP_PKEY_CTX *ctx, const EVP_MD *md);
49        int EVP_PKEY_CTX_get_signature_md(EVP_PKEY_CTX *ctx, const EVP_MD **pmd);
50
51        int EVP_PKEY_CTX_set_mac_key(EVP_PKEY_CTX *ctx, unsigned char *key, int len);
52
53        #include <openssl/rsa.h>
54
55        int EVP_PKEY_CTX_set_rsa_padding(EVP_PKEY_CTX *ctx, int pad);
56        int EVP_PKEY_CTX_get_rsa_padding(EVP_PKEY_CTX *ctx, int *pad);
57        int EVP_PKEY_CTX_set_rsa_pss_saltlen(EVP_PKEY_CTX *ctx, int len);
58        int EVP_PKEY_CTX_get_rsa_pss_saltlen(EVP_PKEY_CTX *ctx, int *len);
59        int EVP_PKEY_CTX_set_rsa_keygen_bits(EVP_PKEY_CTX *ctx, int mbits);
60        int EVP_PKEY_CTX_set_rsa_keygen_pubexp(EVP_PKEY_CTX *ctx, BIGNUM *pubexp);
61        int EVP_PKEY_CTX_set_rsa_keygen_primes(EVP_PKEY_CTX *ctx, int primes);
62        int EVP_PKEY_CTX_set_rsa_mgf1_md(EVP_PKEY_CTX *ctx, const EVP_MD *md);
63        int EVP_PKEY_CTX_get_rsa_mgf1_md(EVP_PKEY_CTX *ctx, const EVP_MD **md);
64        int EVP_PKEY_CTX_set_rsa_oaep_md(EVP_PKEY_CTX *ctx, const EVP_MD *md);
65        int EVP_PKEY_CTX_get_rsa_oaep_md(EVP_PKEY_CTX *ctx, const EVP_MD **md);
66        int EVP_PKEY_CTX_set0_rsa_oaep_label(EVP_PKEY_CTX *ctx, unsigned char *label, int len);
67        int EVP_PKEY_CTX_get0_rsa_oaep_label(EVP_PKEY_CTX *ctx, unsigned char **label);
68
69        #include <openssl/dsa.h>
70
71        int EVP_PKEY_CTX_set_dsa_paramgen_bits(EVP_PKEY_CTX *ctx, int nbits);
72
73        #include <openssl/dh.h>
74
75        int EVP_PKEY_CTX_set_dh_paramgen_prime_len(EVP_PKEY_CTX *ctx, int len);
76        int EVP_PKEY_CTX_set_dh_paramgen_subprime_len(EVP_PKEY_CTX *ctx, int len);
77        int EVP_PKEY_CTX_set_dh_paramgen_generator(EVP_PKEY_CTX *ctx, int gen);
78        int EVP_PKEY_CTX_set_dh_paramgen_type(EVP_PKEY_CTX *ctx, int type);
79        int EVP_PKEY_CTX_set_dh_pad(EVP_PKEY_CTX *ctx, int pad);
80        int EVP_PKEY_CTX_set_dh_nid(EVP_PKEY_CTX *ctx, int nid);
81        int EVP_PKEY_CTX_set_dh_rfc5114(EVP_PKEY_CTX *ctx, int rfc5114);
82        int EVP_PKEY_CTX_set_dhx_rfc5114(EVP_PKEY_CTX *ctx, int rfc5114);
83        int EVP_PKEY_CTX_set_dh_kdf_type(EVP_PKEY_CTX *ctx, int kdf);
84        int EVP_PKEY_CTX_get_dh_kdf_type(EVP_PKEY_CTX *ctx);
85        int EVP_PKEY_CTX_set0_dh_kdf_oid(EVP_PKEY_CTX *ctx, ASN1_OBJECT *oid);
86        int EVP_PKEY_CTX_get0_dh_kdf_oid(EVP_PKEY_CTX *ctx, ASN1_OBJECT **oid);
87        int EVP_PKEY_CTX_set_dh_kdf_md(EVP_PKEY_CTX *ctx, const EVP_MD *md);
88        int EVP_PKEY_CTX_get_dh_kdf_md(EVP_PKEY_CTX *ctx, const EVP_MD **md);
89        int EVP_PKEY_CTX_set_dh_kdf_outlen(EVP_PKEY_CTX *ctx, int len);
90        int EVP_PKEY_CTX_get_dh_kdf_outlen(EVP_PKEY_CTX *ctx, int *len);
91        int EVP_PKEY_CTX_set0_dh_kdf_ukm(EVP_PKEY_CTX *ctx, unsigned char *ukm, int len);
92        int EVP_PKEY_CTX_get0_dh_kdf_ukm(EVP_PKEY_CTX *ctx, unsigned char **ukm);
93
94        #include <openssl/ec.h>
95
96        int EVP_PKEY_CTX_set_ec_paramgen_curve_nid(EVP_PKEY_CTX *ctx, int nid);
97        int EVP_PKEY_CTX_set_ec_param_enc(EVP_PKEY_CTX *ctx, int param_enc);
98        int EVP_PKEY_CTX_set_ecdh_cofactor_mode(EVP_PKEY_CTX *ctx, int cofactor_mode);
99        int EVP_PKEY_CTX_get_ecdh_cofactor_mode(EVP_PKEY_CTX *ctx);
100        int EVP_PKEY_CTX_set_ecdh_kdf_type(EVP_PKEY_CTX *ctx, int kdf);
101        int EVP_PKEY_CTX_get_ecdh_kdf_type(EVP_PKEY_CTX *ctx);
102        int EVP_PKEY_CTX_set_ecdh_kdf_md(EVP_PKEY_CTX *ctx, const EVP_MD *md);
103        int EVP_PKEY_CTX_get_ecdh_kdf_md(EVP_PKEY_CTX *ctx, const EVP_MD **md);
104        int EVP_PKEY_CTX_set_ecdh_kdf_outlen(EVP_PKEY_CTX *ctx, int len);
105        int EVP_PKEY_CTX_get_ecdh_kdf_outlen(EVP_PKEY_CTX *ctx, int *len);
106        int EVP_PKEY_CTX_set0_ecdh_kdf_ukm(EVP_PKEY_CTX *ctx, unsigned char *ukm, int len);
107        int EVP_PKEY_CTX_get0_ecdh_kdf_ukm(EVP_PKEY_CTX *ctx, unsigned char **ukm);
108
109        int EVP_PKEY_CTX_set1_id(EVP_PKEY_CTX *ctx, void *id, size_t id_len);
110        int EVP_PKEY_CTX_get1_id(EVP_PKEY_CTX *ctx, void *id);
111        int EVP_PKEY_CTX_get1_id_len(EVP_PKEY_CTX *ctx, size_t *id_len);
112

DESCRIPTION

114       The function EVP_PKEY_CTX_ctrl() sends a control operation to the
115       context ctx. The key type used must match keytype if it is not -1. The
116       parameter optype is a mask indicating which operations the control can
117       be applied to.  The control command is indicated in cmd and any
118       additional arguments in p1 and p2.
119
120       For cmd = EVP_PKEY_CTRL_SET_MAC_KEY, p1 is the length of the MAC key,
121       and p2 is MAC key. This is used by Poly1305, SipHash, HMAC and CMAC.
122
123       Applications will not normally call EVP_PKEY_CTX_ctrl() directly but
124       will instead call one of the algorithm specific macros below.
125
126       The function EVP_PKEY_CTX_ctrl_uint64() is a wrapper that directly
127       passes a uint64 value as p2 to EVP_PKEY_CTX_ctrl().
128
129       The function EVP_PKEY_CTX_ctrl_str() allows an application to send an
130       algorithm specific control operation to a context ctx in string form.
131       This is intended to be used for options specified on the command line
132       or in text files. The commands supported are documented in the openssl
133       utility command line pages for the option -pkeyopt which is supported
134       by the pkeyutl, genpkey and req commands.
135
136       The function EVP_PKEY_CTX_md() sends a message digest control operation
137       to the context ctx. The message digest is specified by its name md.
138
139       All the remaining "functions" are implemented as macros.
140
141       The EVP_PKEY_CTX_set_signature_md() macro sets the message digest type
142       used in a signature. It can be used in the RSA, DSA and ECDSA
143       algorithms.
144
145       The EVP_PKEY_CTX_get_signature_md() macro gets the message digest type
146       used in a signature. It can be used in the RSA, DSA and ECDSA
147       algorithms.
148
149       Key generation typically involves setting up parameters to be used and
150       generating the private and public key data. Some algorithm
151       implementations allow private key data to be set explicitly using the
152       EVP_PKEY_CTX_set_mac_key() macro. In this case key generation is simply
153       the process of setting up the parameters for the key and then setting
154       the raw key data to the value explicitly provided by that macro.
155       Normally applications would call EVP_PKEY_new_raw_private_key(3) or
156       similar functions instead of this macro.
157
158       The EVP_PKEY_CTX_set_mac_key() macro can be used with any of the
159       algorithms supported by the EVP_PKEY_new_raw_private_key(3) function.
160
161   RSA parameters
162       The EVP_PKEY_CTX_set_rsa_padding() macro sets the RSA padding mode for
163       ctx.  The pad parameter can take the value RSA_PKCS1_PADDING for PKCS#1
164       padding, RSA_SSLV23_PADDING for SSLv23 padding, RSA_NO_PADDING for no
165       padding, RSA_PKCS1_OAEP_PADDING for OAEP padding (encrypt and decrypt
166       only), RSA_X931_PADDING for X9.31 padding (signature operations only)
167       and RSA_PKCS1_PSS_PADDING (sign and verify only).
168
169       Two RSA padding modes behave differently if
170       EVP_PKEY_CTX_set_signature_md() is used. If this macro is called for
171       PKCS#1 padding the plaintext buffer is an actual digest value and is
172       encapsulated in a DigestInfo structure according to PKCS#1 when signing
173       and this structure is expected (and stripped off) when verifying. If
174       this control is not used with RSA and PKCS#1 padding then the supplied
175       data is used directly and not encapsulated. In the case of X9.31
176       padding for RSA the algorithm identifier byte is added or checked and
177       removed if this control is called. If it is not called then the first
178       byte of the plaintext buffer is expected to be the algorithm identifier
179       byte.
180
181       The EVP_PKEY_CTX_get_rsa_padding() macro gets the RSA padding mode for
182       ctx.
183
184       The EVP_PKEY_CTX_set_rsa_pss_saltlen() macro sets the RSA PSS salt
185       length to len. As its name implies it is only supported for PSS
186       padding. Three special values are supported: RSA_PSS_SALTLEN_DIGEST
187       sets the salt length to the digest length, RSA_PSS_SALTLEN_MAX sets the
188       salt length to the maximum permissible value. When verifying
189       RSA_PSS_SALTLEN_AUTO causes the salt length to be automatically
190       determined based on the PSS block structure. If this macro is not
191       called maximum salt length is used when signing and auto detection when
192       verifying is used by default.
193
194       The EVP_PKEY_CTX_get_rsa_pss_saltlen() macro gets the RSA PSS salt
195       length for ctx. The padding mode must have been set to
196       RSA_PKCS1_PSS_PADDING.
197
198       The EVP_PKEY_CTX_set_rsa_keygen_bits() macro sets the RSA key length
199       for RSA key generation to bits. If not specified 1024 bits is used.
200
201       The EVP_PKEY_CTX_set_rsa_keygen_pubexp() macro sets the public exponent
202       value for RSA key generation to pubexp. Currently it should be an odd
203       integer. The pubexp pointer is used internally by this function so it
204       should not be modified or freed after the call. If not specified 65537
205       is used.
206
207       The EVP_PKEY_CTX_set_rsa_keygen_primes() macro sets the number of
208       primes for RSA key generation to primes. If not specified 2 is used.
209
210       The EVP_PKEY_CTX_set_rsa_mgf1_md() macro sets the MGF1 digest for RSA
211       padding schemes to md. If not explicitly set the signing digest is
212       used. The padding mode must have been set to RSA_PKCS1_OAEP_PADDING or
213       RSA_PKCS1_PSS_PADDING.
214
215       The EVP_PKEY_CTX_get_rsa_mgf1_md() macro gets the MGF1 digest for ctx.
216       If not explicitly set the signing digest is used. The padding mode must
217       have been set to RSA_PKCS1_OAEP_PADDING or RSA_PKCS1_PSS_PADDING.
218
219       The EVP_PKEY_CTX_set_rsa_oaep_md() macro sets the message digest type
220       used in RSA OAEP to md. The padding mode must have been set to
221       RSA_PKCS1_OAEP_PADDING.
222
223       The EVP_PKEY_CTX_get_rsa_oaep_md() macro gets the message digest type
224       used in RSA OAEP to md. The padding mode must have been set to
225       RSA_PKCS1_OAEP_PADDING.
226
227       The EVP_PKEY_CTX_set0_rsa_oaep_label() macro sets the RSA OAEP label to
228       label and its length to len. If label is NULL or len is 0, the label is
229       cleared. The library takes ownership of the label so the caller should
230       not free the original memory pointed to by label.  The padding mode
231       must have been set to RSA_PKCS1_OAEP_PADDING.
232
233       The EVP_PKEY_CTX_get0_rsa_oaep_label() macro gets the RSA OAEP label to
234       label. The return value is the label length. The padding mode must have
235       been set to RSA_PKCS1_OAEP_PADDING. The resulting pointer is owned by
236       the library and should not be freed by the caller.
237
238   DSA parameters
239       The EVP_PKEY_CTX_set_dsa_paramgen_bits() macro sets the number of bits
240       used for DSA parameter generation to bits. If not specified 1024 is
241       used.
242
243   DH parameters
244       The EVP_PKEY_CTX_set_dh_paramgen_prime_len() macro sets the length of
245       the DH prime parameter p for DH parameter generation. If this macro is
246       not called then 1024 is used. Only accepts lengths greater than or
247       equal to 256.
248
249       The EVP_PKEY_CTX_set_dh_paramgen_subprime_len() macro sets the length
250       of the DH optional subprime parameter q for DH parameter generation.
251       The default is 256 if the prime is at least 2048 bits long or 160
252       otherwise. The DH paramgen type must have been set to x9.42.
253
254       The EVP_PKEY_CTX_set_dh_paramgen_generator() macro sets DH generator to
255       gen for DH parameter generation. If not specified 2 is used.
256
257       The EVP_PKEY_CTX_set_dh_paramgen_type() macro sets the key type for DH
258       parameter generation. Use 0 for PKCS#3 DH and 1 for X9.42 DH.  The
259       default is 0.
260
261       The EVP_PKEY_CTX_set_dh_pad() macro sets the DH padding mode. If pad is
262       1 the shared secret is padded with zeroes up to the size of the DH
263       prime p.  If pad is zero (the default) then no padding is performed.
264
265       EVP_PKEY_CTX_set_dh_nid() sets the DH parameters to values
266       corresponding to nid as defined in RFC7919. The nid parameter must be
267       NID_ffdhe2048, NID_ffdhe3072, NID_ffdhe4096, NID_ffdhe6144,
268       NID_ffdhe8192 or NID_undef to clear the stored value. This macro can be
269       called during parameter or key generation.  The nid parameter and the
270       rfc5114 parameter are mutually exclusive.
271
272       The EVP_PKEY_CTX_set_dh_rfc5114() and EVP_PKEY_CTX_set_dhx_rfc5114()
273       macros are synonymous. They set the DH parameters to the values defined
274       in RFC5114. The rfc5114 parameter must be 1, 2 or 3 corresponding to
275       RFC5114 sections 2.1, 2.2 and 2.3. or 0 to clear the stored value. This
276       macro can be called during parameter generation. The ctx must have a
277       key type of EVP_PKEY_DHX.  The rfc5114 parameter and the nid parameter
278       are mutually exclusive.
279
280   DH key derivation function parameters
281       Note that all of the following functions require that the ctx parameter
282       has a private key type of EVP_PKEY_DHX. When using key derivation, the
283       output of EVP_PKEY_derive() is the output of the KDF instead of the DH
284       shared secret.  The KDF output is typically used as a Key Encryption
285       Key (KEK) that in turn encrypts a Content Encryption Key (CEK).
286
287       The EVP_PKEY_CTX_set_dh_kdf_type() macro sets the key derivation
288       function type to kdf for DH key derivation. Possible values are
289       EVP_PKEY_DH_KDF_NONE and EVP_PKEY_DH_KDF_X9_42 which uses the key
290       derivation specified in RFC2631 (based on the keying algorithm
291       described in X9.42). When using key derivation, the kdf_oid, kdf_md and
292       kdf_outlen parameters must also be specified.
293
294       The EVP_PKEY_CTX_get_dh_kdf_type() macro gets the key derivation
295       function type for ctx used for DH key derivation. Possible values are
296       EVP_PKEY_DH_KDF_NONE and EVP_PKEY_DH_KDF_X9_42.
297
298       The EVP_PKEY_CTX_set0_dh_kdf_oid() macro sets the key derivation
299       function object identifier to oid for DH key derivation. This OID
300       should identify the algorithm to be used with the Content Encryption
301       Key.  The library takes ownership of the object identifier so the
302       caller should not free the original memory pointed to by oid.
303
304       The EVP_PKEY_CTX_get0_dh_kdf_oid() macro gets the key derivation
305       function oid for ctx used for DH key derivation. The resulting pointer
306       is owned by the library and should not be freed by the caller.
307
308       The EVP_PKEY_CTX_set_dh_kdf_md() macro sets the key derivation function
309       message digest to md for DH key derivation. Note that RFC2631 specifies
310       that this digest should be SHA1 but OpenSSL tolerates other digests.
311
312       The EVP_PKEY_CTX_get_dh_kdf_md() macro gets the key derivation function
313       message digest for ctx used for DH key derivation.
314
315       The EVP_PKEY_CTX_set_dh_kdf_outlen() macro sets the key derivation
316       function output length to len for DH key derivation.
317
318       The EVP_PKEY_CTX_get_dh_kdf_outlen() macro gets the key derivation
319       function output length for ctx used for DH key derivation.
320
321       The EVP_PKEY_CTX_set0_dh_kdf_ukm() macro sets the user key material to
322       ukm and its length to len for DH key derivation. This parameter is
323       optional and corresponds to the partyAInfo field in RFC2631 terms. The
324       specification requires that it is 512 bits long but this is not
325       enforced by OpenSSL.  The library takes ownership of the user key
326       material so the caller should not free the original memory pointed to
327       by ukm.
328
329       The EVP_PKEY_CTX_get0_dh_kdf_ukm() macro gets the user key material for
330       ctx.  The return value is the user key material length. The resulting
331       pointer is owned by the library and should not be freed by the caller.
332
333   EC parameters
334       The EVP_PKEY_CTX_set_ec_paramgen_curve_nid() sets the EC curve for EC
335       parameter generation to nid. For EC parameter generation this macro
336       must be called or an error occurs because there is no default curve.
337       This function can also be called to set the curve explicitly when
338       generating an EC key.
339
340       The EVP_PKEY_CTX_set_ec_param_enc() macro sets the EC parameter
341       encoding to param_enc when generating EC parameters or an EC key. The
342       encoding can be OPENSSL_EC_EXPLICIT_CURVE for explicit parameters (the
343       default in versions of OpenSSL before 1.1.0) or OPENSSL_EC_NAMED_CURVE
344       to use named curve form.  For maximum compatibility the named curve
345       form should be used. Note: the OPENSSL_EC_NAMED_CURVE value was added
346       in OpenSSL 1.1.0; previous versions should use 0 instead.
347
348   ECDH parameters
349       The EVP_PKEY_CTX_set_ecdh_cofactor_mode() macro sets the cofactor mode
350       to cofactor_mode for ECDH key derivation. Possible values are 1 to
351       enable cofactor key derivation, 0 to disable it and -1 to clear the
352       stored cofactor mode and fallback to the private key cofactor mode.
353
354       The EVP_PKEY_CTX_get_ecdh_cofactor_mode() macro returns the cofactor
355       mode for ctx used for ECDH key derivation. Possible values are 1 when
356       cofactor key derivation is enabled and 0 otherwise.
357
358   ECDH key derivation function parameters
359       The EVP_PKEY_CTX_set_ecdh_kdf_type() macro sets the key derivation
360       function type to kdf for ECDH key derivation. Possible values are
361       EVP_PKEY_ECDH_KDF_NONE and EVP_PKEY_ECDH_KDF_X9_63 which uses the key
362       derivation specified in X9.63.  When using key derivation, the kdf_md
363       and kdf_outlen parameters must also be specified.
364
365       The EVP_PKEY_CTX_get_ecdh_kdf_type() macro returns the key derivation
366       function type for ctx used for ECDH key derivation. Possible values are
367       EVP_PKEY_ECDH_KDF_NONE and EVP_PKEY_ECDH_KDF_X9_63.
368
369       The EVP_PKEY_CTX_set_ecdh_kdf_md() macro sets the key derivation
370       function message digest to md for ECDH key derivation. Note that X9.63
371       specifies that this digest should be SHA1 but OpenSSL tolerates other
372       digests.
373
374       The EVP_PKEY_CTX_get_ecdh_kdf_md() macro gets the key derivation
375       function message digest for ctx used for ECDH key derivation.
376
377       The EVP_PKEY_CTX_set_ecdh_kdf_outlen() macro sets the key derivation
378       function output length to len for ECDH key derivation.
379
380       The EVP_PKEY_CTX_get_ecdh_kdf_outlen() macro gets the key derivation
381       function output length for ctx used for ECDH key derivation.
382
383       The EVP_PKEY_CTX_set0_ecdh_kdf_ukm() macro sets the user key material
384       to ukm for ECDH key derivation. This parameter is optional and
385       corresponds to the shared info in X9.63 terms. The library takes
386       ownership of the user key material so the caller should not free the
387       original memory pointed to by ukm.
388
389       The EVP_PKEY_CTX_get0_ecdh_kdf_ukm() macro gets the user key material
390       for ctx.  The return value is the user key material length. The
391       resulting pointer is owned by the library and should not be freed by
392       the caller.
393
394   Other parameters
395       The EVP_PKEY_CTX_set1_id(), EVP_PKEY_CTX_get1_id() and
396       EVP_PKEY_CTX_get1_id_len() macros are used to manipulate the special
397       identifier field for specific signature algorithms such as SM2. The
398       EVP_PKEY_CTX_set1_id() sets an ID pointed by id with the length id_len
399       to the library. The library takes a copy of the id so that the caller
400       can safely free the original memory pointed to by id. The
401       EVP_PKEY_CTX_get1_id_len() macro returns the length of the ID set via a
402       previous call to EVP_PKEY_CTX_set1_id(). The length is usually used to
403       allocate adequate memory for further calls to EVP_PKEY_CTX_get1_id().
404       The EVP_PKEY_CTX_get1_id() macro returns the previously set ID value to
405       caller in id. The caller should allocate adequate memory space for the
406       id before calling EVP_PKEY_CTX_get1_id().
407

RETURN VALUES

409       EVP_PKEY_CTX_ctrl() and its macros return a positive value for success
410       and 0 or a negative value for failure. In particular a return value of
411       -2 indicates the operation is not supported by the public key
412       algorithm.
413

SEE ALSO

415       EVP_PKEY_CTX_new(3), EVP_PKEY_encrypt(3), EVP_PKEY_decrypt(3),
416       EVP_PKEY_sign(3), EVP_PKEY_verify(3), EVP_PKEY_verify_recover(3),
417       EVP_PKEY_derive(3), EVP_PKEY_keygen(3)
418

HISTORY

420       The EVP_PKEY_CTX_set1_id(), EVP_PKEY_CTX_get1_id() and
421       EVP_PKEY_CTX_get1_id_len() macros were added in 1.1.1, other functions
422       were added in OpenSSL 1.0.0.
423
425       Copyright 2006-2018 The OpenSSL Project Authors. All Rights Reserved.
426
427       Licensed under the OpenSSL license (the "License").  You may not use
428       this file except in compliance with the License.  You can obtain a copy
429       in the file LICENSE in the source distribution or at
430       <https://www.openssl.org/source/license.html>.
431
432
433
4341.1.1c                            2019-05-28              EVP_PKEY_CTX_CTRL(3)
Impressum