diff options
Diffstat (limited to 'src/lib/libcrypto/man/BIO_dup_chain.3')
-rw-r--r-- | src/lib/libcrypto/man/BIO_dup_chain.3 | 141 |
1 files changed, 141 insertions, 0 deletions
diff --git a/src/lib/libcrypto/man/BIO_dup_chain.3 b/src/lib/libcrypto/man/BIO_dup_chain.3 new file mode 100644 index 0000000000..561c811d5d --- /dev/null +++ b/src/lib/libcrypto/man/BIO_dup_chain.3 | |||
@@ -0,0 +1,141 @@ | |||
1 | .\" $OpenBSD: BIO_dup_chain.3,v 1.1 2022/12/18 19:35:36 schwarze Exp $ | ||
2 | .\" | ||
3 | .\" Copyright (c) 2022 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: December 18 2022 $ | ||
18 | .Dt BIO_DUP_CHAIN 3 | ||
19 | .Os | ||
20 | .Sh NAME | ||
21 | .Nm BIO_dup_chain , | ||
22 | .Nm BIO_dup_state | ||
23 | .Nd copy a BIO chain | ||
24 | .Sh SYNOPSIS | ||
25 | .In openssl/bio.h | ||
26 | .Ft BIO * | ||
27 | .Fn BIO_dup_chain "BIO *b" | ||
28 | .Ft long | ||
29 | .Fn BIO_dup_state "BIO *b" "BIO *new_bio" | ||
30 | .Sh DESCRIPTION | ||
31 | .Fn BIO_dup_chain | ||
32 | copies the chain starting at | ||
33 | .Fa b | ||
34 | by iteratively copying | ||
35 | .Fa b | ||
36 | and all the BIOs following it | ||
37 | and joining the copies in the same order as in the original chain. | ||
38 | The copying operation is neither a deep copy nor a shallow copy. | ||
39 | .Pp | ||
40 | Some parts of the state of each BIO are copied, | ||
41 | in particular with respect to the values returned by | ||
42 | .Xr BIO_get_init 3 , | ||
43 | .Xr BIO_test_flags 3 , | ||
44 | and | ||
45 | .Xr BIO_get_shutdown 3 . | ||
46 | .\" XXX new_bio->num = bio->num; | ||
47 | Other parts of the state of the BIOs are not copied | ||
48 | but instead initialized to 0, | ||
49 | in particular with respect to the values returned by | ||
50 | .Xr BIO_number_read 3 , | ||
51 | .Xr BIO_number_written 3 , | ||
52 | and | ||
53 | .Xr BIO_get_retry_reason 3 . | ||
54 | The custom data pointer that can be used by custom BIO types | ||
55 | and that can be retrieved with | ||
56 | .Xr BIO_get_data 3 | ||
57 | is set set to | ||
58 | .Dv NULL | ||
59 | in the copied BIO objects rather than copied. | ||
60 | The reference count of each BIO in the copied chain is set to 1. | ||
61 | .Pp | ||
62 | For each BIO in the chain, copying the data that was set with | ||
63 | .Xr BIO_set_ex_data 3 | ||
64 | is attempted, which may involve calling application-defined | ||
65 | callback functions. | ||
66 | .Pp | ||
67 | The following pointers are copied | ||
68 | rather than creating deep copies of the objects pointed to: | ||
69 | .Bl -bullet | ||
70 | .It | ||
71 | The | ||
72 | .Fa type | ||
73 | pointer used for creating each BIO with | ||
74 | .Xr BIO_new 3 , | ||
75 | implying that functions like | ||
76 | .Xr BIO_method_name 3 | ||
77 | return pointers to the same strings for the BIOs in the copied chain, | ||
78 | and that these strings are not copied. | ||
79 | .It | ||
80 | All function pointers, in particular those installed with | ||
81 | .Xr BIO_set_callback_ex 3 | ||
82 | and | ||
83 | .Xr BIO_get_callback_ex 3 . | ||
84 | .It | ||
85 | The pointer installed with | ||
86 | .Xr BIO_set_callback_arg 3 , | ||
87 | which implies that for BIOs using | ||
88 | .Xr BIO_debug_callback 3 , | ||
89 | those in the copied chain use the same BIOs for debugging output | ||
90 | as the corresponding ones in the original chain, | ||
91 | and none of the debugging output BIOs are copied. | ||
92 | .El | ||
93 | .Pp | ||
94 | .Fn BIO_dup_state | ||
95 | is a macro that calls | ||
96 | .Xr BIO_ctrl 3 | ||
97 | with a | ||
98 | .Fa cmd | ||
99 | argument of | ||
100 | .Dv BIO_CTRL_DUP . | ||
101 | It is automatically called for each BIO during | ||
102 | .Fn BIO_dup_chain | ||
103 | after the copied BIO is initialized and data copied into it, | ||
104 | but before the data set with | ||
105 | .Xr BIO_set_ex_data 3 | ||
106 | is copied into the new BIO and before it is linked into the new chain. | ||
107 | .Pp | ||
108 | This control operation may modify the operation of | ||
109 | .Fn BIO_dup_chain | ||
110 | for particular types of BIOs contained in the chain, | ||
111 | for example initializing or copying additional data. | ||
112 | For BIO types provided by the library, such additional effects | ||
113 | are documented in the respective manual pages, in particular in | ||
114 | .Xr BIO_f_buffer 3 , | ||
115 | .Xr BIO_f_cipher 3 , | ||
116 | .Xr BIO_f_md 3 , | ||
117 | .Xr BIO_f_ssl 3 , | ||
118 | .Xr BIO_s_bio 3 , | ||
119 | and | ||
120 | .Xr BIO_s_connect 3 . | ||
121 | .Sh RETURN VALUES | ||
122 | .Fn BIO_dup_chain | ||
123 | returns a pointer to the newly allocated copy of the BIO | ||
124 | .Fa b | ||
125 | on success or | ||
126 | .Dv NULL | ||
127 | on failure . | ||
128 | .Pp | ||
129 | .Fn BIO_dup_state | ||
130 | returns 1 on success or a value less than or equal to zero on failure. | ||
131 | .Sh SEE ALSO | ||
132 | .Xr BIO_get_data 3 , | ||
133 | .Xr BIO_new 3 , | ||
134 | .Xr BIO_next 3 , | ||
135 | .Xr BIO_push 3 | ||
136 | .Sh HISTORY | ||
137 | .Fn BIO_dup_chain | ||
138 | and | ||
139 | .Fn BIO_dup_state | ||
140 | first appeared in SSLeay 0.8.0 and have been available since | ||
141 | .Ox 2.4 . | ||