diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/libcrypto/man/EVP_PKEY_encrypt.3 | 69 | ||||
-rw-r--r-- | src/lib/libcrypto/man/EVP_PKEY_keygen.3 | 62 |
2 files changed, 119 insertions, 12 deletions
diff --git a/src/lib/libcrypto/man/EVP_PKEY_encrypt.3 b/src/lib/libcrypto/man/EVP_PKEY_encrypt.3 index 0e1c72e270..7309c3478b 100644 --- a/src/lib/libcrypto/man/EVP_PKEY_encrypt.3 +++ b/src/lib/libcrypto/man/EVP_PKEY_encrypt.3 | |||
@@ -1,6 +1,55 @@ | |||
1 | .\" $OpenBSD: EVP_PKEY_encrypt.3,v 1.3 2016/11/21 22:19:15 jmc Exp $ | 1 | .\" $OpenBSD: EVP_PKEY_encrypt.3,v 1.4 2016/11/27 15:23:29 schwarze Exp $ |
2 | .\" OpenSSL b97fdb57 Nov 11 09:33:09 2016 +0100 | ||
2 | .\" | 3 | .\" |
3 | .Dd $Mdocdate: November 21 2016 $ | 4 | .\" This file was written by Dr. Stephen Henson <steve@openssl.org>. |
5 | .\" Copyright (c) 2006, 2009, 2013, 2014, 2016 The OpenSSL Project. | ||
6 | .\" All rights reserved. | ||
7 | .\" | ||
8 | .\" Redistribution and use in source and binary forms, with or without | ||
9 | .\" modification, are permitted provided that the following conditions | ||
10 | .\" are met: | ||
11 | .\" | ||
12 | .\" 1. Redistributions of source code must retain the above copyright | ||
13 | .\" notice, this list of conditions and the following disclaimer. | ||
14 | .\" | ||
15 | .\" 2. Redistributions in binary form must reproduce the above copyright | ||
16 | .\" notice, this list of conditions and the following disclaimer in | ||
17 | .\" the documentation and/or other materials provided with the | ||
18 | .\" distribution. | ||
19 | .\" | ||
20 | .\" 3. All advertising materials mentioning features or use of this | ||
21 | .\" software must display the following acknowledgment: | ||
22 | .\" "This product includes software developed by the OpenSSL Project | ||
23 | .\" for use in the OpenSSL Toolkit. (http://www.openssl.org/)" | ||
24 | .\" | ||
25 | .\" 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to | ||
26 | .\" endorse or promote products derived from this software without | ||
27 | .\" prior written permission. For written permission, please contact | ||
28 | .\" openssl-core@openssl.org. | ||
29 | .\" | ||
30 | .\" 5. Products derived from this software may not be called "OpenSSL" | ||
31 | .\" nor may "OpenSSL" appear in their names without prior written | ||
32 | .\" permission of the OpenSSL Project. | ||
33 | .\" | ||
34 | .\" 6. Redistributions of any form whatsoever must retain the following | ||
35 | .\" acknowledgment: | ||
36 | .\" "This product includes software developed by the OpenSSL Project | ||
37 | .\" for use in the OpenSSL Toolkit (http://www.openssl.org/)" | ||
38 | .\" | ||
39 | .\" THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY | ||
40 | .\" EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
41 | .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
42 | .\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR | ||
43 | .\" ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
44 | .\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
45 | .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
46 | .\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
47 | .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
48 | .\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
49 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
50 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | ||
51 | .\" | ||
52 | .Dd $Mdocdate: November 27 2016 $ | ||
4 | .Dt EVP_PKEY_ENCRYPT 3 | 53 | .Dt EVP_PKEY_ENCRYPT 3 |
5 | .Os | 54 | .Os |
6 | .Sh NAME | 55 | .Sh NAME |
@@ -75,19 +124,29 @@ return 1 for success and 0 or a negative value for failure. | |||
75 | In particular, a return value of -2 indicates the operation is not | 124 | In particular, a return value of -2 indicates the operation is not |
76 | supported by the public key algorithm. | 125 | supported by the public key algorithm. |
77 | .Sh EXAMPLES | 126 | .Sh EXAMPLES |
78 | Encrypt data using OAEP (for RSA keys): | 127 | Encrypt data using OAEP (for RSA keys). |
128 | See also | ||
129 | .Xr PEM_read_PUBKEY 3 | ||
130 | and | ||
131 | .Xr d2i_X509 3 | ||
132 | for means to load a public key. | ||
133 | You may also simply set | ||
134 | .Ql eng = NULL; | ||
135 | to start with the default OpenSSL RSA implementation: | ||
79 | .Bd -literal -offset indent | 136 | .Bd -literal -offset indent |
80 | #include <openssl/evp.h> | 137 | #include <openssl/evp.h> |
81 | #include <openssl/rsa.h> | 138 | #include <openssl/rsa.h> |
139 | #include <openssl/engine.h> | ||
82 | 140 | ||
83 | EVP_PKEY_CTX *ctx; | 141 | EVP_PKEY_CTX *ctx; |
142 | ENGINE *eng; | ||
84 | unsigned char *out, *in; | 143 | unsigned char *out, *in; |
85 | size_t outlen, inlen; | 144 | size_t outlen, inlen; |
86 | EVP_PKEY *key; | 145 | EVP_PKEY *key; |
87 | /* NB: assumes key in, inlen are already set up | 146 | /* NB: assumes eng, key in, inlen are already set up |
88 | * and that key is an RSA public key | 147 | * and that key is an RSA public key |
89 | */ | 148 | */ |
90 | ctx = EVP_PKEY_CTX_new(key); | 149 | ctx = EVP_PKEY_CTX_new(key, eng); |
91 | if (!ctx) | 150 | if (!ctx) |
92 | /* Error occurred */ | 151 | /* Error occurred */ |
93 | if (EVP_PKEY_encrypt_init(ctx) <= 0) | 152 | if (EVP_PKEY_encrypt_init(ctx) <= 0) |
diff --git a/src/lib/libcrypto/man/EVP_PKEY_keygen.3 b/src/lib/libcrypto/man/EVP_PKEY_keygen.3 index fd64e1eb66..ba26bb684d 100644 --- a/src/lib/libcrypto/man/EVP_PKEY_keygen.3 +++ b/src/lib/libcrypto/man/EVP_PKEY_keygen.3 | |||
@@ -1,6 +1,54 @@ | |||
1 | .\" $OpenBSD: EVP_PKEY_keygen.3,v 1.3 2016/11/21 22:19:15 jmc Exp $ | 1 | .\" $OpenBSD: EVP_PKEY_keygen.3,v 1.4 2016/11/27 15:23:29 schwarze Exp $ |
2 | .\" OpenSSL 99d63d466 Oct 26 13:56:48 2016 -0400 | ||
2 | .\" | 3 | .\" |
3 | .Dd $Mdocdate: November 21 2016 $ | 4 | .\" This file was written by Dr. Stephen Henson <steve@openssl.org>. |
5 | .\" Copyright (c) 2006, 2009, 2013, 2015, 2016 The OpenSSL Project. All rights reserved. | ||
6 | .\" | ||
7 | .\" Redistribution and use in source and binary forms, with or without | ||
8 | .\" modification, are permitted provided that the following conditions | ||
9 | .\" are met: | ||
10 | .\" | ||
11 | .\" 1. Redistributions of source code must retain the above copyright | ||
12 | .\" notice, this list of conditions and the following disclaimer. | ||
13 | .\" | ||
14 | .\" 2. Redistributions in binary form must reproduce the above copyright | ||
15 | .\" notice, this list of conditions and the following disclaimer in | ||
16 | .\" the documentation and/or other materials provided with the | ||
17 | .\" distribution. | ||
18 | .\" | ||
19 | .\" 3. All advertising materials mentioning features or use of this | ||
20 | .\" software must display the following acknowledgment: | ||
21 | .\" "This product includes software developed by the OpenSSL Project | ||
22 | .\" for use in the OpenSSL Toolkit. (http://www.openssl.org/)" | ||
23 | .\" | ||
24 | .\" 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to | ||
25 | .\" endorse or promote products derived from this software without | ||
26 | .\" prior written permission. For written permission, please contact | ||
27 | .\" openssl-core@openssl.org. | ||
28 | .\" | ||
29 | .\" 5. Products derived from this software may not be called "OpenSSL" | ||
30 | .\" nor may "OpenSSL" appear in their names without prior written | ||
31 | .\" permission of the OpenSSL Project. | ||
32 | .\" | ||
33 | .\" 6. Redistributions of any form whatsoever must retain the following | ||
34 | .\" acknowledgment: | ||
35 | .\" "This product includes software developed by the OpenSSL Project | ||
36 | .\" for use in the OpenSSL Toolkit (http://www.openssl.org/)" | ||
37 | .\" | ||
38 | .\" THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY | ||
39 | .\" EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
40 | .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
41 | .\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR | ||
42 | .\" ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
43 | .\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
44 | .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
45 | .\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
46 | .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
47 | .\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
48 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
49 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | ||
50 | .\" | ||
51 | .Dd $Mdocdate: November 27 2016 $ | ||
4 | .Dt EVP_PKEY_KEYGEN 3 | 52 | .Dt EVP_PKEY_KEYGEN 3 |
5 | .Os | 53 | .Os |
6 | .Sh NAME | 54 | .Sh NAME |
@@ -213,14 +261,14 @@ genpkey_cb(EVP_PKEY_CTX *ctx) | |||
213 | 261 | ||
214 | p = EVP_PKEY_CTX_get_keygen_info(ctx, 0); | 262 | p = EVP_PKEY_CTX_get_keygen_info(ctx, 0); |
215 | if (p == 0) | 263 | if (p == 0) |
216 | c='.'; | 264 | c = '.'; |
217 | if (p == 1) | 265 | if (p == 1) |
218 | c='+'; | 266 | c = '+'; |
219 | if (p == 2) | 267 | if (p == 2) |
220 | c='*'; | 268 | c = '*'; |
221 | if (p == 3) | 269 | if (p == 3) |
222 | c='\en'; | 270 | c = '\en'; |
223 | BIO_write(b,&c,1); | 271 | BIO_write(b, &c, 1); |
224 | (void)BIO_flush(b); | 272 | (void)BIO_flush(b); |
225 | return 1; | 273 | return 1; |
226 | } | 274 | } |