summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorschwarze <>2020-05-27 12:00:44 +0000
committerschwarze <>2020-05-27 12:00:44 +0000
commite17abbddd79622502d5988b8d2041d8c3cceee27 (patch)
tree03e829bf7e424dc111a8bba2a4df54d4319887cb
parent2c2dac9c21ee14c128f2b41805aec8152fcd1546 (diff)
downloadopenbsd-e17abbddd79622502d5988b8d2041d8c3cceee27.tar.gz
openbsd-e17abbddd79622502d5988b8d2041d8c3cceee27.tar.bz2
openbsd-e17abbddd79622502d5988b8d2041d8c3cceee27.zip
document PKCS7_dataFinal(3);
tweak and OK tb@
-rw-r--r--src/lib/libcrypto/man/Makefile3
-rw-r--r--src/lib/libcrypto/man/PKCS7_dataFinal.3157
-rw-r--r--src/lib/libcrypto/man/PKCS7_new.35
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
32transfers the data from the memory BIO at the end of the given
33.Fa chain
34into the appropriate content field of
35.Fa p7
36itself or of its appropriate substructure.
37It is typically used as the final step of populating
38.Fa p7 ,
39after creating the
40.Fa chain
41with
42.Xr PKCS7_dataInit 3
43and after writing the data into it.
44.Pp
45After calling
46.Fn PKCS7_dataFinal ,
47the program can call
48.Xr BIO_free_all 3
49on the
50.Fa chain
51because such chains are not designed for reuse.
52.Pp
53Depending on the
54.Fa contentType
55of
56.Fa p7 ,
57.Fn PKCS7_dataFinal
58sets the following fields:
59.Bl -tag -width Ds
60.It for Vt SignedData No or Vt DigestedData :
61in substructures of the
62.Fa content
63field of
64.Fa p7 :
65the
66.Fa content
67field in the
68.Vt ContentInfo
69structure (unless
70.Fa p7
71is configured to store a detached signature) and the
72.Fa encryptedDigest
73fields in all the
74.Vt SignerInfo
75structures
76.It for Vt EnvelopedData No or Vt SignedAndEnvelopedData :
77the
78.Fa encryptedContent
79field in the
80.Vt EncryptedContentInfo
81structure contained in the
82.Fa content
83field of
84.Fa p7
85.It for arbitrary data :
86the
87.Fa content
88field of
89.Fa p7
90itself
91.El
92.Sh RETURN VALUES
93.Fn PKCS7_dataFinal
94returns 1 on success or 0 on failure.
95.Pp
96Possible reasons for failure include:
97.Pp
98.Bl -dash -compact -offset 2n -width 1n
99.It
100.Fa p7
101is
102.Dv NULL .
103.It
104The
105.Fa content
106field of
107.Fa p7
108is empty.
109.It
110The
111.Fa contentType
112of
113.Fa p7
114is unsupported.
115.It
116The
117.Fa chain
118does not contain the expected memory BIO.
119.It
120Signing or digesting is requested and
121.Fa p7
122is not configured to store a detached signature,
123but does not contain the required field to store the content either.
124.It
125At least one signer lacks a useable digest algorithm.
126.It
127Signing or digesting fails.
128.It
129Memory allocation fails.
130.El
131.Pp
132Signers lacking private keys do not cause failure
133but 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
141first appeared in SSLeay 0.9.1 and has been available since
142.Ox 2.6 .
143.Sh CAVEATS
144This function does not support
145.Vt EncryptedData .
146.Pp
147Even though this function is typically used after
148.Xr PKCS7_dataInit 3
149and even though
150.Xr PKCS7_dataInit 3
151also supports reading from
152.Vt ContentInfo
153structures that are already fully populated, do not use
154.Fn PKCS7_dataFinal
155on fully populated structures.
156It is only intended for putting data into new structures
157and 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 ,