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_dsa_paramgen_q_bits, EVP_PKEY_CTX_set_dsa_paramgen_md,
17       EVP_PKEY_CTX_set_dh_paramgen_prime_len,
18       EVP_PKEY_CTX_set_dh_paramgen_subprime_len,
19       EVP_PKEY_CTX_set_dh_paramgen_generator,
20       EVP_PKEY_CTX_set_dh_paramgen_type, EVP_PKEY_CTX_set_dh_rfc5114,
21       EVP_PKEY_CTX_set_dhx_rfc5114, EVP_PKEY_CTX_set_dh_pad,
22       EVP_PKEY_CTX_set_dh_nid, EVP_PKEY_CTX_set_dh_kdf_type,
23       EVP_PKEY_CTX_get_dh_kdf_type, EVP_PKEY_CTX_set0_dh_kdf_oid,
24       EVP_PKEY_CTX_get0_dh_kdf_oid, EVP_PKEY_CTX_set_dh_kdf_md,
25       EVP_PKEY_CTX_get_dh_kdf_md, EVP_PKEY_CTX_set_dh_kdf_outlen,
26       EVP_PKEY_CTX_get_dh_kdf_outlen, EVP_PKEY_CTX_set0_dh_kdf_ukm,
27       EVP_PKEY_CTX_get0_dh_kdf_ukm, EVP_PKEY_CTX_set_ec_paramgen_curve_nid,
28       EVP_PKEY_CTX_set_ec_param_enc, EVP_PKEY_CTX_set_ecdh_cofactor_mode,
29       EVP_PKEY_CTX_get_ecdh_cofactor_mode, EVP_PKEY_CTX_set_ecdh_kdf_type,
30       EVP_PKEY_CTX_get_ecdh_kdf_type, EVP_PKEY_CTX_set_ecdh_kdf_md,
31       EVP_PKEY_CTX_get_ecdh_kdf_md, EVP_PKEY_CTX_set_ecdh_kdf_outlen,
32       EVP_PKEY_CTX_get_ecdh_kdf_outlen, EVP_PKEY_CTX_set0_ecdh_kdf_ukm,
33       EVP_PKEY_CTX_get0_ecdh_kdf_ukm, EVP_PKEY_CTX_set1_id,
34       EVP_PKEY_CTX_get1_id, EVP_PKEY_CTX_get1_id_len - algorithm specific
35       control operations
36

SYNOPSIS

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

DESCRIPTION

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

RETURN VALUES

423       EVP_PKEY_CTX_ctrl() and its macros return a positive value for success
424       and 0 or a negative value for failure. In particular a return value of
425       -2 indicates the operation is not supported by the public key
426       algorithm.
427

SEE ALSO

429       EVP_PKEY_CTX_new(3), EVP_PKEY_encrypt(3), EVP_PKEY_decrypt(3),
430       EVP_PKEY_sign(3), EVP_PKEY_verify(3), EVP_PKEY_verify_recover(3),
431       EVP_PKEY_derive(3), EVP_PKEY_keygen(3)
432

HISTORY

434       The EVP_PKEY_CTX_set1_id(), EVP_PKEY_CTX_get1_id() and
435       EVP_PKEY_CTX_get1_id_len() macros were added in 1.1.1, other functions
436       were added in OpenSSL 1.0.0.
437
439       Copyright 2006-2018 The OpenSSL Project Authors. All Rights Reserved.
440
441       Licensed under the OpenSSL license (the "License").  You may not use
442       this file except in compliance with the License.  You can obtain a copy
443       in the file LICENSE in the source distribution or at
444       <https://www.openssl.org/source/license.html>.
445
446
447
4481.1.1g                            2020-04-23              EVP_PKEY_CTX_CTRL(3)
Impressum