diff options
-rw-r--r-- | src/lib/libcrypto/man/BIO_f_md.3 | 87 |
1 files changed, 41 insertions, 46 deletions
diff --git a/src/lib/libcrypto/man/BIO_f_md.3 b/src/lib/libcrypto/man/BIO_f_md.3 index 091995dc1b..95ffbae783 100644 --- a/src/lib/libcrypto/man/BIO_f_md.3 +++ b/src/lib/libcrypto/man/BIO_f_md.3 | |||
@@ -1,4 +1,4 @@ | |||
1 | .\" $OpenBSD: BIO_f_md.3,v 1.13 2023/04/11 16:58:43 schwarze Exp $ | 1 | .\" $OpenBSD: BIO_f_md.3,v 1.14 2023/04/28 15:04:33 schwarze Exp $ |
2 | .\" full merge up to: OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400 | 2 | .\" full merge up to: OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400 |
3 | .\" | 3 | .\" |
4 | .\" This file was written by Dr. Stephen Henson <steve@openssl.org>. | 4 | .\" This file was written by Dr. Stephen Henson <steve@openssl.org>. |
@@ -49,7 +49,7 @@ | |||
49 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 49 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
50 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 50 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
51 | .\" | 51 | .\" |
52 | .Dd $Mdocdate: April 11 2023 $ | 52 | .Dd $Mdocdate: April 28 2023 $ |
53 | .Dt BIO_F_MD 3 | 53 | .Dt BIO_F_MD 3 |
54 | .Os | 54 | .Os |
55 | .Sh NAME | 55 | .Sh NAME |
@@ -90,6 +90,22 @@ It is a BIO wrapper for the digest routines | |||
90 | and | 90 | and |
91 | .Xr EVP_DigestFinal 3 . | 91 | .Xr EVP_DigestFinal 3 . |
92 | .Pp | 92 | .Pp |
93 | .Fn BIO_set_md | ||
94 | sets the message digest of | ||
95 | .Fa b | ||
96 | to | ||
97 | .Fa md | ||
98 | and initializes it using | ||
99 | .Xr EVP_DigestInit_ex 3 . | ||
100 | Calling this function is required before any data is passed through | ||
101 | .Fa b . | ||
102 | .Pp | ||
103 | .Fn BIO_get_md | ||
104 | places a pointer to the digest method of | ||
105 | .Fa b | ||
106 | into | ||
107 | .Pf * Fa mdp . | ||
108 | .Pp | ||
93 | Any data written or read through a digest BIO using | 109 | Any data written or read through a digest BIO using |
94 | .Xr BIO_read 3 | 110 | .Xr BIO_read 3 |
95 | and | 111 | and |
@@ -104,31 +120,34 @@ finishes the digest calculation and returns the digest value. | |||
104 | .Xr BIO_puts 3 | 120 | .Xr BIO_puts 3 |
105 | is | 121 | is |
106 | not supported. | 122 | not supported. |
123 | If an application needs to call | ||
124 | .Xr BIO_gets 3 | ||
125 | or | ||
126 | .Xr BIO_puts 3 | ||
127 | through a chain containing digest BIOs, | ||
128 | this can be done by prepending a buffering BIO. | ||
107 | .Pp | 129 | .Pp |
130 | After the digest has been retrieved from a digest BIO, call | ||
108 | .Xr BIO_reset 3 | 131 | .Xr BIO_reset 3 |
109 | reinitialises a digest BIO. | 132 | to reinitialize it and any BIOs following it in its chain |
110 | .Pp | 133 | before passing any more data through it. |
134 | If no subsequent BIOs require reinitialization, | ||
111 | .Fn BIO_set_md | 135 | .Fn BIO_set_md |
112 | sets the message digest of BIO | 136 | can be used instead of |
113 | .Fa b | 137 | .Xr BIO_reset 3 . |
114 | to | ||
115 | .Fa md : | ||
116 | this must be called to initialize a digest BIO | ||
117 | before any data is passed through it. | ||
118 | It is a | ||
119 | .Xr BIO_ctrl 3 | ||
120 | macro. | ||
121 | .Pp | ||
122 | .Fn BIO_get_md | ||
123 | places a pointer to the digest BIOs digest method in | ||
124 | .Fa mdp . | ||
125 | It is a | ||
126 | .Xr BIO_ctrl 3 | ||
127 | macro. | ||
128 | .Pp | 138 | .Pp |
129 | .Fn BIO_get_md_ctx | 139 | .Fn BIO_get_md_ctx |
130 | returns the digest BIOs context in | 140 | places a pointer to the digest context of |
131 | .Fa mdcp . | 141 | .Fa b |
142 | into | ||
143 | .Pf * Fa mdcp | ||
144 | and marks the BIO as initialized without actually initializing it. | ||
145 | Unless | ||
146 | .Fn BIO_set_md | ||
147 | was already called on | ||
148 | .Fa b , | ||
149 | the caller becomes responsible for initializing the digest context with | ||
150 | .Xr EVP_DigestInit_ex 3 . | ||
132 | .Pp | 151 | .Pp |
133 | The context returned by | 152 | The context returned by |
134 | .Fn BIO_get_md_ctx | 153 | .Fn BIO_get_md_ctx |
@@ -153,30 +172,6 @@ from the existing BIO object to the new one, | |||
153 | and the init flag that can be retrieved with | 172 | and the init flag that can be retrieved with |
154 | .Xr BIO_get_init 3 | 173 | .Xr BIO_get_init 3 |
155 | is set to 1. | 174 | is set to 1. |
156 | .Pp | ||
157 | After the digest has been retrieved from a digest BIO, | ||
158 | it must be reinitialized by calling | ||
159 | .Xr BIO_reset 3 | ||
160 | or | ||
161 | .Fn BIO_set_md | ||
162 | before any more data is passed through it. | ||
163 | .Pp | ||
164 | If an application needs to call | ||
165 | .Xr BIO_gets 3 | ||
166 | or | ||
167 | .Xr BIO_puts 3 | ||
168 | through a chain containing digest BIOs, | ||
169 | then this can be done by prepending a buffering BIO. | ||
170 | .Pp | ||
171 | Calling | ||
172 | .Fn BIO_get_md_ctx | ||
173 | will return the context and initialize the | ||
174 | .Vt BIO | ||
175 | state. | ||
176 | This allows applications to initialize the context externally | ||
177 | if the standard calls such as | ||
178 | .Fn BIO_set_md | ||
179 | are not sufficiently flexible. | ||
180 | .Sh RETURN VALUES | 175 | .Sh RETURN VALUES |
181 | .Fn BIO_f_md | 176 | .Fn BIO_f_md |
182 | returns the digest BIO method. | 177 | returns the digest BIO method. |