summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/man/EVP_PKEY_CTX_ctrl.3
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/man/EVP_PKEY_CTX_ctrl.3')
-rw-r--r--src/lib/libcrypto/man/EVP_PKEY_CTX_ctrl.3245
1 files changed, 245 insertions, 0 deletions
diff --git a/src/lib/libcrypto/man/EVP_PKEY_CTX_ctrl.3 b/src/lib/libcrypto/man/EVP_PKEY_CTX_ctrl.3
new file mode 100644
index 0000000000..5b1b94653a
--- /dev/null
+++ b/src/lib/libcrypto/man/EVP_PKEY_CTX_ctrl.3
@@ -0,0 +1,245 @@
1.Dd $Mdocdate: November 3 2016 $
2.Dt EVP_PKEY_CTX_CTRL 3
3.Os
4.Sh NAME
5.Nm EVP_PKEY_CTX_ctrl ,
6.Nm EVP_PKEY_CTX_ctrl_str ,
7.Nm EVP_PKEY_get_default_digest_nid ,
8.Nm EVP_PKEY_CTX_set_signature_md ,
9.Nm EVP_PKEY_CTX_set_rsa_padding ,
10.Nm EVP_PKEY_CTX_set_rsa_pss_saltlen ,
11.Nm EVP_PKEY_CTX_set_rsa_rsa_keygen_bits ,
12.Nm EVP_PKEY_CTX_set_rsa_keygen_pubexp ,
13.Nm EVP_PKEY_CTX_set_dsa_paramgen_bits ,
14.Nm EVP_PKEY_CTX_set_dh_paramgen_prime_len ,
15.Nm EVP_PKEY_CTX_set_dh_paramgen_generator ,
16.Nm EVP_PKEY_CTX_set_ec_paramgen_curve_nid
17.Nd algorithm specific control operations
18.Sh SYNOPSIS
19.In openssl/evp.h
20.Ft int
21.Fo EVP_PKEY_CTX_ctrl
22.Fa "EVP_PKEY_CTX *ctx"
23.Fa "int keytype"
24.Fa "int optype"
25.Fa "int cmd"
26.Fa "int p1"
27.Fa "void *p2"
28.Fc
29.Ft int
30.Fo EVP_PKEY_CTX_ctrl_str
31.Fa "EVP_PKEY_CTX *ctx"
32.Fa "const char *type"
33.Fa "const char *value"
34.Fc
35.Ft int
36.Fo EVP_PKEY_get_default_digest_nid
37.Fa "EVP_PKEY *pkey"
38.Fa "int *pnid"
39.Fc
40.In openssl/rsa.h
41.Ft int
42.Fo EVP_PKEY_CTX_set_signature_md
43.Fa "EVP_PKEY_CTX *ctx"
44.Fa "const EVP_MD *md"
45.Fc
46.Ft int
47.Fo EVP_PKEY_CTX_set_rsa_padding
48.Fa "EVP_PKEY_CTX *ctx"
49.Fa "int pad"
50.Fc
51.Ft int
52.Fo EVP_PKEY_CTX_set_rsa_pss_saltlen
53.Fa "EVP_PKEY_CTX *ctx"
54.Fa "int len"
55.Fc
56.Ft int
57.Fo EVP_PKEY_CTX_set_rsa_rsa_keygen_bits
58.Fa "EVP_PKEY_CTX *ctx"
59.Fa "int mbits"
60.Fc
61.Ft int
62.Fo EVP_PKEY_CTX_set_rsa_keygen_pubexp
63.Fa "EVP_PKEY_CTX *ctx"
64.Fa "BIGNUM *pubexp"
65.Fc
66.In openssl/dsa.h
67.Ft int
68.Fo EVP_PKEY_CTX_set_dsa_paramgen_bits
69.Fa "EVP_PKEY_CTX *ctx"
70.Fa "int nbits"
71.Fc
72.In openssl/dh.h
73.Ft int
74.Fo EVP_PKEY_CTX_set_dh_paramgen_prime_len
75.Fa "EVP_PKEY_CTX *ctx"
76.Fa "int len"
77.Fc
78.Ft int
79.Fo EVP_PKEY_CTX_set_dh_paramgen_generator
80.Fa "EVP_PKEY_CTX *ctx"
81.Fa "int gen"
82.Fc
83.In openssl/ec.h
84.Ft int
85.Fo EVP_PKEY_CTX_set_ec_paramgen_curve_nid
86.Fa "EVP_PKEY_CTX *ctx"
87.Fa "int nid"
88.Fc
89.Sh DESCRIPTION
90The function
91.Fn EVP_PKEY_CTX_ctrl
92sends a control operation to the context
93.Fa ctx .
94The key type used must match
95.Fa keytype
96if it is not -1.
97The parameter
98.Fa optype
99is a mask indicating which operations the control can be applied to.
100The control command is indicated in
101.Fa cmd
102and any additional arguments in
103.Fa p1
104and
105.Fa p2 .
106.Pp
107Applications will not normally call
108.Fn EVP_PKEY_CTX_ctrl
109directly but will instead call one of the algorithm specific macros
110below.
111.Pp
112The function
113.Fn EVP_PKEY_CTX_ctrl_str
114allows an application to send an algorithm specific control operation to
115a context
116.Fa ctx
117in string form.
118This is intended to be used for options specified on the command line or
119in text files.
120The commands supported are documented in the
121.Xr openssl 1
122utility command line pages for the option
123.Fl pkeyopt
124which is supported by the
125.Cm pkeyutl ,
126.Cm genpkey ,
127and
128.Cm req
129commands.
130.Pp
131All the remaining "functions" are implemented as macros.
132.Pp
133The
134.Fn EVP_PKEY_CTX_set_signature_md
135macro sets the message digest type used in a signature.
136It can be used with any public key algorithm supporting signature
137operations.
138.Pp
139The macro
140.Fn EVP_PKEY_CTX_set_rsa_padding
141sets the RSA padding mode for
142.Fa ctx .
143The
144.Fa pad
145parameter can take the value
146.Dv RSA_PKCS1_PADDING
147for PKCS#1 padding,
148.Dv RSA_SSLV23_PADDING
149for SSLv23 padding,
150.Dv RSA_NO_PADDING
151for no padding,
152.Dv RSA_PKCS1_OAEP_PADDING
153for OAEP padding (encrypt and decrypt only),
154.Dv RSA_X931_PADDING
155for X9.31 padding (signature operations only) and
156.Dv RSA_PKCS1_PSS_PADDING
157(sign and verify only).
158.Pp
159Two RSA padding modes behave differently if
160.Fn EVP_PKEY_CTX_set_signature_md
161is used.
162If this macro is called for PKCS#1 padding, the plaintext buffer is an
163actual digest value and is encapsulated in a DigestInfo structure
164according to PKCS#1 when signing and this structure is expected (and
165stripped off) when verifying.
166If this control is not used with RSA and PKCS#1 padding then the
167supplied data is used directly and not encapsulated.
168In the case of X9.31 padding for RSA the algorithm identifier byte is
169added or checked and removed if this control is called.
170If it is not called then the first byte of the plaintext buffer is
171expected to be the algorithm identifier byte.
172.Pp
173The
174.Fn EVP_PKEY_CTX_set_rsa_pss_saltlen
175macro sets the RSA PSS salt length to
176.Fa len
177as its name implies it is only supported for PSS padding.
178Two special values are supported: -1 sets the salt length to the digest
179length.
180When signing -2 sets the salt length to the maximum permissible value.
181When verifying -2 causes the salt length to be automatically determined
182based on the PSS block structure.
183If this macro is not called a salt length value of -2 is used by
184default.
185.Pp
186The
187.Fn EVP_PKEY_CTX_set_rsa_rsa_keygen_bits
188macro sets the RSA key length for RSA key generation to
189.Fa mbits .
190If not specified, 1024 bits is used.
191.Pp
192The
193.Fn EVP_PKEY_CTX_set_rsa_keygen_pubexp
194macro sets the public exponent value for RSA key generation to
195.Fa pubexp .
196Currently, it should be an odd integer.
197The
198.Fa pubexp
199pointer is used internally by this function, so it should not be modified
200or freed after the call.
201If this macro is not called, then 65537 is used.
202.Pp
203The macro
204.Fn EVP_PKEY_CTX_set_dsa_paramgen_bits
205sets the number of bits used for DSA parameter generation to
206.Fa nbits .
207If not specified, 1024 is used.
208.Pp
209The macro
210.Fn EVP_PKEY_CTX_set_dh_paramgen_prime_len
211sets the length of the DH prime parameter
212.Fa len
213for DH parameter generation.
214If this macro is not called, then 1024 is used.
215.Pp
216The
217.Fn EVP_PKEY_CTX_set_dh_paramgen_generator
218macro sets DH generator to
219.Fa gen
220for DH parameter generation.
221If not specified, 2 is used.
222.Pp
223The
224.Fn EVP_PKEY_CTX_set_ec_paramgen_curve_nid
225sets the EC curve for EC parameter generation to
226.Fa nid .
227For EC parameter generation, this macro must be called or an error occurs
228because there is no default curve.
229.Sh RETURN VALUES
230.Fn EVP_PKEY_CTX_ctrl
231and its macros return a positive value for success and 0 or a negative
232value for failure.
233In particular, a return value of -2 indicates the operation is not
234supported by the public key algorithm.
235.Sh SEE ALSO
236.Xr EVP_PKEY_CTX_new 3 ,
237.Xr EVP_PKEY_decrypt 3 ,
238.Xr EVP_PKEY_derive 3 ,
239.Xr EVP_PKEY_encrypt 3 ,
240.Xr EVP_PKEY_keygen 3 ,
241.Xr EVP_PKEY_sign 3 ,
242.Xr EVP_PKEY_verify 3 ,
243.Xr EVP_PKEY_verify_recover 3
244.Sh HISTORY
245These functions were first added to OpenSSL 1.0.0.