diff options
author | schwarze <> | 2019-11-01 12:02:58 +0000 |
---|---|---|
committer | schwarze <> | 2019-11-01 12:02:58 +0000 |
commit | c486619b21445153ea79c808f81279ffd3efde9c (patch) | |
tree | 1f232c188891f67b6d0a83b05dded6fdc2d84581 | |
parent | 06b54e9217af744c680ff812191733948cfafa40 (diff) | |
download | openbsd-c486619b21445153ea79c808f81279ffd3efde9c.tar.gz openbsd-c486619b21445153ea79c808f81279ffd3efde9c.tar.bz2 openbsd-c486619b21445153ea79c808f81279ffd3efde9c.zip |
The EVP_PKEY_CTX_ctrl(3) manual page requires additions for RSA-PSS
but it is growing to excessive size, so split out RSA_pkey_ctx_ctrl(3).
-rw-r--r-- | src/lib/libcrypto/man/EVP_PKEY_CTX_ctrl.3 | 271 | ||||
-rw-r--r-- | src/lib/libcrypto/man/Makefile | 3 | ||||
-rw-r--r-- | src/lib/libcrypto/man/RSA_new.3 | 5 | ||||
-rw-r--r-- | src/lib/libcrypto/man/RSA_pkey_ctx_ctrl.3 | 346 |
4 files changed, 358 insertions, 267 deletions
diff --git a/src/lib/libcrypto/man/EVP_PKEY_CTX_ctrl.3 b/src/lib/libcrypto/man/EVP_PKEY_CTX_ctrl.3 index b9332a7ec1..2bb6a3fd3b 100644 --- a/src/lib/libcrypto/man/EVP_PKEY_CTX_ctrl.3 +++ b/src/lib/libcrypto/man/EVP_PKEY_CTX_ctrl.3 | |||
@@ -1,6 +1,7 @@ | |||
1 | .\" $OpenBSD: EVP_PKEY_CTX_ctrl.3,v 1.20 2019/10/31 14:29:41 schwarze Exp $ | 1 | .\" $OpenBSD: EVP_PKEY_CTX_ctrl.3,v 1.21 2019/11/01 12:02:58 schwarze Exp $ |
2 | .\" full merge up to: OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400 | 2 | .\" full merge up to: OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400 |
3 | .\" selective merge up to: OpenSSL df75c2bf Dec 9 01:02:36 2018 +0100 | 3 | .\" selective merge up to: OpenSSL df75c2bf Dec 9 01:02:36 2018 +0100 |
4 | .\" Parts were split out into RSA_pkey_ctx_ctrl(3). | ||
4 | .\" | 5 | .\" |
5 | .\" This file was written by Dr. Stephen Henson <steve@openssl.org> | 6 | .\" This file was written by Dr. Stephen Henson <steve@openssl.org> |
6 | .\" and Antoine Salon <asalon@vmware.com>. | 7 | .\" and Antoine Salon <asalon@vmware.com>. |
@@ -51,7 +52,7 @@ | |||
51 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 52 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
52 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 53 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
53 | .\" | 54 | .\" |
54 | .Dd $Mdocdate: October 31 2019 $ | 55 | .Dd $Mdocdate: November 1 2019 $ |
55 | .Dt EVP_PKEY_CTX_CTRL 3 | 56 | .Dt EVP_PKEY_CTX_CTRL 3 |
56 | .Os | 57 | .Os |
57 | .Sh NAME | 58 | .Sh NAME |
@@ -59,19 +60,6 @@ | |||
59 | .Nm EVP_PKEY_CTX_ctrl_str , | 60 | .Nm EVP_PKEY_CTX_ctrl_str , |
60 | .Nm EVP_PKEY_CTX_set_signature_md , | 61 | .Nm EVP_PKEY_CTX_set_signature_md , |
61 | .Nm EVP_PKEY_CTX_get_signature_md , | 62 | .Nm EVP_PKEY_CTX_get_signature_md , |
62 | .Nm RSA_pkey_ctx_ctrl , | ||
63 | .Nm EVP_PKEY_CTX_set_rsa_padding , | ||
64 | .Nm EVP_PKEY_CTX_get_rsa_padding , | ||
65 | .Nm EVP_PKEY_CTX_set_rsa_pss_saltlen , | ||
66 | .Nm EVP_PKEY_CTX_get_rsa_pss_saltlen , | ||
67 | .Nm EVP_PKEY_CTX_set_rsa_keygen_bits , | ||
68 | .Nm EVP_PKEY_CTX_set_rsa_keygen_pubexp , | ||
69 | .Nm EVP_PKEY_CTX_set_rsa_mgf1_md , | ||
70 | .Nm EVP_PKEY_CTX_get_rsa_mgf1_md , | ||
71 | .Nm EVP_PKEY_CTX_set_rsa_oaep_md , | ||
72 | .Nm EVP_PKEY_CTX_get_rsa_oaep_md , | ||
73 | .Nm EVP_PKEY_CTX_set0_rsa_oaep_label , | ||
74 | .Nm EVP_PKEY_CTX_get0_rsa_oaep_label , | ||
75 | .Nm EVP_PKEY_CTX_set_dsa_paramgen_bits , | 63 | .Nm EVP_PKEY_CTX_set_dsa_paramgen_bits , |
76 | .Nm EVP_PKEY_CTX_set_dh_paramgen_prime_len , | 64 | .Nm EVP_PKEY_CTX_set_dh_paramgen_prime_len , |
77 | .Nm EVP_PKEY_CTX_set_dh_paramgen_generator , | 65 | .Nm EVP_PKEY_CTX_set_dh_paramgen_generator , |
@@ -118,76 +106,6 @@ | |||
118 | .Fa "EVP_PKEY_CTX *ctx" | 106 | .Fa "EVP_PKEY_CTX *ctx" |
119 | .Fa "const EVP_MD **pmd" | 107 | .Fa "const EVP_MD **pmd" |
120 | .Fc | 108 | .Fc |
121 | .In openssl/rsa.h | ||
122 | .Ft int | ||
123 | .Fo RSA_pkey_ctx_ctrl | ||
124 | .Fa "EVP_PKEY_CTX *ctx" | ||
125 | .Fa "int optype" | ||
126 | .Fa "int cmd" | ||
127 | .Fa "int p1" | ||
128 | .Fa "void *p2" | ||
129 | .Fc | ||
130 | .Ft int | ||
131 | .Fo EVP_PKEY_CTX_set_rsa_padding | ||
132 | .Fa "EVP_PKEY_CTX *ctx" | ||
133 | .Fa "int pad" | ||
134 | .Fc | ||
135 | .Ft int | ||
136 | .Fo EVP_PKEY_CTX_get_rsa_padding | ||
137 | .Fa "EVP_PKEY_CTX *ctx" | ||
138 | .Fa "int *ppad" | ||
139 | .Fc | ||
140 | .Ft int | ||
141 | .Fo EVP_PKEY_CTX_set_rsa_pss_saltlen | ||
142 | .Fa "EVP_PKEY_CTX *ctx" | ||
143 | .Fa "int len" | ||
144 | .Fc | ||
145 | .Ft int | ||
146 | .Fo EVP_PKEY_CTX_get_rsa_pss_saltlen | ||
147 | .Fa "EVP_PKEY_CTX *ctx" | ||
148 | .Fa "int *plen" | ||
149 | .Fc | ||
150 | .Ft int | ||
151 | .Fo EVP_PKEY_CTX_set_rsa_keygen_bits | ||
152 | .Fa "EVP_PKEY_CTX *ctx" | ||
153 | .Fa "int mbits" | ||
154 | .Fc | ||
155 | .Ft int | ||
156 | .Fo EVP_PKEY_CTX_set_rsa_keygen_pubexp | ||
157 | .Fa "EVP_PKEY_CTX *ctx" | ||
158 | .Fa "BIGNUM *pubexp" | ||
159 | .Fc | ||
160 | .Ft int | ||
161 | .Fo EVP_PKEY_CTX_set_rsa_mgf1_md | ||
162 | .Fa "EVP_PKEY_CTX *ctx" | ||
163 | .Fa "const EVP_MD *md" | ||
164 | .Fc | ||
165 | .Ft int | ||
166 | .Fo EVP_PKEY_CTX_get_rsa_mgf1_md | ||
167 | .Fa "EVP_PKEY_CTX *ctx" | ||
168 | .Fa "const EVP_MD **pmd" | ||
169 | .Fc | ||
170 | .Ft int | ||
171 | .Fo EVP_PKEY_CTX_set_rsa_oaep_md | ||
172 | .Fa "EVP_PKEY_CTX *ctx" | ||
173 | .Fa "const EVP_MD *md" | ||
174 | .Fc | ||
175 | .Ft int | ||
176 | .Fo EVP_PKEY_CTX_get_rsa_oaep_md | ||
177 | .Fa "EVP_PKEY_CTX *ctx" | ||
178 | .Fa "const EVP_MD **pmd" | ||
179 | .Fc | ||
180 | .Ft int | ||
181 | .Fo EVP_PKEY_CTX_set0_rsa_oaep_label | ||
182 | .Fa "EVP_PKEY_CTX *ctx" | ||
183 | .Fa "unsigned char *label" | ||
184 | .Fa "int len" | ||
185 | .Fc | ||
186 | .Ft int | ||
187 | .Fo EVP_PKEY_CTX_get0_rsa_oaep_label | ||
188 | .Fa "EVP_PKEY_CTX *ctx" | ||
189 | .Fa "unsigned char **plabel" | ||
190 | .Fc | ||
191 | .In openssl/dsa.h | 109 | .In openssl/dsa.h |
192 | .Ft int | 110 | .Ft int |
193 | .Fo EVP_PKEY_CTX_set_dsa_paramgen_bits | 111 | .Fo EVP_PKEY_CTX_set_dsa_paramgen_bits |
@@ -302,7 +220,8 @@ and | |||
302 | Applications will not normally call | 220 | Applications will not normally call |
303 | .Fn EVP_PKEY_CTX_ctrl | 221 | .Fn EVP_PKEY_CTX_ctrl |
304 | directly but will instead call one of the algorithm specific macros | 222 | directly but will instead call one of the algorithm specific macros |
305 | below. | 223 | described below and in |
224 | .Xr RSA_pkey_ctx_ctrl 3 . | ||
306 | .Pp | 225 | .Pp |
307 | The function | 226 | The function |
308 | .Fn EVP_PKEY_CTX_ctrl_str | 227 | .Fn EVP_PKEY_CTX_ctrl_str |
@@ -331,156 +250,6 @@ and | |||
331 | .Fn EVP_PKEY_CTX_get_signature_md | 250 | .Fn EVP_PKEY_CTX_get_signature_md |
332 | macros set and get the message digest type used in a signature. | 251 | macros set and get the message digest type used in a signature. |
333 | They can be used with the RSA, DSA, and ECDSA algorithms. | 252 | They can be used with the RSA, DSA, and ECDSA algorithms. |
334 | .Ss RSA parameters | ||
335 | The | ||
336 | .Fn RSA_pkey_ctx_ctrl | ||
337 | function is a shallow wrapper around | ||
338 | .Fn EVP_PKEY_CTX_ctrl | ||
339 | which only succeeds if | ||
340 | .Fa ctx | ||
341 | matches either | ||
342 | .Dv EVP_PKEY_RSA | ||
343 | or | ||
344 | .Dv EVP_PKEY_RSA_PSS . | ||
345 | .Pp | ||
346 | The | ||
347 | .Fn EVP_PKEY_CTX_set_rsa_padding | ||
348 | macro sets the RSA padding mode for | ||
349 | .Fa ctx . | ||
350 | The | ||
351 | .Fa pad | ||
352 | parameter can take the value | ||
353 | .Dv RSA_PKCS1_PADDING | ||
354 | for PKCS#1 padding, | ||
355 | .Dv RSA_NO_PADDING | ||
356 | for no padding, | ||
357 | .Dv RSA_PKCS1_OAEP_PADDING | ||
358 | for OAEP padding (encrypt and decrypt only), | ||
359 | .Dv RSA_X931_PADDING | ||
360 | for X9.31 padding (signature operations only) and | ||
361 | .Dv RSA_PKCS1_PSS_PADDING | ||
362 | (sign and verify only). | ||
363 | .Pp | ||
364 | Two RSA padding modes behave differently if | ||
365 | .Fn EVP_PKEY_CTX_set_signature_md | ||
366 | is used. | ||
367 | If this macro is called for PKCS#1 padding, the plaintext buffer is an | ||
368 | actual digest value and is encapsulated in a | ||
369 | .Vt DigestInfo | ||
370 | structure according to PKCS#1 when signing and this structure is | ||
371 | expected (and stripped off) when verifying. | ||
372 | If this control is not used with RSA and PKCS#1 padding then the | ||
373 | supplied data is used directly and not encapsulated. | ||
374 | In the case of X9.31 padding for RSA the algorithm identifier byte is | ||
375 | added or checked and removed if this control is called. | ||
376 | If it is not called then the first byte of the plaintext buffer is | ||
377 | expected to be the algorithm identifier byte. | ||
378 | .Pp | ||
379 | The | ||
380 | .Fn EVP_PKEY_CTX_get_rsa_padding | ||
381 | macro retrieves the RSA padding mode for | ||
382 | .Fa ctx . | ||
383 | .Pp | ||
384 | The | ||
385 | .Fn EVP_PKEY_CTX_set_rsa_pss_saltlen | ||
386 | macro sets the RSA PSS salt length to | ||
387 | .Fa len . | ||
388 | As its name implies, it is only supported for PSS padding. | ||
389 | Two special values are supported: -1 sets the salt length to the digest | ||
390 | length. | ||
391 | When signing -2 sets the salt length to the maximum permissible value. | ||
392 | When verifying -2 causes the salt length to be automatically determined | ||
393 | based on the PSS block structure. | ||
394 | If this macro is not called a salt length value of -2 is used by | ||
395 | default. | ||
396 | .Pp | ||
397 | The | ||
398 | .Fn EVP_PKEY_CTX_get_rsa_pss_saltlen | ||
399 | macro retrieves the RSA PSS salt length for | ||
400 | .Fa ctx . | ||
401 | The padding mode must have been set to | ||
402 | .Dv RSA_PKCS1_PSS_PADDING . | ||
403 | .Pp | ||
404 | The | ||
405 | .Fn EVP_PKEY_CTX_set_rsa_keygen_bits | ||
406 | macro sets the RSA key length for RSA key generation to | ||
407 | .Fa mbits . | ||
408 | The smallest supported value is 512 bits. | ||
409 | If not specified, 1024 bits is used. | ||
410 | .Pp | ||
411 | The | ||
412 | .Fn EVP_PKEY_CTX_set_rsa_keygen_pubexp | ||
413 | macro sets the public exponent value for RSA key generation to | ||
414 | .Fa pubexp . | ||
415 | Currently, it should be an odd integer. | ||
416 | The | ||
417 | .Fa pubexp | ||
418 | pointer is used internally by this function, so it should not be modified | ||
419 | or freed after the call. | ||
420 | If this macro is not called, then 65537 is used. | ||
421 | .Pp | ||
422 | The | ||
423 | .Fn EVP_PKEY_CTX_set_rsa_mgf1_md | ||
424 | macro sets the MGF1 digest for RSA padding schemes to | ||
425 | .Fa md . | ||
426 | Unless explicitly specified, the signing digest is used. | ||
427 | The padding mode must have been set to | ||
428 | .Dv RSA_PKCS1_OAEP_PADDING | ||
429 | or | ||
430 | .Dv RSA_PKCS1_PSS_PADDING . | ||
431 | .Pp | ||
432 | The | ||
433 | .Fn EVP_PKEY_CTX_get_rsa_mgf1_md | ||
434 | macro retrieves the MGF1 digest for | ||
435 | .Fa ctx . | ||
436 | Unless explicitly specified, the signing digest is used. | ||
437 | The padding mode must have been set to | ||
438 | .Dv RSA_PKCS1_OAEP_PADDING | ||
439 | or | ||
440 | .Dv RSA_PKCS1_PSS_PADDING . | ||
441 | .Pp | ||
442 | The | ||
443 | .Fn EVP_PKEY_CTX_set_rsa_oaep_md | ||
444 | macro sets the message digest type used in RSA OAEP to | ||
445 | .Fa md . | ||
446 | The padding mode must have been set to | ||
447 | .Dv RSA_PKCS1_OAEP_PADDING . | ||
448 | .Pp | ||
449 | The | ||
450 | .Fn EVP_PKEY_CTX_get_rsa_oaep_md | ||
451 | macro gets the message digest type used in RSA OAEP to | ||
452 | .Pf * Fa md . | ||
453 | The padding mode must have been set to | ||
454 | .Dv RSA_PKCS1_OAEP_PADDING . | ||
455 | .Pp | ||
456 | The | ||
457 | .Fn EVP_PKEY_CTX_set0_rsa_oaep_label | ||
458 | macro sets the RSA OAEP label to | ||
459 | .Fa label | ||
460 | and its length to | ||
461 | .Fa len . | ||
462 | If | ||
463 | .Fa label | ||
464 | is | ||
465 | .Dv NULL | ||
466 | or | ||
467 | .Fa len | ||
468 | is 0, the label is cleared. | ||
469 | The library takes ownership of the label so the caller should not | ||
470 | free the original memory pointed to by | ||
471 | .Fa label . | ||
472 | The padding mode must have been set to | ||
473 | .Dv RSA_PKCS1_OAEP_PADDING . | ||
474 | .Pp | ||
475 | The | ||
476 | .Fn EVP_PKEY_CTX_get0_rsa_oaep_label | ||
477 | macro gets the RSA OAEP label to | ||
478 | .Pf * Fa plabel . | ||
479 | The return value is the label length. | ||
480 | The padding mode must have been set to | ||
481 | .Dv RSA_PKCS1_OAEP_PADDING . | ||
482 | The resulting pointer is owned by the library and should not be | ||
483 | freed by the caller. | ||
484 | .Ss DSA parameters | 253 | .Ss DSA parameters |
485 | The macro | 254 | The macro |
486 | .Fn EVP_PKEY_CTX_set_dsa_paramgen_bits | 255 | .Fn EVP_PKEY_CTX_set_dsa_paramgen_bits |
@@ -652,16 +421,13 @@ supported by the public key algorithm. | |||
652 | .Xr EVP_PKEY_meth_set_ctrl 3 , | 421 | .Xr EVP_PKEY_meth_set_ctrl 3 , |
653 | .Xr EVP_PKEY_sign 3 , | 422 | .Xr EVP_PKEY_sign 3 , |
654 | .Xr EVP_PKEY_verify 3 , | 423 | .Xr EVP_PKEY_verify 3 , |
655 | .Xr EVP_PKEY_verify_recover 3 | 424 | .Xr EVP_PKEY_verify_recover 3 , |
425 | .Xr RSA_pkey_ctx_ctrl 3 | ||
656 | .Sh HISTORY | 426 | .Sh HISTORY |
657 | The functions | 427 | The functions |
658 | .Fn EVP_PKEY_CTX_ctrl , | 428 | .Fn EVP_PKEY_CTX_ctrl , |
659 | .Fn EVP_PKEY_CTX_ctrl_str , | 429 | .Fn EVP_PKEY_CTX_ctrl_str , |
660 | .Fn EVP_PKEY_CTX_set_signature_md , | 430 | .Fn EVP_PKEY_CTX_set_signature_md , |
661 | .Fn EVP_PKEY_CTX_set_rsa_padding , | ||
662 | .Fn EVP_PKEY_CTX_set_rsa_pss_saltlen , | ||
663 | .Fn EVP_PKEY_CTX_set_rsa_keygen_bits , | ||
664 | .Fn EVP_PKEY_CTX_set_rsa_keygen_pubexp , | ||
665 | .Fn EVP_PKEY_CTX_set_dsa_paramgen_bits , | 431 | .Fn EVP_PKEY_CTX_set_dsa_paramgen_bits , |
666 | .Fn EVP_PKEY_CTX_set_dh_paramgen_prime_len , | 432 | .Fn EVP_PKEY_CTX_set_dh_paramgen_prime_len , |
667 | .Fn EVP_PKEY_CTX_set_dh_paramgen_generator , | 433 | .Fn EVP_PKEY_CTX_set_dh_paramgen_generator , |
@@ -671,15 +437,6 @@ first appeared in OpenSSL 1.0.0 and have been available since | |||
671 | .Ox 4.9 . | 437 | .Ox 4.9 . |
672 | .Pp | 438 | .Pp |
673 | The functions | 439 | The functions |
674 | .Fn EVP_PKEY_CTX_get_rsa_padding , | ||
675 | .Fn EVP_PKEY_CTX_get_rsa_pss_saltlen , | ||
676 | .Fn EVP_PKEY_CTX_set_rsa_mgf1_md , | ||
677 | and | ||
678 | .Fn EVP_PKEY_CTX_get_rsa_mgf1_md | ||
679 | first appeared in OpenSSL 1.0.1 and have been available since | ||
680 | .Ox 5.3 . | ||
681 | .Pp | ||
682 | The functions | ||
683 | .Fn EVP_PKEY_CTX_get_signature_md , | 440 | .Fn EVP_PKEY_CTX_get_signature_md , |
684 | .Fn EVP_PKEY_CTX_set_ec_param_enc , | 441 | .Fn EVP_PKEY_CTX_set_ec_param_enc , |
685 | .Fn EVP_PKEY_CTX_set_ecdh_cofactor_mode , | 442 | .Fn EVP_PKEY_CTX_set_ecdh_cofactor_mode , |
@@ -703,17 +460,3 @@ and | |||
703 | .Fn EVP_PKEY_CTX_get1_id_len | 460 | .Fn EVP_PKEY_CTX_get1_id_len |
704 | first appeared in OpenSSL 1.1.1 and have been available since | 461 | first appeared in OpenSSL 1.1.1 and have been available since |
705 | .Ox 6.6 . | 462 | .Ox 6.6 . |
706 | .Pp | ||
707 | The functions | ||
708 | .Fn EVP_PKEY_CTX_set_rsa_oaep_md , | ||
709 | .Fn EVP_PKEY_CTX_get_rsa_oaep_md , | ||
710 | .Fn EVP_PKEY_CTX_set0_rsa_oaep_label , | ||
711 | and | ||
712 | .Fn EVP_PKEY_CTX_get0_rsa_oaep_label | ||
713 | first appeared in OpenSSL 1.0.2 and have been available since | ||
714 | .Ox 6.7 . | ||
715 | .Pp | ||
716 | The function | ||
717 | .Fn RSA_pkey_ctx_ctrl | ||
718 | first appeared in OpenSSL 1.1.1 and has been available since | ||
719 | .Ox 6.7 . | ||
diff --git a/src/lib/libcrypto/man/Makefile b/src/lib/libcrypto/man/Makefile index 840be62d72..5f1a24eb38 100644 --- a/src/lib/libcrypto/man/Makefile +++ b/src/lib/libcrypto/man/Makefile | |||
@@ -1,4 +1,4 @@ | |||
1 | # $OpenBSD: Makefile,v 1.158 2019/08/28 10:37:42 schwarze Exp $ | 1 | # $OpenBSD: Makefile,v 1.159 2019/11/01 12:02:58 schwarze Exp $ |
2 | 2 | ||
3 | .include <bsd.own.mk> | 3 | .include <bsd.own.mk> |
4 | 4 | ||
@@ -220,6 +220,7 @@ MAN= \ | |||
220 | RSA_meth_new.3 \ | 220 | RSA_meth_new.3 \ |
221 | RSA_new.3 \ | 221 | RSA_new.3 \ |
222 | RSA_padding_add_PKCS1_type_1.3 \ | 222 | RSA_padding_add_PKCS1_type_1.3 \ |
223 | RSA_pkey_ctx_ctrl.3 \ | ||
223 | RSA_print.3 \ | 224 | RSA_print.3 \ |
224 | RSA_private_encrypt.3 \ | 225 | RSA_private_encrypt.3 \ |
225 | RSA_public_encrypt.3 \ | 226 | RSA_public_encrypt.3 \ |
diff --git a/src/lib/libcrypto/man/RSA_new.3 b/src/lib/libcrypto/man/RSA_new.3 index b0009b8581..9efcbd0b9f 100644 --- a/src/lib/libcrypto/man/RSA_new.3 +++ b/src/lib/libcrypto/man/RSA_new.3 | |||
@@ -1,4 +1,4 @@ | |||
1 | .\" $OpenBSD: RSA_new.3,v 1.15 2019/08/23 15:18:13 schwarze Exp $ | 1 | .\" $OpenBSD: RSA_new.3,v 1.16 2019/11/01 12:02:58 schwarze Exp $ |
2 | .\" full merge up to: | 2 | .\" full merge up to: |
3 | .\" OpenSSL doc/man3/RSA_new.pod e9b77246 Jan 20 19:58:49 2017 +0100 | 3 | .\" OpenSSL doc/man3/RSA_new.pod e9b77246 Jan 20 19:58:49 2017 +0100 |
4 | .\" OpenSSL doc/crypto/rsa.pod 35d2e327 Jun 3 16:19:49 2016 -0400 (final) | 4 | .\" OpenSSL doc/crypto/rsa.pod 35d2e327 Jun 3 16:19:49 2016 -0400 (final) |
@@ -67,7 +67,7 @@ | |||
67 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 67 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
68 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 68 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
69 | .\" | 69 | .\" |
70 | .Dd $Mdocdate: August 23 2019 $ | 70 | .Dd $Mdocdate: November 1 2019 $ |
71 | .Dt RSA_NEW 3 | 71 | .Dt RSA_NEW 3 |
72 | .Os | 72 | .Os |
73 | .Sh NAME | 73 | .Sh NAME |
@@ -225,6 +225,7 @@ returns 1 for success or 0 for failure. | |||
225 | .Xr RSA_get_ex_new_index 3 , | 225 | .Xr RSA_get_ex_new_index 3 , |
226 | .Xr RSA_meth_new 3 , | 226 | .Xr RSA_meth_new 3 , |
227 | .Xr RSA_padding_add_PKCS1_type_1 3 , | 227 | .Xr RSA_padding_add_PKCS1_type_1 3 , |
228 | .Xr RSA_pkey_ctx_ctrl 3 , | ||
228 | .Xr RSA_print 3 , | 229 | .Xr RSA_print 3 , |
229 | .Xr RSA_private_encrypt 3 , | 230 | .Xr RSA_private_encrypt 3 , |
230 | .Xr RSA_PSS_PARAMS_new 3 , | 231 | .Xr RSA_PSS_PARAMS_new 3 , |
diff --git a/src/lib/libcrypto/man/RSA_pkey_ctx_ctrl.3 b/src/lib/libcrypto/man/RSA_pkey_ctx_ctrl.3 new file mode 100644 index 0000000000..866c63ad81 --- /dev/null +++ b/src/lib/libcrypto/man/RSA_pkey_ctx_ctrl.3 | |||
@@ -0,0 +1,346 @@ | |||
1 | .\" $OpenBSD: RSA_pkey_ctx_ctrl.3,v 1.1 2019/11/01 12:02:58 schwarze Exp $ | ||
2 | .\" full merge up to: | ||
3 | .\" OpenSSL man3/EVP_PKEY_CTX_ctrl 99d63d46 Oct 26 13:56:48 2016 -0400 | ||
4 | .\" selective merge up to: | ||
5 | .\" OpenSSL man3/EVP_PKEY_CTX_ctrl df75c2b f Dec 9 01:02:36 2018 +0100 | ||
6 | .\" | ||
7 | .\" This file was written by Dr. Stephen Henson <steve@openssl.org> | ||
8 | .\" and Antoine Salon <asalon@vmware.com>. | ||
9 | .\" Copyright (c) 2006, 2009, 2013, 2014, 2015, 2018 The OpenSSL Project. | ||
10 | .\" All rights reserved. | ||
11 | .\" | ||
12 | .\" Redistribution and use in source and binary forms, with or without | ||
13 | .\" modification, are permitted provided that the following conditions | ||
14 | .\" are met: | ||
15 | .\" | ||
16 | .\" 1. Redistributions of source code must retain the above copyright | ||
17 | .\" notice, this list of conditions and the following disclaimer. | ||
18 | .\" | ||
19 | .\" 2. Redistributions in binary form must reproduce the above copyright | ||
20 | .\" notice, this list of conditions and the following disclaimer in | ||
21 | .\" the documentation and/or other materials provided with the | ||
22 | .\" distribution. | ||
23 | .\" | ||
24 | .\" 3. All advertising materials mentioning features or use of this | ||
25 | .\" software must display the following acknowledgment: | ||
26 | .\" "This product includes software developed by the OpenSSL Project | ||
27 | .\" for use in the OpenSSL Toolkit. (http://www.openssl.org/)" | ||
28 | .\" | ||
29 | .\" 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to | ||
30 | .\" endorse or promote products derived from this software without | ||
31 | .\" prior written permission. For written permission, please contact | ||
32 | .\" openssl-core@openssl.org. | ||
33 | .\" | ||
34 | .\" 5. Products derived from this software may not be called "OpenSSL" | ||
35 | .\" nor may "OpenSSL" appear in their names without prior written | ||
36 | .\" permission of the OpenSSL Project. | ||
37 | .\" | ||
38 | .\" 6. Redistributions of any form whatsoever must retain the following | ||
39 | .\" acknowledgment: | ||
40 | .\" "This product includes software developed by the OpenSSL Project | ||
41 | .\" for use in the OpenSSL Toolkit (http://www.openssl.org/)" | ||
42 | .\" | ||
43 | .\" THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY | ||
44 | .\" EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
45 | .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
46 | .\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR | ||
47 | .\" ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
48 | .\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
49 | .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
50 | .\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
51 | .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
52 | .\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
53 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
54 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | ||
55 | .\" | ||
56 | .Dd $Mdocdate: November 1 2019 $ | ||
57 | .Dt RSA_PKEY_CTX_CTRL 3 | ||
58 | .Os | ||
59 | .Sh NAME | ||
60 | .Nm RSA_pkey_ctx_ctrl , | ||
61 | .Nm EVP_PKEY_CTX_set_rsa_padding , | ||
62 | .Nm EVP_PKEY_CTX_get_rsa_padding , | ||
63 | .Nm EVP_PKEY_CTX_set_rsa_pss_saltlen , | ||
64 | .Nm EVP_PKEY_CTX_get_rsa_pss_saltlen , | ||
65 | .Nm EVP_PKEY_CTX_set_rsa_keygen_bits , | ||
66 | .Nm EVP_PKEY_CTX_set_rsa_keygen_pubexp , | ||
67 | .Nm EVP_PKEY_CTX_set_rsa_mgf1_md , | ||
68 | .Nm EVP_PKEY_CTX_get_rsa_mgf1_md , | ||
69 | .Nm EVP_PKEY_CTX_set_rsa_oaep_md , | ||
70 | .Nm EVP_PKEY_CTX_get_rsa_oaep_md , | ||
71 | .Nm EVP_PKEY_CTX_set0_rsa_oaep_label , | ||
72 | .Nm EVP_PKEY_CTX_get0_rsa_oaep_label | ||
73 | .Nd RSA private key control operations | ||
74 | .Sh SYNOPSIS | ||
75 | .In openssl/rsa.h | ||
76 | .Ft int | ||
77 | .Fo RSA_pkey_ctx_ctrl | ||
78 | .Fa "EVP_PKEY_CTX *ctx" | ||
79 | .Fa "int optype" | ||
80 | .Fa "int cmd" | ||
81 | .Fa "int p1" | ||
82 | .Fa "void *p2" | ||
83 | .Fc | ||
84 | .Ft int | ||
85 | .Fo EVP_PKEY_CTX_set_rsa_padding | ||
86 | .Fa "EVP_PKEY_CTX *ctx" | ||
87 | .Fa "int pad" | ||
88 | .Fc | ||
89 | .Ft int | ||
90 | .Fo EVP_PKEY_CTX_get_rsa_padding | ||
91 | .Fa "EVP_PKEY_CTX *ctx" | ||
92 | .Fa "int *ppad" | ||
93 | .Fc | ||
94 | .Ft int | ||
95 | .Fo EVP_PKEY_CTX_set_rsa_pss_saltlen | ||
96 | .Fa "EVP_PKEY_CTX *ctx" | ||
97 | .Fa "int len" | ||
98 | .Fc | ||
99 | .Ft int | ||
100 | .Fo EVP_PKEY_CTX_get_rsa_pss_saltlen | ||
101 | .Fa "EVP_PKEY_CTX *ctx" | ||
102 | .Fa "int *plen" | ||
103 | .Fc | ||
104 | .Ft int | ||
105 | .Fo EVP_PKEY_CTX_set_rsa_keygen_bits | ||
106 | .Fa "EVP_PKEY_CTX *ctx" | ||
107 | .Fa "int mbits" | ||
108 | .Fc | ||
109 | .Ft int | ||
110 | .Fo EVP_PKEY_CTX_set_rsa_keygen_pubexp | ||
111 | .Fa "EVP_PKEY_CTX *ctx" | ||
112 | .Fa "BIGNUM *pubexp" | ||
113 | .Fc | ||
114 | .Ft int | ||
115 | .Fo EVP_PKEY_CTX_set_rsa_mgf1_md | ||
116 | .Fa "EVP_PKEY_CTX *ctx" | ||
117 | .Fa "const EVP_MD *md" | ||
118 | .Fc | ||
119 | .Ft int | ||
120 | .Fo EVP_PKEY_CTX_get_rsa_mgf1_md | ||
121 | .Fa "EVP_PKEY_CTX *ctx" | ||
122 | .Fa "const EVP_MD **pmd" | ||
123 | .Fc | ||
124 | .Ft int | ||
125 | .Fo EVP_PKEY_CTX_set_rsa_oaep_md | ||
126 | .Fa "EVP_PKEY_CTX *ctx" | ||
127 | .Fa "const EVP_MD *md" | ||
128 | .Fc | ||
129 | .Ft int | ||
130 | .Fo EVP_PKEY_CTX_get_rsa_oaep_md | ||
131 | .Fa "EVP_PKEY_CTX *ctx" | ||
132 | .Fa "const EVP_MD **pmd" | ||
133 | .Fc | ||
134 | .Ft int | ||
135 | .Fo EVP_PKEY_CTX_set0_rsa_oaep_label | ||
136 | .Fa "EVP_PKEY_CTX *ctx" | ||
137 | .Fa "unsigned char *label" | ||
138 | .Fa "int len" | ||
139 | .Fc | ||
140 | .Ft int | ||
141 | .Fo EVP_PKEY_CTX_get0_rsa_oaep_label | ||
142 | .Fa "EVP_PKEY_CTX *ctx" | ||
143 | .Fa "unsigned char **plabel" | ||
144 | .Fc | ||
145 | .Sh DESCRIPTION | ||
146 | The function | ||
147 | .Fn RSA_pkey_ctx_ctrl | ||
148 | is a shallow wrapper around | ||
149 | .Xr EVP_PKEY_CTX_ctrl 3 | ||
150 | which only succeeds if | ||
151 | .Fa ctx | ||
152 | matches either | ||
153 | .Dv EVP_PKEY_RSA | ||
154 | or | ||
155 | .Dv EVP_PKEY_RSA_PSS . | ||
156 | .Pp | ||
157 | All the remaining "functions" are implemented as macros. | ||
158 | .Pp | ||
159 | The | ||
160 | .Fn EVP_PKEY_CTX_set_rsa_padding | ||
161 | macro sets the RSA padding mode for | ||
162 | .Fa ctx . | ||
163 | The | ||
164 | .Fa pad | ||
165 | parameter can take the value | ||
166 | .Dv RSA_PKCS1_PADDING | ||
167 | for PKCS#1 padding, | ||
168 | .Dv RSA_NO_PADDING | ||
169 | for no padding, | ||
170 | .Dv RSA_PKCS1_OAEP_PADDING | ||
171 | for OAEP padding (encrypt and decrypt only), | ||
172 | .Dv RSA_X931_PADDING | ||
173 | for X9.31 padding (signature operations only) and | ||
174 | .Dv RSA_PKCS1_PSS_PADDING | ||
175 | (sign and verify only). | ||
176 | .Pp | ||
177 | Two RSA padding modes behave differently if | ||
178 | .Fn EVP_PKEY_CTX_set_signature_md | ||
179 | is used. | ||
180 | If this macro is called for PKCS#1 padding, the plaintext buffer is an | ||
181 | actual digest value and is encapsulated in a | ||
182 | .Vt DigestInfo | ||
183 | structure according to PKCS#1 when signing and this structure is | ||
184 | expected (and stripped off) when verifying. | ||
185 | If this control is not used with RSA and PKCS#1 padding then the | ||
186 | supplied data is used directly and not encapsulated. | ||
187 | In the case of X9.31 padding for RSA the algorithm identifier byte is | ||
188 | added or checked and removed if this control is called. | ||
189 | If it is not called then the first byte of the plaintext buffer is | ||
190 | expected to be the algorithm identifier byte. | ||
191 | .Pp | ||
192 | The | ||
193 | .Fn EVP_PKEY_CTX_get_rsa_padding | ||
194 | macro retrieves the RSA padding mode for | ||
195 | .Fa ctx . | ||
196 | .Pp | ||
197 | The | ||
198 | .Fn EVP_PKEY_CTX_set_rsa_pss_saltlen | ||
199 | macro sets the RSA PSS salt length to | ||
200 | .Fa len . | ||
201 | As its name implies, it is only supported for PSS padding. | ||
202 | Two special values are supported: -1 sets the salt length to the digest | ||
203 | length. | ||
204 | When signing -2 sets the salt length to the maximum permissible value. | ||
205 | When verifying -2 causes the salt length to be automatically determined | ||
206 | based on the PSS block structure. | ||
207 | If this macro is not called a salt length value of -2 is used by | ||
208 | default. | ||
209 | .Pp | ||
210 | The | ||
211 | .Fn EVP_PKEY_CTX_get_rsa_pss_saltlen | ||
212 | macro retrieves the RSA PSS salt length for | ||
213 | .Fa ctx . | ||
214 | The padding mode must have been set to | ||
215 | .Dv RSA_PKCS1_PSS_PADDING . | ||
216 | .Pp | ||
217 | The | ||
218 | .Fn EVP_PKEY_CTX_set_rsa_keygen_bits | ||
219 | macro sets the RSA key length for RSA key generation to | ||
220 | .Fa mbits . | ||
221 | The smallest supported value is 512 bits. | ||
222 | If not specified, 1024 bits is used. | ||
223 | .Pp | ||
224 | The | ||
225 | .Fn EVP_PKEY_CTX_set_rsa_keygen_pubexp | ||
226 | macro sets the public exponent value for RSA key generation to | ||
227 | .Fa pubexp . | ||
228 | Currently, it should be an odd integer. | ||
229 | The | ||
230 | .Fa pubexp | ||
231 | pointer is used internally by this function, so it should not be modified | ||
232 | or freed after the call. | ||
233 | If this macro is not called, then 65537 is used. | ||
234 | .Pp | ||
235 | The | ||
236 | .Fn EVP_PKEY_CTX_set_rsa_mgf1_md | ||
237 | macro sets the MGF1 digest for RSA padding schemes to | ||
238 | .Fa md . | ||
239 | Unless explicitly specified, the signing digest is used. | ||
240 | The padding mode must have been set to | ||
241 | .Dv RSA_PKCS1_OAEP_PADDING | ||
242 | or | ||
243 | .Dv RSA_PKCS1_PSS_PADDING . | ||
244 | .Pp | ||
245 | The | ||
246 | .Fn EVP_PKEY_CTX_get_rsa_mgf1_md | ||
247 | macro retrieves the MGF1 digest for | ||
248 | .Fa ctx . | ||
249 | Unless explicitly specified, the signing digest is used. | ||
250 | The padding mode must have been set to | ||
251 | .Dv RSA_PKCS1_OAEP_PADDING | ||
252 | or | ||
253 | .Dv RSA_PKCS1_PSS_PADDING . | ||
254 | .Pp | ||
255 | The | ||
256 | .Fn EVP_PKEY_CTX_set_rsa_oaep_md | ||
257 | macro sets the message digest type used in RSA OAEP to | ||
258 | .Fa md . | ||
259 | The padding mode must have been set to | ||
260 | .Dv RSA_PKCS1_OAEP_PADDING . | ||
261 | .Pp | ||
262 | The | ||
263 | .Fn EVP_PKEY_CTX_get_rsa_oaep_md | ||
264 | macro gets the message digest type used in RSA OAEP to | ||
265 | .Pf * Fa md . | ||
266 | The padding mode must have been set to | ||
267 | .Dv RSA_PKCS1_OAEP_PADDING . | ||
268 | .Pp | ||
269 | The | ||
270 | .Fn EVP_PKEY_CTX_set0_rsa_oaep_label | ||
271 | macro sets the RSA OAEP label to | ||
272 | .Fa label | ||
273 | and its length to | ||
274 | .Fa len . | ||
275 | If | ||
276 | .Fa label | ||
277 | is | ||
278 | .Dv NULL | ||
279 | or | ||
280 | .Fa len | ||
281 | is 0, the label is cleared. | ||
282 | The library takes ownership of the label so the caller should not | ||
283 | free the original memory pointed to by | ||
284 | .Fa label . | ||
285 | The padding mode must have been set to | ||
286 | .Dv RSA_PKCS1_OAEP_PADDING . | ||
287 | .Pp | ||
288 | The | ||
289 | .Fn EVP_PKEY_CTX_get0_rsa_oaep_label | ||
290 | macro gets the RSA OAEP label to | ||
291 | .Pf * Fa plabel . | ||
292 | The return value is the label length. | ||
293 | The padding mode must have been set to | ||
294 | .Dv RSA_PKCS1_OAEP_PADDING . | ||
295 | The resulting pointer is owned by the library and should not be | ||
296 | freed by the caller. | ||
297 | .Sh RETURN VALUES | ||
298 | These functions return a positive value for success or 0 or a negative | ||
299 | value for failure. | ||
300 | In particular, a return value of -2 indicates the operation is not | ||
301 | supported by the public key algorithm. | ||
302 | .Sh SEE ALSO | ||
303 | .Xr EVP_DigestInit 3 , | ||
304 | .Xr EVP_PKEY_CTX_ctrl 3 , | ||
305 | .Xr EVP_PKEY_CTX_new 3 , | ||
306 | .Xr EVP_PKEY_decrypt 3 , | ||
307 | .Xr EVP_PKEY_derive 3 , | ||
308 | .Xr EVP_PKEY_encrypt 3 , | ||
309 | .Xr EVP_PKEY_get_default_digest_nid 3 , | ||
310 | .Xr EVP_PKEY_keygen 3 , | ||
311 | .Xr EVP_PKEY_meth_set_ctrl 3 , | ||
312 | .Xr EVP_PKEY_sign 3 , | ||
313 | .Xr EVP_PKEY_verify 3 , | ||
314 | .Xr EVP_PKEY_verify_recover 3 | ||
315 | .Sh HISTORY | ||
316 | The functions | ||
317 | .Fn EVP_PKEY_CTX_set_rsa_padding , | ||
318 | .Fn EVP_PKEY_CTX_set_rsa_pss_saltlen , | ||
319 | .Fn EVP_PKEY_CTX_set_rsa_keygen_bits , | ||
320 | and | ||
321 | .Fn EVP_PKEY_CTX_set_rsa_keygen_pubexp | ||
322 | first appeared in OpenSSL 1.0.0 and have been available since | ||
323 | .Ox 4.9 . | ||
324 | .Pp | ||
325 | The functions | ||
326 | .Fn EVP_PKEY_CTX_get_rsa_padding , | ||
327 | .Fn EVP_PKEY_CTX_get_rsa_pss_saltlen , | ||
328 | .Fn EVP_PKEY_CTX_set_rsa_mgf1_md , | ||
329 | and | ||
330 | .Fn EVP_PKEY_CTX_get_rsa_mgf1_md | ||
331 | first appeared in OpenSSL 1.0.1 and have been available since | ||
332 | .Ox 5.3 . | ||
333 | .Pp | ||
334 | The functions | ||
335 | .Fn EVP_PKEY_CTX_set_rsa_oaep_md , | ||
336 | .Fn EVP_PKEY_CTX_get_rsa_oaep_md , | ||
337 | .Fn EVP_PKEY_CTX_set0_rsa_oaep_label , | ||
338 | and | ||
339 | .Fn EVP_PKEY_CTX_get0_rsa_oaep_label | ||
340 | first appeared in OpenSSL 1.0.2 and have been available since | ||
341 | .Ox 6.7 . | ||
342 | .Pp | ||
343 | The function | ||
344 | .Fn RSA_pkey_ctx_ctrl | ||
345 | first appeared in OpenSSL 1.1.1 and has been available since | ||
346 | .Ox 6.7 . | ||