From 3977f4b629887520fc62e33d81cb50861404b57f Mon Sep 17 00:00:00 2001 From: schwarze <> Date: Wed, 20 May 2020 11:40:26 +0000 Subject: new manual page for PKCS7_set_content(3) and PKCS7_content_new(3); OK beck@ tb@ --- src/lib/libcrypto/man/Makefile | 3 +- src/lib/libcrypto/man/PKCS7_new.3 | 5 +- src/lib/libcrypto/man/PKCS7_set_content.3 | 119 ++++++++++++++++++++++++++++++ src/lib/libcrypto/man/PKCS7_set_type.3 | 5 +- 4 files changed, 127 insertions(+), 5 deletions(-) create mode 100644 src/lib/libcrypto/man/PKCS7_set_content.3 diff --git a/src/lib/libcrypto/man/Makefile b/src/lib/libcrypto/man/Makefile index 5cb80ee5c3..1394012e9c 100644 --- a/src/lib/libcrypto/man/Makefile +++ b/src/lib/libcrypto/man/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.161 2020/05/16 00:11:55 schwarze Exp $ +# $OpenBSD: Makefile,v 1.162 2020/05/20 11:40:26 schwarze Exp $ .include @@ -217,6 +217,7 @@ MAN= \ PKCS7_decrypt.3 \ PKCS7_encrypt.3 \ PKCS7_new.3 \ + PKCS7_set_content.3 \ PKCS7_set_type.3 \ PKCS7_sign.3 \ PKCS7_sign_add_signer.3 \ diff --git a/src/lib/libcrypto/man/PKCS7_new.3 b/src/lib/libcrypto/man/PKCS7_new.3 index 324c96cfc9..56a8b566ba 100644 --- a/src/lib/libcrypto/man/PKCS7_new.3 +++ b/src/lib/libcrypto/man/PKCS7_new.3 @@ -1,4 +1,4 @@ -.\" $OpenBSD: PKCS7_new.3,v 1.7 2020/05/16 00:11:55 schwarze Exp $ +.\" $OpenBSD: PKCS7_new.3,v 1.8 2020/05/20 11:40:26 schwarze Exp $ .\" .\" Copyright (c) 2016 Ingo Schwarze .\" @@ -14,7 +14,7 @@ .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" -.Dd $Mdocdate: May 16 2020 $ +.Dd $Mdocdate: May 20 2020 $ .Dt PKCS7_NEW 3 .Os .Sh NAME @@ -249,6 +249,7 @@ frees .Xr PKCS7_decrypt 3 , .Xr PKCS7_encrypt 3 , .Xr PKCS7_ISSUER_AND_SERIAL_digest 3 , +.Xr PKCS7_set_content 3 , .Xr PKCS7_set_type 3 , .Xr PKCS7_sign 3 , .Xr PKCS7_sign_add_signer 3 , diff --git a/src/lib/libcrypto/man/PKCS7_set_content.3 b/src/lib/libcrypto/man/PKCS7_set_content.3 new file mode 100644 index 0000000000..1f77a8042b --- /dev/null +++ b/src/lib/libcrypto/man/PKCS7_set_content.3 @@ -0,0 +1,119 @@ +.\" $OpenBSD: PKCS7_set_content.3,v 1.1 2020/05/20 11:40:26 schwarze Exp $ +.\" +.\" Copyright (c) 2020 Ingo Schwarze +.\" +.\" 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. +.\" +.Dd $Mdocdate: May 20 2020 $ +.Dt PKCS7_SET_CONTENT 3 +.Os +.Sh NAME +.Nm PKCS7_set_content , +.Nm PKCS7_content_new +.Nd set the nested contentInfo in a PKCS#7 structure +.Sh SYNOPSIS +.In openssl/pkcs7.h +.Ft int +.Fo PKCS7_set_content +.Fa "PKCS7 *outer" +.Fa "PKCS7 *inner" +.Fc +.Ft int +.Fo PKCS7_content_new +.Fa "PKCS7 *outer" +.Fa "int inner_type" +.Fc +.Sh DESCRIPTION +If the +.Fa contentType +of the +.Fa outer +PKCS7 structure is +.Vt SignedData +or +.Vt DigestedData , +.Fn PKCS7_set_content +sets the +.Fa contentInfo +field of the +.Fa content +field of +.Fa outer +to +.Fa inner , +without copying +.Fa inner . +If there was previous +.Fa contentInfo , +it is freed rather than overwritten. +The rest of the internal state of +.Fa outer +and of its +.Fa content +remains unchanged. +.Pp +.Fn PKCS7_content_new +is similar except that it first allocates and initializes a new, empty +.Fa inner +object of the given +.Fa inner_type +using +.Xr PKCS7_new 3 +and +.Xr PKCS7_set_type 3 . +The +.Fa inner_type +can be any of the NIDs listed in the +.Xr PKCS7_set_type 3 +manual. +.Sh RETURN VALUES +These functions return 1 on success or 0 on failure. +They fail if the +.Fa contentType +of +.Fa outer +is unsupported. +.Fn PKCS7_content_new +can also fail when memory is exhausted. +In case of failure, +.Fa outer +remains unchanged. +.Sh SEE ALSO +.Xr PKCS7_new 3 , +.Xr PKCS7_set_type 3 , +.Xr PKCS7_sign 3 +.Sh STANDARDS +RFC 2315: PKCS #7: Cryptographic Message Syntax Version 1.5 +.Bl -bullet -compact -offset 1n -width 1n +.It +Section 7. General syntax +.It +Section 9. Signed-data content type +.It +Section 12.\& Digested-data content type +.El +.Sh HISTORY +These functions first appeared in SSLeay 0.8.1 +and have been available since +.Ox 2.4 . +.Sh CAVEATS +Despite the function names, these functions do not set the +.Fa content +field of +.Fa outer , +but only the +.Fa contentInfo +field inside it. +The rest of the +.Fa content +remains unchanged. diff --git a/src/lib/libcrypto/man/PKCS7_set_type.3 b/src/lib/libcrypto/man/PKCS7_set_type.3 index a666b866ff..f414b128a2 100644 --- a/src/lib/libcrypto/man/PKCS7_set_type.3 +++ b/src/lib/libcrypto/man/PKCS7_set_type.3 @@ -1,4 +1,4 @@ -.\" $OpenBSD: PKCS7_set_type.3,v 1.1 2020/05/16 00:11:55 schwarze Exp $ +.\" $OpenBSD: PKCS7_set_type.3,v 1.2 2020/05/20 11:40:26 schwarze Exp $ .\" .\" Copyright (c) 2020 Ingo Schwarze .\" @@ -14,7 +14,7 @@ .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" -.Dd $Mdocdate: May 16 2020 $ +.Dd $Mdocdate: May 20 2020 $ .Dt PKCS7_SET_TYPE 3 .Os .Sh NAME @@ -99,6 +99,7 @@ does no error handling at all and always returns 1. .Xr ASN1_TYPE_new 3 , .Xr PKCS7_encrypt 3 , .Xr PKCS7_new 3 , +.Xr PKCS7_set_content 3 , .Xr PKCS7_sign 3 .Sh HISTORY The function -- cgit v1.2.3-55-g6feb