diff options
| author | schwarze <> | 2020-05-16 00:11:55 +0000 | 
|---|---|---|
| committer | schwarze <> | 2020-05-16 00:11:55 +0000 | 
| commit | 0a1dcbe05d21795b7042ce242cc0c6b8a960f3a2 (patch) | |
| tree | c703989ab15bde1f9af3fca902816939afa8c2ff /src | |
| parent | 0db3b24cb3040a840e69e6aa9611d989c9ec9f6b (diff) | |
| download | openbsd-0a1dcbe05d21795b7042ce242cc0c6b8a960f3a2.tar.gz openbsd-0a1dcbe05d21795b7042ce242cc0c6b8a960f3a2.tar.bz2 openbsd-0a1dcbe05d21795b7042ce242cc0c6b8a960f3a2.zip | |
document PKCS7_set_type(3);
OK beck@, who was amused by the "darkly comic value of reading" it
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/libcrypto/man/Makefile | 3 | ||||
| -rw-r--r-- | src/lib/libcrypto/man/PKCS7_new.3 | 5 | ||||
| -rw-r--r-- | src/lib/libcrypto/man/PKCS7_set_type.3 | 118 | 
3 files changed, 123 insertions, 3 deletions
| diff --git a/src/lib/libcrypto/man/Makefile b/src/lib/libcrypto/man/Makefile index a50e9594c5..5cb80ee5c3 100644 --- a/src/lib/libcrypto/man/Makefile +++ b/src/lib/libcrypto/man/Makefile | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | # $OpenBSD: Makefile,v 1.160 2019/11/02 15:12:31 schwarze Exp $ | 1 | # $OpenBSD: Makefile,v 1.161 2020/05/16 00:11:55 schwarze Exp $ | 
| 2 | 2 | ||
| 3 | .include <bsd.own.mk> | 3 | .include <bsd.own.mk> | 
| 4 | 4 | ||
| @@ -217,6 +217,7 @@ MAN= \ | |||
| 217 | PKCS7_decrypt.3 \ | 217 | PKCS7_decrypt.3 \ | 
| 218 | PKCS7_encrypt.3 \ | 218 | PKCS7_encrypt.3 \ | 
| 219 | PKCS7_new.3 \ | 219 | PKCS7_new.3 \ | 
| 220 | PKCS7_set_type.3 \ | ||
| 220 | PKCS7_sign.3 \ | 221 | PKCS7_sign.3 \ | 
| 221 | PKCS7_sign_add_signer.3 \ | 222 | PKCS7_sign_add_signer.3 \ | 
| 222 | PKCS7_verify.3 \ | 223 | PKCS7_verify.3 \ | 
| diff --git a/src/lib/libcrypto/man/PKCS7_new.3 b/src/lib/libcrypto/man/PKCS7_new.3 index d77ab73f75..324c96cfc9 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.6 2019/06/10 09:49:48 schwarze Exp $ | 1 | .\" $OpenBSD: PKCS7_new.3,v 1.7 2020/05/16 00:11:55 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: June 10 2019 $ | 17 | .Dd $Mdocdate: May 16 2020 $ | 
| 18 | .Dt PKCS7_NEW 3 | 18 | .Dt PKCS7_NEW 3 | 
| 19 | .Os | 19 | .Os | 
| 20 | .Sh NAME | 20 | .Sh NAME | 
| @@ -249,6 +249,7 @@ frees | |||
| 249 | .Xr PKCS7_decrypt 3 , | 249 | .Xr PKCS7_decrypt 3 , | 
| 250 | .Xr PKCS7_encrypt 3 , | 250 | .Xr PKCS7_encrypt 3 , | 
| 251 | .Xr PKCS7_ISSUER_AND_SERIAL_digest 3 , | 251 | .Xr PKCS7_ISSUER_AND_SERIAL_digest 3 , | 
| 252 | .Xr PKCS7_set_type 3 , | ||
| 252 | .Xr PKCS7_sign 3 , | 253 | .Xr PKCS7_sign 3 , | 
| 253 | .Xr PKCS7_sign_add_signer 3 , | 254 | .Xr PKCS7_sign_add_signer 3 , | 
| 254 | .Xr PKCS7_verify 3 , | 255 | .Xr PKCS7_verify 3 , | 
| diff --git a/src/lib/libcrypto/man/PKCS7_set_type.3 b/src/lib/libcrypto/man/PKCS7_set_type.3 new file mode 100644 index 0000000000..a666b866ff --- /dev/null +++ b/src/lib/libcrypto/man/PKCS7_set_type.3 | |||
| @@ -0,0 +1,118 @@ | |||
| 1 | .\" $OpenBSD: PKCS7_set_type.3,v 1.1 2020/05/16 00:11:55 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 16 2020 $ | ||
| 18 | .Dt PKCS7_SET_TYPE 3 | ||
| 19 | .Os | ||
| 20 | .Sh NAME | ||
| 21 | .Nm PKCS7_set_type , | ||
| 22 | .Nm PKCS7_set0_type_other | ||
| 23 | .Nd initialize type of PKCS#7 ContentInfo | ||
| 24 | .Sh SYNOPSIS | ||
| 25 | .In openssl/pkcs7.h | ||
| 26 | .Ft int | ||
| 27 | .Fo PKCS7_set_type | ||
| 28 | .Fa "PKCS7 *p7" | ||
| 29 | .Fa "int type" | ||
| 30 | .Fc | ||
| 31 | .Ft int | ||
| 32 | .Fo PKCS7_set0_type_other | ||
| 33 | .Fa "PKCS7 *p7" | ||
| 34 | .Fa "int type" | ||
| 35 | .Fa "ASN1_TYPE *content" | ||
| 36 | .Fc | ||
| 37 | .Sh DESCRIPTION | ||
| 38 | These functions set the | ||
| 39 | .Fa type | ||
| 40 | of an unused | ||
| 41 | .Vt ContentInfo | ||
| 42 | structure | ||
| 43 | .Fa p7 . | ||
| 44 | .Pp | ||
| 45 | The function | ||
| 46 | .Fn PKCS7_set_type | ||
| 47 | also allocates and initializes an empty child object in | ||
| 48 | .Fa p7 . | ||
| 49 | The | ||
| 50 | .Fa type | ||
| 51 | argument can be any of these NIDs, | ||
| 52 | creating a child object of the indicated data type: | ||
| 53 | .Pp | ||
| 54 | .Bl -column NID_pkcs7_signedAndEnveloped PKCS7_SIGN_ENVELOPE n.a. -compact | ||
| 55 | .It Fa type No argument Ta data type of child Ta version | ||
| 56 | .It Dv NID_pkcs7_data Ta Vt ASN1_OCTET_STRING Ta n.a. | ||
| 57 | .It Dv NID_pkcs7_digest Ta Vt PKCS7_DIGEST Ta 0 | ||
| 58 | .It Dv NID_pkcs7_encrypted Ta Vt PKCS7_ENCRYPT Ta 0 | ||
| 59 | .It Dv NID_pkcs7_enveloped Ta Vt PKCS7_ENVELOPE Ta 0 | ||
| 60 | .It Dv NID_pkcs7_signed Ta Vt PKCS7_SIGNED Ta 1 | ||
| 61 | .It Dv NID_pkcs7_signedAndEnveloped Ta Vt PKCS7_SIGN_ENVELOPE Ta 1 | ||
| 62 | .El | ||
| 63 | .Pp | ||
| 64 | If the provided | ||
| 65 | .Fa type | ||
| 66 | is invalid, | ||
| 67 | .Fa p7 | ||
| 68 | remains unchanged and | ||
| 69 | .Fn PKCS7_set_type | ||
| 70 | fails. | ||
| 71 | .Pp | ||
| 72 | If memory allocation fails, | ||
| 73 | .Fn PKCS7_set_type | ||
| 74 | fails and | ||
| 75 | .Fa p7 | ||
| 76 | may remain in an inconsistent state. | ||
| 77 | .Pp | ||
| 78 | The function | ||
| 79 | .Fn PKCS7_set0_type_other | ||
| 80 | accepts an arbitrary NID as the | ||
| 81 | .Fa type | ||
| 82 | and also sets the | ||
| 83 | .Fa content , | ||
| 84 | neither checking it in any way nor copying it. | ||
| 85 | .Pp | ||
| 86 | For both functions, the rest of the internal state of | ||
| 87 | .Fa p7 | ||
| 88 | remains unchanged. | ||
| 89 | .Sh RETURN VALUES | ||
| 90 | The function | ||
| 91 | .Fn PKCS7_set_type | ||
| 92 | returns 1 on success or 0 on failure. | ||
| 93 | .Pp | ||
| 94 | The function | ||
| 95 | .Fn PKCS7_set0_type_other | ||
| 96 | does no error handling at all and always returns 1. | ||
| 97 | .Sh SEE ALSO | ||
| 98 | .Xr ASN1_OCTET_STRING_new 3 , | ||
| 99 | .Xr ASN1_TYPE_new 3 , | ||
| 100 | .Xr PKCS7_encrypt 3 , | ||
| 101 | .Xr PKCS7_new 3 , | ||
| 102 | .Xr PKCS7_sign 3 | ||
| 103 | .Sh HISTORY | ||
| 104 | The function | ||
| 105 | .Fn PKCS7_set_type | ||
| 106 | first appeared in SSLeay 0.8.1 and | ||
| 107 | .Fn PKCS7_set0_type_other | ||
| 108 | in OpenSSL 0.9.8. | ||
| 109 | Both have been available since | ||
| 110 | .Ox 2.4 . | ||
| 111 | .Sh CAVEATS | ||
| 112 | If | ||
| 113 | .Fa p7 | ||
| 114 | has already been in use before being passed to one of these functions, | ||
| 115 | it will report success even though it leaks memory. | ||
| 116 | Later on, if other functions try to use | ||
| 117 | .Fa p7 | ||
| 118 | in its former role, they are likely to misbehave. | ||
