diff options
author | cvs2svn <admin@example.com> | 2025-04-14 17:32:06 +0000 |
---|---|---|
committer | cvs2svn <admin@example.com> | 2025-04-14 17:32:06 +0000 |
commit | eb8dd9dca1228af0cd132f515509051ecfabf6f6 (patch) | |
tree | edb6da6af7e865d488dc1a29309f1e1ec226e603 /src/lib/libcrypto/man/HMAC.3 | |
parent | 247f0352e0ed72a4f476db9dc91f4d982bc83eb2 (diff) | |
download | openbsd-tb_20250414.tar.gz openbsd-tb_20250414.tar.bz2 openbsd-tb_20250414.zip |
This commit was manufactured by cvs2git to create tag 'tb_20250414'.tb_20250414
Diffstat (limited to 'src/lib/libcrypto/man/HMAC.3')
-rw-r--r-- | src/lib/libcrypto/man/HMAC.3 | 324 |
1 files changed, 0 insertions, 324 deletions
diff --git a/src/lib/libcrypto/man/HMAC.3 b/src/lib/libcrypto/man/HMAC.3 deleted file mode 100644 index a515014fca..0000000000 --- a/src/lib/libcrypto/man/HMAC.3 +++ /dev/null | |||
@@ -1,324 +0,0 @@ | |||
1 | .\" $OpenBSD: HMAC.3,v 1.23 2024/08/29 20:21:53 tb Exp $ | ||
2 | .\" full merge up to: OpenSSL crypto/hmac a528d4f0 Oct 27 13:40:11 2015 -0400 | ||
3 | .\" selective merge up to: OpenSSL man3/HMAC b3696a55 Sep 2 09:35:50 2017 -0400 | ||
4 | .\" | ||
5 | .\" This file was written by Ulf Moeller <ulf@openssl.org>, | ||
6 | .\" Richard Levitte <levitte@openssl.org>, and | ||
7 | .\" Matt Caswell <matt@openssl.org>. | ||
8 | .\" Copyright (c) 2000-2002, 2006, 2008, 2009, 2013, 2015, 2016 | ||
9 | .\" The OpenSSL Project. All rights reserved. | ||
10 | .\" | ||
11 | .\" Redistribution and use in source and binary forms, with or without | ||
12 | .\" modification, are permitted provided that the following conditions | ||
13 | .\" are met: | ||
14 | .\" | ||
15 | .\" 1. Redistributions of source code must retain the above copyright | ||
16 | .\" notice, this list of conditions and the following disclaimer. | ||
17 | .\" | ||
18 | .\" 2. Redistributions in binary form must reproduce the above copyright | ||
19 | .\" notice, this list of conditions and the following disclaimer in | ||
20 | .\" the documentation and/or other materials provided with the | ||
21 | .\" distribution. | ||
22 | .\" | ||
23 | .\" 3. All advertising materials mentioning features or use of this | ||
24 | .\" software must display the following acknowledgment: | ||
25 | .\" "This product includes software developed by the OpenSSL Project | ||
26 | .\" for use in the OpenSSL Toolkit. (http://www.openssl.org/)" | ||
27 | .\" | ||
28 | .\" 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to | ||
29 | .\" endorse or promote products derived from this software without | ||
30 | .\" prior written permission. For written permission, please contact | ||
31 | .\" openssl-core@openssl.org. | ||
32 | .\" | ||
33 | .\" 5. Products derived from this software may not be called "OpenSSL" | ||
34 | .\" nor may "OpenSSL" appear in their names without prior written | ||
35 | .\" permission of the OpenSSL Project. | ||
36 | .\" | ||
37 | .\" 6. Redistributions of any form whatsoever must retain the following | ||
38 | .\" acknowledgment: | ||
39 | .\" "This product includes software developed by the OpenSSL Project | ||
40 | .\" for use in the OpenSSL Toolkit (http://www.openssl.org/)" | ||
41 | .\" | ||
42 | .\" THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY | ||
43 | .\" EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
44 | .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
45 | .\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR | ||
46 | .\" ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
47 | .\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | ||
48 | .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
49 | .\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
50 | .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | ||
51 | .\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
52 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
53 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | ||
54 | .\" | ||
55 | .Dd $Mdocdate: August 29 2024 $ | ||
56 | .Dt HMAC 3 | ||
57 | .Os | ||
58 | .Sh NAME | ||
59 | .Nm HMAC , | ||
60 | .Nm HMAC_CTX_new , | ||
61 | .Nm HMAC_CTX_reset , | ||
62 | .Nm HMAC_CTX_free , | ||
63 | .Nm HMAC_Init_ex , | ||
64 | .Nm HMAC_Update , | ||
65 | .Nm HMAC_Final , | ||
66 | .Nm HMAC_CTX_copy , | ||
67 | .Nm HMAC_CTX_set_flags , | ||
68 | .Nm HMAC_CTX_get_md , | ||
69 | .Nm HMAC_size | ||
70 | .Nd HMAC message authentication code | ||
71 | .Sh SYNOPSIS | ||
72 | .In openssl/hmac.h | ||
73 | .Ft unsigned char * | ||
74 | .Fo HMAC | ||
75 | .Fa "const EVP_MD *evp_md" | ||
76 | .Fa "const void *key" | ||
77 | .Fa "int key_len" | ||
78 | .Fa "const unsigned char *d" | ||
79 | .Fa "size_t n" | ||
80 | .Fa "unsigned char *md" | ||
81 | .Fa "unsigned int *md_len" | ||
82 | .Fc | ||
83 | .Ft HMAC_CTX * | ||
84 | .Fn HMAC_CTX_new void | ||
85 | .Ft int | ||
86 | .Fo HMAC_CTX_reset | ||
87 | .Fa "HMAC_CTX *ctx" | ||
88 | .Fc | ||
89 | .Ft void | ||
90 | .Fo HMAC_CTX_free | ||
91 | .Fa "HMAC_CTX *ctx" | ||
92 | .Fc | ||
93 | .Ft int | ||
94 | .Fo HMAC_Init_ex | ||
95 | .Fa "HMAC_CTX *ctx" | ||
96 | .Fa "const void *key" | ||
97 | .Fa "int key_len" | ||
98 | .Fa "const EVP_MD *md" | ||
99 | .Fa "ENGINE *engine" | ||
100 | .Fc | ||
101 | .Ft int | ||
102 | .Fo HMAC_Update | ||
103 | .Fa "HMAC_CTX *ctx" | ||
104 | .Fa "const unsigned char *data" | ||
105 | .Fa "size_t len" | ||
106 | .Fc | ||
107 | .Ft int | ||
108 | .Fo HMAC_Final | ||
109 | .Fa "HMAC_CTX *ctx" | ||
110 | .Fa "unsigned char *md" | ||
111 | .Fa "unsigned int *len" | ||
112 | .Fc | ||
113 | .Ft int | ||
114 | .Fo HMAC_CTX_copy | ||
115 | .Fa "HMAC_CTX *dctx" | ||
116 | .Fa "HMAC_CTX *sctx" | ||
117 | .Fc | ||
118 | .Ft void | ||
119 | .Fo HMAC_CTX_set_flags | ||
120 | .Fa "HMAC_CTX *ctx" | ||
121 | .Fa "unsigned long flags" | ||
122 | .Fc | ||
123 | .Ft const EVP_MD * | ||
124 | .Fo HMAC_CTX_get_md | ||
125 | .Fa "const HMAC_CTX *ctx" | ||
126 | .Fc | ||
127 | .Ft size_t | ||
128 | .Fo HMAC_size | ||
129 | .Fa "const HMAC_CTX *e" | ||
130 | .Fc | ||
131 | .Sh DESCRIPTION | ||
132 | HMAC is a MAC (message authentication code), i.e. a keyed hash | ||
133 | function used for message authentication, which is based on a hash | ||
134 | function. | ||
135 | .Pp | ||
136 | .Fn HMAC | ||
137 | computes the message authentication code of the | ||
138 | .Fa n | ||
139 | bytes at | ||
140 | .Fa d | ||
141 | using the hash function | ||
142 | .Fa evp_md | ||
143 | and the key | ||
144 | .Fa key | ||
145 | which is | ||
146 | .Fa key_len | ||
147 | bytes long. | ||
148 | .Pp | ||
149 | It places the result in | ||
150 | .Fa md , | ||
151 | which must have space for the output of the hash function, which is no | ||
152 | more than | ||
153 | .Dv EVP_MAX_MD_SIZE | ||
154 | bytes. | ||
155 | The size of the output is placed in | ||
156 | .Fa md_len , | ||
157 | unless it is | ||
158 | .Dv NULL . | ||
159 | .Pp | ||
160 | .Fa evp_md | ||
161 | can be | ||
162 | .Xr EVP_sha1 3 , | ||
163 | .Xr EVP_ripemd160 3 , | ||
164 | etc. | ||
165 | .Pp | ||
166 | .Fn HMAC_CTX_new | ||
167 | allocates and initializes a new | ||
168 | .Vt HMAC_CTX | ||
169 | object. | ||
170 | .Pp | ||
171 | .Fn HMAC_CTX_reset | ||
172 | zeroes and re-initializes | ||
173 | .Fa ctx | ||
174 | and associated resources, making it suitable for new computations | ||
175 | as if it was deleted with | ||
176 | .Fn HMAC_CTX_free | ||
177 | and newly created with | ||
178 | .Fn HMAC_CTX_new . | ||
179 | .Pp | ||
180 | .Fn HMAC_CTX_free | ||
181 | erases the key and other data from | ||
182 | .Fa ctx , | ||
183 | releases any associated resources, and finally frees | ||
184 | .Fa ctx | ||
185 | itself. | ||
186 | .Pp | ||
187 | The following functions may be used if the message is not completely | ||
188 | stored in memory: | ||
189 | .Pp | ||
190 | .Fn HMAC_Init_ex | ||
191 | sets up or reuses | ||
192 | .Fa ctx | ||
193 | to use the hash function | ||
194 | .Fa evp_md | ||
195 | and the key | ||
196 | .Fa key . | ||
197 | Either can be | ||
198 | .Dv NULL , | ||
199 | in which case the existing one is reused. | ||
200 | The | ||
201 | .Fa ctx | ||
202 | must have been created with | ||
203 | .Fn HMAC_CTX_new | ||
204 | before the first use in this function. | ||
205 | If | ||
206 | .Fn HMAC_Init_ex | ||
207 | is called with a | ||
208 | .Dv NULL | ||
209 | .Fa key | ||
210 | but | ||
211 | .Fa evp_md | ||
212 | is neither | ||
213 | .Dv NULL | ||
214 | nor the same as the previous digest used by | ||
215 | .Fa ctx , | ||
216 | then an error is returned because reuse of an existing key with a | ||
217 | different digest is not supported. | ||
218 | The | ||
219 | .Fa ENGINE *engine | ||
220 | argument is always ignored and passing | ||
221 | .Dv NULL | ||
222 | is recommended. | ||
223 | .Pp | ||
224 | .Fn HMAC_Update | ||
225 | can be called repeatedly with chunks of the message to be authenticated | ||
226 | .Pq Fa len No bytes at Fa data . | ||
227 | .Pp | ||
228 | .Fn HMAC_Final | ||
229 | places the message authentication code in | ||
230 | .Fa md , | ||
231 | which must have space for the hash function output. | ||
232 | .Pp | ||
233 | .Fn HMAC_CTX_copy | ||
234 | copies all of the internal state from | ||
235 | .Fa sctx | ||
236 | into | ||
237 | .Fa dctx . | ||
238 | .Pp | ||
239 | .Fn HMAC_CTX_set_flags | ||
240 | applies the specified flags to the internal | ||
241 | .Vt EVP_MD_CTX | ||
242 | objects. | ||
243 | Possible flag values | ||
244 | .Dv EVP_MD_CTX_FLAG_* | ||
245 | are defined in | ||
246 | .In openssl/evp.h . | ||
247 | .Pp | ||
248 | .Fn HMAC_size | ||
249 | returns the length in bytes of the underlying hash function output. | ||
250 | It is implemented as a macro. | ||
251 | .Sh RETURN VALUES | ||
252 | .Fn HMAC | ||
253 | returns a pointer to the message authentication code or | ||
254 | .Dv NULL | ||
255 | if an error occurred. | ||
256 | .Pp | ||
257 | .Fn HMAC_CTX_new | ||
258 | returns a pointer to the new | ||
259 | .Vt HMAC_CTX | ||
260 | object or | ||
261 | .Dv NULL | ||
262 | if an error occurred. | ||
263 | .Pp | ||
264 | .Fn HMAC_CTX_reset , | ||
265 | .Fn HMAC_Init_ex , | ||
266 | .Fn HMAC_Update , | ||
267 | .Fn HMAC_Final , | ||
268 | and | ||
269 | .Fn HMAC_CTX_copy | ||
270 | return 1 for success or 0 if an error occurred. | ||
271 | .Pp | ||
272 | .Fn HMAC_CTX_get_md | ||
273 | returns the message digest that was previously set for | ||
274 | .Fa ctx | ||
275 | with | ||
276 | .Fn HMAC_Init_ex , | ||
277 | or | ||
278 | .Dv NULL | ||
279 | if none was set. | ||
280 | .Pp | ||
281 | .Fn HMAC_size | ||
282 | returns the length in bytes of the underlying hash function output | ||
283 | or 0 on error. | ||
284 | .Sh SEE ALSO | ||
285 | .Xr CMAC_Init 3 , | ||
286 | .Xr EVP_DigestInit 3 | ||
287 | .Sh STANDARDS | ||
288 | RFC 2104 | ||
289 | .Sh HISTORY | ||
290 | .Fn HMAC , | ||
291 | .Fn HMAC_Update , | ||
292 | .Fn HMAC_Final , | ||
293 | and | ||
294 | .Fn HMAC_size | ||
295 | first appeared in SSLeay 0.9.0 and have been available since | ||
296 | .Ox 2.4 . | ||
297 | .Pp | ||
298 | .Fn HMAC_Init_ex | ||
299 | first appeared in OpenSSL 0.9.7 and have been available since | ||
300 | .Ox 3.2 . | ||
301 | .Pp | ||
302 | .Fn HMAC_CTX_set_flags | ||
303 | first appeared in OpenSSL 0.9.7f and have been available since | ||
304 | .Ox 3.8 . | ||
305 | .Pp | ||
306 | .Fn HMAC_CTX_copy | ||
307 | first appeared in OpenSSL 1.0.0 and has been available since | ||
308 | .Ox 4.9 . | ||
309 | .Pp | ||
310 | .Fn HMAC_CTX_new , | ||
311 | .Fn HMAC_CTX_reset , | ||
312 | .Fn HMAC_CTX_free , | ||
313 | and | ||
314 | .Fn HMAC_CTX_get_md | ||
315 | first appeared in OpenSSL 1.1.0 and have been available since | ||
316 | .Ox 6.3 . | ||
317 | .Sh CAVEATS | ||
318 | Other implementations allow | ||
319 | .Fa md | ||
320 | in | ||
321 | .Fn HMAC | ||
322 | to be | ||
323 | .Dv NULL | ||
324 | and return a static array, which is not thread safe. | ||