diff options
author | schwarze <> | 2019-08-12 11:36:12 +0000 |
---|---|---|
committer | schwarze <> | 2019-08-12 11:36:12 +0000 |
commit | bdc04c952ed85d439a8b627641a8b04d8de86e39 (patch) | |
tree | 3d97cfb5b467b522eb8795a11ca40e72633feeb0 /src | |
parent | 4ba577c0428988318e1a0816d7733abdf7fc934b (diff) | |
download | openbsd-bdc04c952ed85d439a8b627641a8b04d8de86e39.tar.gz openbsd-bdc04c952ed85d439a8b627641a8b04d8de86e39.tar.bz2 openbsd-bdc04c952ed85d439a8b627641a8b04d8de86e39.zip |
merge a few minor improvements from the OpenSSL 1.1.1 branch,
which is still under a free license:
* mention pem_password_cb in NAME and SYNOPSIS
* recommend -1 as pem_password_cb error return for OpenSSL compat
* minor improvements to the pass_cb() example code
* mention that the pass phrase is just a byte sequence
* and minor wording and markup improvements
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/libcrypto/man/PEM_read_bio_PrivateKey.3 | 50 |
1 files changed, 35 insertions, 15 deletions
diff --git a/src/lib/libcrypto/man/PEM_read_bio_PrivateKey.3 b/src/lib/libcrypto/man/PEM_read_bio_PrivateKey.3 index 4a4f04a259..ca61f31f87 100644 --- a/src/lib/libcrypto/man/PEM_read_bio_PrivateKey.3 +++ b/src/lib/libcrypto/man/PEM_read_bio_PrivateKey.3 | |||
@@ -1,5 +1,7 @@ | |||
1 | .\" $OpenBSD: PEM_read_bio_PrivateKey.3,v 1.14 2019/06/06 01:06:58 schwarze Exp $ | 1 | .\" $OpenBSD: PEM_read_bio_PrivateKey.3,v 1.15 2019/08/12 11:36:12 schwarze Exp $ |
2 | .\" OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400 | 2 | .\" full merge up to: |
3 | .\" OpenSSL man3/PEM_read_bio_PrivateKey.pod 18bad535 Apr 9 15:13:55 2019 +0100 | ||
4 | .\" OpenSSL man3/PEM_read_CMS.pod 83cf7abf May 29 13:07:08 2018 +0100 | ||
3 | .\" | 5 | .\" |
4 | .\" This file was written by Dr. Stephen Henson <steve@openssl.org>. | 6 | .\" This file was written by Dr. Stephen Henson <steve@openssl.org>. |
5 | .\" Copyright (c) 2001-2004, 2009, 2013-2016 The OpenSSL Project. | 7 | .\" Copyright (c) 2001-2004, 2009, 2013-2016 The OpenSSL Project. |
@@ -49,10 +51,11 @@ | |||
49 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 51 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
50 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 52 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
51 | .\" | 53 | .\" |
52 | .Dd $Mdocdate: June 6 2019 $ | 54 | .Dd $Mdocdate: August 12 2019 $ |
53 | .Dt PEM_READ_BIO_PRIVATEKEY 3 | 55 | .Dt PEM_READ_BIO_PRIVATEKEY 3 |
54 | .Os | 56 | .Os |
55 | .Sh NAME | 57 | .Sh NAME |
58 | .Nm pem_password_cb , | ||
56 | .Nm PEM_read_bio_PrivateKey , | 59 | .Nm PEM_read_bio_PrivateKey , |
57 | .Nm PEM_read_PrivateKey , | 60 | .Nm PEM_read_PrivateKey , |
58 | .Nm PEM_write_bio_PrivateKey , | 61 | .Nm PEM_write_bio_PrivateKey , |
@@ -142,6 +145,13 @@ | |||
142 | .Nd PEM routines | 145 | .Nd PEM routines |
143 | .Sh SYNOPSIS | 146 | .Sh SYNOPSIS |
144 | .In openssl/pem.h | 147 | .In openssl/pem.h |
148 | .Ft typedef int | ||
149 | .Fo pem_password_cb | ||
150 | .Fa "char *buf" | ||
151 | .Fa "int size" | ||
152 | .Fa "int rwflag" | ||
153 | .Fa "void *u" | ||
154 | .Fc | ||
145 | .Ft EVP_PKEY * | 155 | .Ft EVP_PKEY * |
146 | .Fo PEM_read_bio_PrivateKey | 156 | .Fo PEM_read_bio_PrivateKey |
147 | .Fa "BIO *bp" | 157 | .Fa "BIO *bp" |
@@ -722,14 +732,14 @@ For more details about the meaning of arguments see the | |||
722 | section. | 732 | section. |
723 | .Pp | 733 | .Pp |
724 | Each operation has four functions associated with it. | 734 | Each operation has four functions associated with it. |
725 | For clarity the term | 735 | For brevity the term |
726 | .Dq Sy foobar No functions | 736 | .Dq Ar TYPE No functions |
727 | will be used to collectively refer to the | 737 | will be used to collectively refer to the |
728 | .Fn PEM_read_bio_foobar , | 738 | .Fn PEM_read_bio_TYPE , |
729 | .Fn PEM_read_foobar , | 739 | .Fn PEM_read_TYPE , |
730 | .Fn PEM_write_bio_foobar , | 740 | .Fn PEM_write_bio_TYPE , |
731 | and | 741 | and |
732 | .Fn PEM_write_foobar | 742 | .Fn PEM_write_TYPE |
733 | functions. | 743 | functions. |
734 | .Pp | 744 | .Pp |
735 | The | 745 | The |
@@ -1073,7 +1083,7 @@ parameter passed to the PEM routine. | |||
1073 | It allows arbitrary data to be passed to the callback by the application | 1083 | It allows arbitrary data to be passed to the callback by the application |
1074 | (for example a window handle in a GUI application). | 1084 | (for example a window handle in a GUI application). |
1075 | The callback must return the number of characters in the passphrase | 1085 | The callback must return the number of characters in the passphrase |
1076 | or 0 if an error occurred. | 1086 | or -1 if an error occurred. |
1077 | .Ss PEM encryption format | 1087 | .Ss PEM encryption format |
1078 | This old | 1088 | This old |
1079 | .Sy PrivateKey | 1089 | .Sy PrivateKey |
@@ -1193,18 +1203,24 @@ Skeleton pass phrase callback: | |||
1193 | int | 1203 | int |
1194 | pass_cb(char *buf, int size, int rwflag, void *u) | 1204 | pass_cb(char *buf, int size, int rwflag, void *u) |
1195 | { | 1205 | { |
1196 | int len; | 1206 | char *tmp; |
1197 | char *tmp; | 1207 | size_t len; |
1198 | 1208 | ||
1199 | /* We'd probably do something else if 'rwflag' is 1 */ | 1209 | /* We'd probably do something else if 'rwflag' is 1 */ |
1200 | printf("Enter pass phrase for \e"%s\e"\en", u); | 1210 | printf("Enter pass phrase for \e"%s\e"\en", u); |
1201 | 1211 | ||
1202 | /* get pass phrase, length 'len' into 'tmp' */ | 1212 | /* |
1213 | * Instead of the following line, get the passphrase | ||
1214 | * from the user in some way. | ||
1215 | */ | ||
1203 | tmp = "hello"; | 1216 | tmp = "hello"; |
1217 | if (tmp == NULL) /* An error occurred. */ | ||
1218 | return -1; | ||
1219 | |||
1204 | len = strlen(tmp); | 1220 | len = strlen(tmp); |
1221 | if (len == 0) /* Treat an empty passphrase as an error, too. */ | ||
1222 | return -1; | ||
1205 | 1223 | ||
1206 | if (len == 0) | ||
1207 | return 0; | ||
1208 | /* if too long, truncate */ | 1224 | /* if too long, truncate */ |
1209 | if (len > size) | 1225 | if (len > size) |
1210 | len = size; | 1226 | len = size; |
@@ -1346,6 +1362,10 @@ PEM_read_bio_X509(bp, &x, 0, NULL); | |||
1346 | This is a bug because an attempt will be made to reuse the data at | 1362 | This is a bug because an attempt will be made to reuse the data at |
1347 | .Fa x , | 1363 | .Fa x , |
1348 | which is an uninitialised pointer. | 1364 | which is an uninitialised pointer. |
1365 | .Pp | ||
1366 | These functions make no assumption regarding the pass phrase received | ||
1367 | from the password callback. | ||
1368 | It will simply be treated as a byte sequence. | ||
1349 | .Sh BUGS | 1369 | .Sh BUGS |
1350 | The PEM read routines in some versions of OpenSSL will not correctly | 1370 | The PEM read routines in some versions of OpenSSL will not correctly |
1351 | reuse an existing structure. | 1371 | reuse an existing structure. |