summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/lib/libcrypto/man/Makefile4
-rw-r--r--src/lib/libcrypto/man/SMIME_read_ASN1.3124
-rw-r--r--src/lib/libcrypto/man/SMIME_write_ASN1.3163
3 files changed, 1 insertions, 290 deletions
diff --git a/src/lib/libcrypto/man/Makefile b/src/lib/libcrypto/man/Makefile
index d026643e9d..2291d083cd 100644
--- a/src/lib/libcrypto/man/Makefile
+++ b/src/lib/libcrypto/man/Makefile
@@ -1,4 +1,4 @@
1# $OpenBSD: Makefile,v 1.309 2025/06/09 12:43:53 schwarze Exp $ 1# $OpenBSD: Makefile,v 1.310 2025/06/11 23:21:08 schwarze Exp $
2 2
3.include <bsd.own.mk> 3.include <bsd.own.mk>
4 4
@@ -291,11 +291,9 @@ MAN= \
291 RSA_size.3 \ 291 RSA_size.3 \
292 SHA1.3 \ 292 SHA1.3 \
293 SMIME_crlf_copy.3 \ 293 SMIME_crlf_copy.3 \
294 SMIME_read_ASN1.3 \
295 SMIME_read_CMS.3 \ 294 SMIME_read_CMS.3 \
296 SMIME_read_PKCS7.3 \ 295 SMIME_read_PKCS7.3 \
297 SMIME_text.3 \ 296 SMIME_text.3 \
298 SMIME_write_ASN1.3 \
299 SMIME_write_CMS.3 \ 297 SMIME_write_CMS.3 \
300 SMIME_write_PKCS7.3 \ 298 SMIME_write_PKCS7.3 \
301 STACK_OF.3 \ 299 STACK_OF.3 \
diff --git a/src/lib/libcrypto/man/SMIME_read_ASN1.3 b/src/lib/libcrypto/man/SMIME_read_ASN1.3
deleted file mode 100644
index 320064567c..0000000000
--- a/src/lib/libcrypto/man/SMIME_read_ASN1.3
+++ /dev/null
@@ -1,124 +0,0 @@
1.\" $OpenBSD: SMIME_read_ASN1.3,v 1.2 2021/12/14 15:22:49 schwarze Exp $
2.\" full merge up to:
3.\" OpenSSL SMIME_read_PKCS7.pod 83cf7abf May 29 13:07:08 2018 +0100
4.\" OpenSSL SMIME_read_CMS.pod b97fdb57 Nov 11 09:33:09 2016 +0100
5.\"
6.\" This file was written by Dr. Stephen Henson <steve@openssl.org>.
7.\" Copyright (c) 2002, 2006, 2008 The OpenSSL Project. All rights reserved.
8.\"
9.\" Redistribution and use in source and binary forms, with or without
10.\" modification, are permitted provided that the following conditions
11.\" are met:
12.\"
13.\" 1. Redistributions of source code must retain the above copyright
14.\" notice, this list of conditions and the following disclaimer.
15.\"
16.\" 2. Redistributions in binary form must reproduce the above copyright
17.\" notice, this list of conditions and the following disclaimer in
18.\" the documentation and/or other materials provided with the
19.\" distribution.
20.\"
21.\" 3. All advertising materials mentioning features or use of this
22.\" software must display the following acknowledgment:
23.\" "This product includes software developed by the OpenSSL Project
24.\" for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
25.\"
26.\" 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
27.\" endorse or promote products derived from this software without
28.\" prior written permission. For written permission, please contact
29.\" openssl-core@openssl.org.
30.\"
31.\" 5. Products derived from this software may not be called "OpenSSL"
32.\" nor may "OpenSSL" appear in their names without prior written
33.\" permission of the OpenSSL Project.
34.\"
35.\" 6. Redistributions of any form whatsoever must retain the following
36.\" acknowledgment:
37.\" "This product includes software developed by the OpenSSL Project
38.\" for use in the OpenSSL Toolkit (http://www.openssl.org/)"
39.\"
40.\" THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
41.\" EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
42.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
43.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
44.\" ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
45.\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
46.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
47.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
49.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
50.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
51.\" OF THE POSSIBILITY OF SUCH DAMAGE.
52.\"
53.Dd $Mdocdate: December 14 2021 $
54.Dt SMIME_READ_ASN1 3
55.Os
56.Sh NAME
57.Nm SMIME_read_ASN1
58.Nd generic S/MIME message parser
59.Sh SYNOPSIS
60.In openssl/asn1.h
61.Ft ASN1_VALUE *
62.Fo SMIME_read_ASN1
63.Fa "BIO *in_bio"
64.Fa "BIO **out_bio"
65.Fa "const ASN1_ITEM *it"
66.Fc
67.Sh DESCRIPTION
68.Fn SMIME_read_ASN1
69reads a message in S/MIME format from
70.Fa in_bio .
71.Pp
72If the message uses cleartext signing, the content is saved in a memory
73.Vt BIO
74which is written to
75.Pf * Fa out_bio .
76Otherwise,
77.Pf * Fa out_bio
78is set to
79.Dv NULL .
80.Pp
81To support future functionality, if
82.Fa out_bio
83is not
84.Dv NULL ,
85.Pf * Fa out_bio
86should be initialized to
87.Dv NULL
88before calling
89.Fn SMIME_read_ASN1 .
90.Sh RETURN VALUES
91.Fn SMIME_read_ASN1
92returns a newly allocated object of type
93.Fa it
94or
95.Dv NULL
96if an error occurred.
97The error can be obtained from
98.Xr ERR_get_error 3 .
99.Sh SEE ALSO
100.Xr ASN1_item_d2i_bio 3 ,
101.Xr BIO_f_base64 3 ,
102.Xr BIO_new 3 ,
103.Xr SMIME_read_CMS 3 ,
104.Xr SMIME_read_PKCS7 3 ,
105.Xr SMIME_text 3
106.Sh HISTORY
107.Fn SMIME_read_ASN1
108first appeared in OpenSSL 0.9.8h and has been available since
109.Ox 4.5 .
110.Sh BUGS
111The MIME parser used by
112.Fn SMIME_read_ASN1
113is somewhat primitive.
114While it will handle most S/MIME messages, more complex compound
115formats may not work.
116.Pp
117The parser assumes that the
118structure is always base64 encoded, and it will not handle the case
119where it is in binary format or uses quoted printable format.
120.Pp
121The use of a memory
122to hold the signed content limits the size of the message which can
123be processed due to memory restraints: a streaming single pass
124option should be available.
diff --git a/src/lib/libcrypto/man/SMIME_write_ASN1.3 b/src/lib/libcrypto/man/SMIME_write_ASN1.3
deleted file mode 100644
index a02fa58570..0000000000
--- a/src/lib/libcrypto/man/SMIME_write_ASN1.3
+++ /dev/null
@@ -1,163 +0,0 @@
1.\" $OpenBSD: SMIME_write_ASN1.3,v 1.2 2023/05/01 07:28:11 tb Exp $
2.\"
3.\" Copyright (c) 2021 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 1 2023 $
18.Dt SMIME_WRITE_ASN1 3
19.Os
20.Sh NAME
21.Nm SMIME_write_ASN1
22.Nd generate an S/MIME message
23.Sh SYNOPSIS
24.In openssl/asn1.h
25.Ft int
26.Fo SMIME_write_ASN1
27.Fa "BIO *out_bio"
28.Fa "ASN1_VALUE *val_in"
29.Fa "BIO *in_bio"
30.Fa "int flags"
31.Fa "int ctype_nid"
32.Fa "int econt_nid"
33.Fa "STACK_OF(X509_ALGOR) *micalg"
34.Fa "const ASN1_ITEM *it"
35.Fc
36.Sh DESCRIPTION
37.Fn SMIME_write_ASN1
38generates an S/MIME message on
39.Fa out_bio
40by writing MIME 1.0 headers
41followed by a BER- and base64-encoded serialization of
42.Fa val_in ,
43which can be of the type
44.Vt CMS_ContentInfo
45or
46.Vt PKCS7
47and has to match the
48.Fa it
49argument.
50.Pp
51The
52.Fa flags
53can be the logical OR of zero or more of the following bits:
54.Bl -tag -width Ds
55.It Dv PKCS7_REUSE_DIGEST
56Skip the calls to
57.Xr PKCS7_dataInit 3
58and
59.Xr PKCS7_dataFinal 3 .
60This flag has no effect unless
61.Dv SMIME_DETACHED
62is also set.
63It is normally used if
64.Fa out_bio
65is already set up to calculate and finalize the digest when written through.
66.It Dv SMIME_BINARY
67If specified, this flag is passed through to
68.Xr SMIME_crlf_copy 3 .
69.It Dv SMIME_CRLFEOL
70End MIME header lines with pairs of carriage return and newline characters.
71By default, no carriage return characters are written
72and header lines are ended with newline characters only.
73.It Dv SMIME_DETACHED
74Use cleartext signing.
75Generate a
76.Qq multipart/signed
77S/MIME message using the
78.Fa micalg
79argument and ignoring the
80.Fa ctype_nid
81and
82.Fa econt_nid
83arguments.
84The content is read from
85.Fa in_bio .
86If
87.Fa in_bio
88is a
89.Dv NULL
90pointer, this flag is ignored.
91.Pp
92If this flag is ignored or not specified,
93the smime-type is chosen according to
94.Fa ctype_nid
95instead:
96.Bl -tag -width Ds
97.It Dv NID_pkcs7_enveloped
98.Qq enveloped-data
99.It Dv NID_pkcs7_signed
100.Qq signed-receipt
101if
102.Fa econt_nid
103is
104.Dv NID_id_smime_ct_receipt
105.br
106.Qq signed-data
107if
108.Fa micalg
109is not empty
110.br
111.Qq certs-only
112if
113.Fa micalg
114is empty
115.It Dv NID_id_smime_ct_compressedData
116.Qq compressed-data
117.El
118.It Dv SMIME_OLDMIME
119In Content-Type headers, use
120.Qq application/x-pkcs7-mime
121or
122.Qq application/x-pkcs7-signature .
123By default,
124.Qq application/pkcs7-mime
125or
126.Qq application/pkcs7-signature
127are used instead.
128.It Dv SMIME_STREAM
129Perform streaming by reading the content from
130.Fa in_bio .
131This only works if
132.Dv SMIME_DETACHED
133is not specified.
134.It SMIME_TEXT
135Prepend the line
136.Qq Content-Type: text/plain
137to the content.
138This only makes sense if
139.Dv SMIME_DETACHED
140is also set.
141It is ignored if the flag
142.Dv SMIME_BINARY
143is also set.
144.El
145.Sh RETURN VALUES
146.Fn SMIME_write_ASN1
147is intended to return 1 on success or 0 on failure.
148.Sh SEE ALSO
149.Xr ASN1_item_i2d_bio 3 ,
150.Xr BIO_f_base64 3 ,
151.Xr BIO_new 3 ,
152.Xr SMIME_crlf_copy 3 ,
153.Xr SMIME_write_CMS 3 ,
154.Xr SMIME_write_PKCS7 3 ,
155.Xr X509_ALGOR_new 3
156.Sh HISTORY
157.Fn SMIME_write_ASN1
158first appeared in OpenSSL 1.0.0 and has been available since
159.Ox 4.9 .
160.Sh BUGS
161.Fn SMIME_write_ASN1
162ignores most errors and is likely to return 1
163even after producing corrupt or incomplete output.