diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/libcrypto/man/Makefile | 3 | ||||
| -rw-r--r-- | src/lib/libcrypto/man/PKCS7_dataFinal.3 | 157 | ||||
| -rw-r--r-- | src/lib/libcrypto/man/PKCS7_new.3 | 5 |
3 files changed, 162 insertions, 3 deletions
diff --git a/src/lib/libcrypto/man/Makefile b/src/lib/libcrypto/man/Makefile index 5468ba9869..8af0c34d2b 100644 --- a/src/lib/libcrypto/man/Makefile +++ b/src/lib/libcrypto/man/Makefile | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | # $OpenBSD: Makefile,v 1.163 2020/05/24 12:37:30 schwarze Exp $ | 1 | # $OpenBSD: Makefile,v 1.164 2020/05/27 12:00:44 schwarze Exp $ |
| 2 | 2 | ||
| 3 | .include <bsd.own.mk> | 3 | .include <bsd.own.mk> |
| 4 | 4 | ||
| @@ -214,6 +214,7 @@ MAN= \ | |||
| 214 | PKCS12_parse.3 \ | 214 | PKCS12_parse.3 \ |
| 215 | PKCS12_SAFEBAG_new.3 \ | 215 | PKCS12_SAFEBAG_new.3 \ |
| 216 | PKCS5_PBKDF2_HMAC.3 \ | 216 | PKCS5_PBKDF2_HMAC.3 \ |
| 217 | PKCS7_dataFinal.3 \ | ||
| 217 | PKCS7_dataInit.3 \ | 218 | PKCS7_dataInit.3 \ |
| 218 | PKCS7_decrypt.3 \ | 219 | PKCS7_decrypt.3 \ |
| 219 | PKCS7_encrypt.3 \ | 220 | PKCS7_encrypt.3 \ |
diff --git a/src/lib/libcrypto/man/PKCS7_dataFinal.3 b/src/lib/libcrypto/man/PKCS7_dataFinal.3 new file mode 100644 index 0000000000..f9cdd62f60 --- /dev/null +++ b/src/lib/libcrypto/man/PKCS7_dataFinal.3 | |||
| @@ -0,0 +1,157 @@ | |||
| 1 | .\" $OpenBSD: PKCS7_dataFinal.3,v 1.1 2020/05/27 12:00:44 schwarze Exp $ | ||
| 2 | .\" | ||
| 3 | .\" Copyright (c) 2020 Ingo Schwarze <schwarze@openbsd.org> | ||
| 4 | .\" | ||
| 5 | .\" Permission to use, copy, modify, and distribute this software for any | ||
| 6 | .\" purpose with or without fee is hereby granted, provided that the above | ||
| 7 | .\" copyright notice and this permission notice appear in all copies. | ||
| 8 | .\" | ||
| 9 | .\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
| 10 | .\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
| 11 | .\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
| 12 | .\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
| 13 | .\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
| 16 | .\" | ||
| 17 | .Dd $Mdocdate: May 27 2020 $ | ||
| 18 | .Dt PKCS7_DATAFINAL 3 | ||
| 19 | .Os | ||
| 20 | .Sh NAME | ||
| 21 | .Nm PKCS7_dataFinal | ||
| 22 | .Nd move data from a BIO chain to a ContentInfo object | ||
| 23 | .Sh SYNOPSIS | ||
| 24 | .In openssl/pkcs7.h | ||
| 25 | .Ft int | ||
| 26 | .Fo PKCS7_dataFinal | ||
| 27 | .Fa "PKCS7 *p7" | ||
| 28 | .Fa "BIO *chain" | ||
| 29 | .Fc | ||
| 30 | .Sh DESCRIPTION | ||
| 31 | .Fn PKCS7_dataFinal | ||
| 32 | transfers the data from the memory BIO at the end of the given | ||
| 33 | .Fa chain | ||
| 34 | into the appropriate content field of | ||
| 35 | .Fa p7 | ||
| 36 | itself or of its appropriate substructure. | ||
| 37 | It is typically used as the final step of populating | ||
| 38 | .Fa p7 , | ||
| 39 | after creating the | ||
| 40 | .Fa chain | ||
| 41 | with | ||
| 42 | .Xr PKCS7_dataInit 3 | ||
| 43 | and after writing the data into it. | ||
| 44 | .Pp | ||
| 45 | After calling | ||
| 46 | .Fn PKCS7_dataFinal , | ||
| 47 | the program can call | ||
| 48 | .Xr BIO_free_all 3 | ||
| 49 | on the | ||
| 50 | .Fa chain | ||
| 51 | because such chains are not designed for reuse. | ||
| 52 | .Pp | ||
| 53 | Depending on the | ||
| 54 | .Fa contentType | ||
| 55 | of | ||
| 56 | .Fa p7 , | ||
| 57 | .Fn PKCS7_dataFinal | ||
| 58 | sets the following fields: | ||
| 59 | .Bl -tag -width Ds | ||
| 60 | .It for Vt SignedData No or Vt DigestedData : | ||
| 61 | in substructures of the | ||
| 62 | .Fa content | ||
| 63 | field of | ||
| 64 | .Fa p7 : | ||
| 65 | the | ||
| 66 | .Fa content | ||
| 67 | field in the | ||
| 68 | .Vt ContentInfo | ||
| 69 | structure (unless | ||
| 70 | .Fa p7 | ||
| 71 | is configured to store a detached signature) and the | ||
| 72 | .Fa encryptedDigest | ||
| 73 | fields in all the | ||
| 74 | .Vt SignerInfo | ||
| 75 | structures | ||
| 76 | .It for Vt EnvelopedData No or Vt SignedAndEnvelopedData : | ||
| 77 | the | ||
| 78 | .Fa encryptedContent | ||
| 79 | field in the | ||
| 80 | .Vt EncryptedContentInfo | ||
| 81 | structure contained in the | ||
| 82 | .Fa content | ||
| 83 | field of | ||
| 84 | .Fa p7 | ||
| 85 | .It for arbitrary data : | ||
| 86 | the | ||
| 87 | .Fa content | ||
| 88 | field of | ||
| 89 | .Fa p7 | ||
| 90 | itself | ||
| 91 | .El | ||
| 92 | .Sh RETURN VALUES | ||
| 93 | .Fn PKCS7_dataFinal | ||
| 94 | returns 1 on success or 0 on failure. | ||
| 95 | .Pp | ||
| 96 | Possible reasons for failure include: | ||
| 97 | .Pp | ||
| 98 | .Bl -dash -compact -offset 2n -width 1n | ||
| 99 | .It | ||
| 100 | .Fa p7 | ||
| 101 | is | ||
| 102 | .Dv NULL . | ||
| 103 | .It | ||
| 104 | The | ||
| 105 | .Fa content | ||
| 106 | field of | ||
| 107 | .Fa p7 | ||
| 108 | is empty. | ||
| 109 | .It | ||
| 110 | The | ||
| 111 | .Fa contentType | ||
| 112 | of | ||
| 113 | .Fa p7 | ||
| 114 | is unsupported. | ||
| 115 | .It | ||
| 116 | The | ||
| 117 | .Fa chain | ||
| 118 | does not contain the expected memory BIO. | ||
| 119 | .It | ||
| 120 | Signing or digesting is requested and | ||
| 121 | .Fa p7 | ||
| 122 | is not configured to store a detached signature, | ||
| 123 | but does not contain the required field to store the content either. | ||
| 124 | .It | ||
| 125 | At least one signer lacks a useable digest algorithm. | ||
| 126 | .It | ||
| 127 | Signing or digesting fails. | ||
| 128 | .It | ||
| 129 | Memory allocation fails. | ||
| 130 | .El | ||
| 131 | .Pp | ||
| 132 | Signers lacking private keys do not cause failure | ||
| 133 | but are silently skipped. | ||
| 134 | .Sh SEE ALSO | ||
| 135 | .Xr BIO_new 3 , | ||
| 136 | .Xr PKCS7_dataInit 3 , | ||
| 137 | .Xr PKCS7_new 3 , | ||
| 138 | .Xr PKCS7_sign 3 | ||
| 139 | .Sh HISTORY | ||
| 140 | .Fn PKCS7_dataFinal | ||
| 141 | first appeared in SSLeay 0.9.1 and has been available since | ||
| 142 | .Ox 2.6 . | ||
| 143 | .Sh CAVEATS | ||
| 144 | This function does not support | ||
| 145 | .Vt EncryptedData . | ||
| 146 | .Pp | ||
| 147 | Even though this function is typically used after | ||
| 148 | .Xr PKCS7_dataInit 3 | ||
| 149 | and even though | ||
| 150 | .Xr PKCS7_dataInit 3 | ||
| 151 | also supports reading from | ||
| 152 | .Vt ContentInfo | ||
| 153 | structures that are already fully populated, do not use | ||
| 154 | .Fn PKCS7_dataFinal | ||
| 155 | on fully populated structures. | ||
| 156 | It is only intended for putting data into new structures | ||
| 157 | and it is neither needed nor suitable for reading. | ||
diff --git a/src/lib/libcrypto/man/PKCS7_new.3 b/src/lib/libcrypto/man/PKCS7_new.3 index c0943e021a..4abe3698e6 100644 --- a/src/lib/libcrypto/man/PKCS7_new.3 +++ b/src/lib/libcrypto/man/PKCS7_new.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: PKCS7_new.3,v 1.9 2020/05/24 12:37:30 schwarze Exp $ | 1 | .\" $OpenBSD: PKCS7_new.3,v 1.10 2020/05/27 12:00:44 schwarze Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> | 3 | .\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,7 +14,7 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: May 24 2020 $ | 17 | .Dd $Mdocdate: May 27 2020 $ |
| 18 | .Dt PKCS7_NEW 3 | 18 | .Dt PKCS7_NEW 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| @@ -246,6 +246,7 @@ frees | |||
| 246 | .Xr i2d_PKCS7_bio_stream 3 , | 246 | .Xr i2d_PKCS7_bio_stream 3 , |
| 247 | .Xr PEM_read_PKCS7 3 , | 247 | .Xr PEM_read_PKCS7 3 , |
| 248 | .Xr PEM_write_bio_PKCS7_stream 3 , | 248 | .Xr PEM_write_bio_PKCS7_stream 3 , |
| 249 | .Xr PKCS7_dataFinal 3 , | ||
| 249 | .Xr PKCS7_dataInit 3 , | 250 | .Xr PKCS7_dataInit 3 , |
| 250 | .Xr PKCS7_decrypt 3 , | 251 | .Xr PKCS7_decrypt 3 , |
| 251 | .Xr PKCS7_encrypt 3 , | 252 | .Xr PKCS7_encrypt 3 , |
