-.\" $OpenBSD: SMIME_write_PKCS7.3,v 1.8 2021/12/13 17:24:39 schwarze Exp $
+.\" $OpenBSD: SMIME_write_PKCS7.3,v 1.9 2021/12/14 15:46:48 schwarze Exp $
.\" full merge up to: OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400
.\"
-.\" This file was written by Dr. Stephen Henson <steve@openssl.org>.
+.\" This file is a derived work.
+.\" The changes are covered by the following Copyright and license:
+.\"
+.\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org>
+.\"
+.\" Permission to use, copy, modify, and distribute this software for any
+.\" purpose with or without fee is hereby granted, provided that the above
+.\" copyright notice and this permission notice appear in all copies.
+.\"
+.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+.\"
+.\" The original file was written by Dr. Stephen Henson <steve@openssl.org>.
.\" Copyright (c) 2002, 2003, 2006, 2007, 2015 The OpenSSL Project.
.\" All rights reserved.
.\"
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
.\" OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
-.Dd $Mdocdate: December 13 2021 $
+.Dd $Mdocdate: December 14 2021 $
.Dt SMIME_WRITE_PKCS7 3
.Os
.Sh NAME
or
.Xr PKCS7_encrypt 3 .
.Pp
+The bit
+.Dv SMIME_OLDMIME
+is inverted before passing on the
+.Fa flags
+to
+.Xr SMIME_write_ASN1 3 .
+Consequently, if this bit is set in the
+.Fa flags
+argument,
+.Qq application/pkcs7-mime
+or
+.Qq application/pkcs7-signature
+is used in Content-Type headers.
+Otherwise,
+.Qq application/x-pkcs7-mime
+or
+.Qq application/x-pkcs7-signature
+is used.
+.Pp
If cleartext signing is being used and
.Dv PKCS7_STREAM
is not set, then the data must be read twice: once to compute the