Debian Codegraph @

upstream/debian-unstable/man3/EVP_DigestInit.3ssl

raw
1 .\" -*- mode: troff; coding: utf-8 -*-
2 .\" Automatically generated by Pod::Man 5.0102 (Pod::Simple 3.45)
3 .\"
4 .\" Standard preamble:
5 .\" ========================================================================
6 .de Sp \" Vertical space (when we can't use .PP)
7 .if t .sp .5v
8 .if n .sp
9 ..
10 .de Vb \" Begin verbatim text
11 .ft CW
12 .nf
13 .ne \\$1
14 ..
15 .de Ve \" End verbatim text
16 .ft R
17 .fi
18 ..
19 .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>.
20 .ie n \{\
21 . ds C` ""
22 . ds C' ""
23 'br\}
24 .el\{\
25 . ds C`
26 . ds C'
27 'br\}
28 .\"
29 .\" Escape single quotes in literal strings from groff's Unicode transform.
30 .ie \n(.g .ds Aq \(aq
31 .el .ds Aq '
32 .\"
33 .\" If the F register is >0, we'll generate index entries on stderr for
34 .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
35 .\" entries marked with X<> in POD. Of course, you'll have to process the
36 .\" output yourself in some meaningful fashion.
37 .\"
38 .\" Avoid warning from groff about undefined register 'F'.
39 .de IX
40 ..
41 .nr rF 0
42 .if \n(.g .if rF .nr rF 1
43 .if (\n(rF:(\n(.g==0)) \{\
44 . if \nF \{\
45 . de IX
46 . tm Index:\\$1\t\\n%\t"\\$2"
47 ..
48 . if !\nF==2 \{\
49 . nr % 0
50 . nr F 2
51 . \}
52 . \}
53 .\}
54 .rr rF
55 .\" ========================================================================
56 .\"
57 .IX Title "EVP_DIGESTINIT 3SSL"
58 .TH EVP_DIGESTINIT 3SSL 2026-04-07 3.6.2 OpenSSL
59 .\" For nroff, turn off justification. Always turn off hyphenation; it makes
60 .\" way too many mistakes in technical documents.
61 .if n .ad l
62 .nh
63 .SH NAME
64 EVP_MD_fetch, EVP_MD_up_ref, EVP_MD_free,
65 EVP_MD_get_params, EVP_MD_gettable_params,
66 EVP_MD_CTX_new, EVP_MD_CTX_reset, EVP_MD_CTX_free, EVP_MD_CTX_dup,
67 EVP_MD_CTX_copy, EVP_MD_CTX_copy_ex, EVP_MD_CTX_ctrl,
68 EVP_MD_CTX_set_params, EVP_MD_CTX_get_params,
69 EVP_MD_settable_ctx_params, EVP_MD_gettable_ctx_params,
70 EVP_MD_CTX_settable_params, EVP_MD_CTX_gettable_params,
71 EVP_MD_CTX_set_flags, EVP_MD_CTX_clear_flags, EVP_MD_CTX_test_flags,
72 EVP_Q_digest, EVP_Digest, EVP_DigestInit_ex2, EVP_DigestInit_ex, EVP_DigestInit,
73 EVP_DigestUpdate, EVP_DigestFinal_ex, EVP_DigestFinalXOF, EVP_DigestFinal,
74 EVP_DigestSqueeze,
75 EVP_MD_is_a, EVP_MD_get0_name, EVP_MD_get0_description,
76 EVP_MD_names_do_all, EVP_MD_get0_provider, EVP_MD_get_type,
77 EVP_MD_get_pkey_type, EVP_MD_get_size, EVP_MD_get_block_size, EVP_MD_get_flags,
78 EVP_MD_CTX_get0_name, EVP_MD_CTX_md, EVP_MD_CTX_get0_md, EVP_MD_CTX_get1_md,
79 EVP_MD_CTX_get_type, EVP_MD_CTX_get_size_ex, EVP_MD_CTX_get_block_size,
80 EVP_MD_CTX_get0_md_data, EVP_MD_CTX_update_fn, EVP_MD_CTX_set_update_fn,
81 EVP_md_null,
82 EVP_get_digestbyname, EVP_get_digestbynid, EVP_get_digestbyobj,
83 EVP_MD_CTX_get_pkey_ctx, EVP_MD_CTX_set_pkey_ctx,
84 EVP_MD_do_all_provided,
85 EVP_MD_type, EVP_MD_nid, EVP_MD_name, EVP_MD_pkey_type, EVP_MD_size,
86 EVP_MD_block_size, EVP_MD_flags, EVP_MD_xof,
87 EVP_MD_CTX_size, EVP_MD_CTX_get_size, EVP_MD_CTX_block_size,
88 EVP_MD_CTX_type, EVP_MD_CTX_pkey_ctx, EVP_MD_CTX_md_data
89 \&\- EVP digest routines
90 .SH SYNOPSIS
91 .IX Header "SYNOPSIS"
92 .Vb 1
93 \& #include <openssl/evp.h>
94 \&
95 \& EVP_MD *EVP_MD_fetch(OSSL_LIB_CTX *ctx, const char *algorithm,
96 \& const char *properties);
97 \& int EVP_MD_up_ref(EVP_MD *md);
98 \& void EVP_MD_free(EVP_MD *md);
99 \& int EVP_MD_get_params(const EVP_MD *digest, OSSL_PARAM params[]);
100 \& const OSSL_PARAM *EVP_MD_gettable_params(const EVP_MD *digest);
101 \& EVP_MD_CTX *EVP_MD_CTX_new(void);
102 \& int EVP_MD_CTX_reset(EVP_MD_CTX *ctx);
103 \& void EVP_MD_CTX_free(EVP_MD_CTX *ctx);
104 \& void EVP_MD_CTX_ctrl(EVP_MD_CTX *ctx, int cmd, int p1, void* p2);
105 \& int EVP_MD_CTX_get_params(EVP_MD_CTX *ctx, OSSL_PARAM params[]);
106 \& int EVP_MD_CTX_set_params(EVP_MD_CTX *ctx, const OSSL_PARAM params[]);
107 \& const OSSL_PARAM *EVP_MD_settable_ctx_params(const EVP_MD *md);
108 \& const OSSL_PARAM *EVP_MD_gettable_ctx_params(const EVP_MD *md);
109 \& const OSSL_PARAM *EVP_MD_CTX_settable_params(EVP_MD_CTX *ctx);
110 \& const OSSL_PARAM *EVP_MD_CTX_gettable_params(EVP_MD_CTX *ctx);
111 \& void EVP_MD_CTX_set_flags(EVP_MD_CTX *ctx, int flags);
112 \& void EVP_MD_CTX_clear_flags(EVP_MD_CTX *ctx, int flags);
113 \& int EVP_MD_CTX_test_flags(const EVP_MD_CTX *ctx, int flags);
114 \&
115 \& int EVP_Q_digest(OSSL_LIB_CTX *libctx, const char *name, const char *propq,
116 \& const void *data, size_t datalen,
117 \& unsigned char *md, size_t *mdlen);
118 \& int EVP_Digest(const void *data, size_t count, unsigned char *md,
119 \& unsigned int *size, const EVP_MD *type, ENGINE *impl);
120 \& int EVP_DigestInit_ex2(EVP_MD_CTX *ctx, const EVP_MD *type,
121 \& const OSSL_PARAM params[]);
122 \& int EVP_DigestInit_ex(EVP_MD_CTX *ctx, const EVP_MD *type, ENGINE *impl);
123 \& int EVP_DigestUpdate(EVP_MD_CTX *ctx, const void *d, size_t cnt);
124 \& int EVP_DigestFinal_ex(EVP_MD_CTX *ctx, unsigned char *md, unsigned int *s);
125 \& int EVP_DigestFinalXOF(EVP_MD_CTX *ctx, unsigned char *out, size_t outlen);
126 \& int EVP_DigestSqueeze(EVP_MD_CTX *ctx, unsigned char *out, size_t outlen);
127 \&
128 \& EVP_MD_CTX *EVP_MD_CTX_dup(const EVP_MD_CTX *in);
129 \& int EVP_MD_CTX_copy_ex(EVP_MD_CTX *out, const EVP_MD_CTX *in);
130 \&
131 \& int EVP_DigestInit(EVP_MD_CTX *ctx, const EVP_MD *type);
132 \& int EVP_DigestFinal(EVP_MD_CTX *ctx, unsigned char *md, unsigned int *s);
133 \&
134 \& int EVP_MD_CTX_copy(EVP_MD_CTX *out, EVP_MD_CTX *in);
135 \&
136 \& const char *EVP_MD_get0_name(const EVP_MD *md);
137 \& const char *EVP_MD_get0_description(const EVP_MD *md);
138 \& int EVP_MD_is_a(const EVP_MD *md, const char *name);
139 \& int EVP_MD_names_do_all(const EVP_MD *md,
140 \& void (*fn)(const char *name, void *data),
141 \& void *data);
142 \& const OSSL_PROVIDER *EVP_MD_get0_provider(const EVP_MD *md);
143 \& int EVP_MD_get_type(const EVP_MD *md);
144 \& int EVP_MD_get_pkey_type(const EVP_MD *md);
145 \& int EVP_MD_get_size(const EVP_MD *md);
146 \& int EVP_MD_get_block_size(const EVP_MD *md);
147 \& unsigned long EVP_MD_get_flags(const EVP_MD *md);
148 \& int EVP_MD_xof(const EVP_MD *md);
149 \&
150 \& const EVP_MD *EVP_MD_CTX_get0_md(const EVP_MD_CTX *ctx);
151 \& EVP_MD *EVP_MD_CTX_get1_md(EVP_MD_CTX *ctx);
152 \& const char *EVP_MD_CTX_get0_name(const EVP_MD_CTX *ctx);
153 \& int EVP_MD_CTX_get_size_ex(const EVP_MD_CTX *ctx);
154 \& int EVP_MD_CTX_get_block_size(const EVP_MD_CTX *ctx);
155 \& int EVP_MD_CTX_get_type(const EVP_MD_CTX *ctx);
156 \& void *EVP_MD_CTX_get0_md_data(const EVP_MD_CTX *ctx);
157 \&
158 \& const EVP_MD *EVP_md_null(void);
159 \&
160 \& const EVP_MD *EVP_get_digestbyname(const char *name);
161 \& const EVP_MD *EVP_get_digestbynid(int type);
162 \& const EVP_MD *EVP_get_digestbyobj(const ASN1_OBJECT *o);
163 \&
164 \& EVP_PKEY_CTX *EVP_MD_CTX_get_pkey_ctx(const EVP_MD_CTX *ctx);
165 \& void EVP_MD_CTX_set_pkey_ctx(EVP_MD_CTX *ctx, EVP_PKEY_CTX *pctx);
166 \&
167 \& void EVP_MD_do_all_provided(OSSL_LIB_CTX *libctx,
168 \& void (*fn)(EVP_MD *mac, void *arg),
169 \& void *arg);
170 \&
171 \& #define EVP_MD_type EVP_MD_get_type
172 \& #define EVP_MD_nid EVP_MD_get_type
173 \& #define EVP_MD_name EVP_MD_get0_name
174 \& #define EVP_MD_pkey_type EVP_MD_get_pkey_type
175 \& #define EVP_MD_size EVP_MD_get_size
176 \& #define EVP_MD_block_size EVP_MD_get_block_size
177 \& #define EVP_MD_flags EVP_MD_get_flags
178 \& #define EVP_MD_CTX_get_size EVP_MD_CTX_get_size_ex
179 \& #define EVP_MD_CTX_size EVP_MD_CTX_get_size_ex
180 \& #define EVP_MD_CTX_block_size EVP_MD_CTX_get_block_size
181 \& #define EVP_MD_CTX_type EVP_MD_CTX_get_type
182 \& #define EVP_MD_CTX_pkey_ctx EVP_MD_CTX_get_pkey_ctx
183 \& #define EVP_MD_CTX_md_data EVP_MD_CTX_get0_md_data
184 .Ve
185 .PP
186 The following functions have been deprecated since OpenSSL 3.0, and can be
187 hidden entirely by defining \fBOPENSSL_API_COMPAT\fR with a suitable version value,
188 see \fBopenssl_user_macros\fR\|(7):
189 .PP
190 .Vb 1
191 \& const EVP_MD *EVP_MD_CTX_md(const EVP_MD_CTX *ctx);
192 \&
193 \& int (*EVP_MD_CTX_update_fn(EVP_MD_CTX *ctx))(EVP_MD_CTX *ctx,
194 \& const void *data, size_t count);
195 \&
196 \& void EVP_MD_CTX_set_update_fn(EVP_MD_CTX *ctx,
197 \& int (*update)(EVP_MD_CTX *ctx,
198 \& const void *data, size_t count));
199 .Ve
200 .SH DESCRIPTION
201 .IX Header "DESCRIPTION"
202 The EVP digest routines are a high-level interface to message digests, and
203 Extendable Output Functions (XOF).
204 .PP
205 The \fBEVP_MD\fR type is a structure for digest method implementation.
206 .PP
207 Each Message digest algorithm (such as SHA256) produces a fixed size output
208 length which is returned when \fBEVP_DigestFinal_ex()\fR is called.
209 Extendable Output Functions (XOF) such as SHAKE256 have a variable sized output
210 length \fIoutlen\fR which can be used with either \fBEVP_DigestFinalXOF()\fR or
211 \&\fBEVP_DigestSqueeze()\fR. \fBEVP_DigestFinal_ex()\fR may also be used for an XOF, but the
212 "xoflen" must be set beforehand (See "PARAMETERS").
213 Note that \fBEVP_MD_get_size()\fR and \fBEVP_MD_CTX_get_size_ex()\fR behave differently for
214 an XOF.
215 .IP \fBEVP_MD_fetch()\fR 4
216 .IX Item "EVP_MD_fetch()"
217 Fetches the digest implementation for the given \fIalgorithm\fR from any
218 provider offering it, within the criteria given by the \fIproperties\fR.
219 See "ALGORITHM FETCHING" in \fBcrypto\fR\|(7) for further information.
220 .Sp
221 The returned value must eventually be freed with \fBEVP_MD_free()\fR.
222 .Sp
223 Fetched \fBEVP_MD\fR structures are reference counted.
224 .IP \fBEVP_MD_up_ref()\fR 4
225 .IX Item "EVP_MD_up_ref()"
226 Increments the reference count for an \fBEVP_MD\fR structure.
227 .IP \fBEVP_MD_free()\fR 4
228 .IX Item "EVP_MD_free()"
229 Decrements the reference count for the fetched \fBEVP_MD\fR structure.
230 If the reference count drops to 0 then the structure is freed.
231 If the argument is NULL, nothing is done.
232 .IP \fBEVP_MD_CTX_new()\fR 4
233 .IX Item "EVP_MD_CTX_new()"
234 Allocates and returns a digest context.
235 .IP \fBEVP_MD_CTX_reset()\fR 4
236 .IX Item "EVP_MD_CTX_reset()"
237 Resets the digest context \fIctx\fR. This can be used to reuse an already
238 existing context.
239 .IP \fBEVP_MD_CTX_free()\fR 4
240 .IX Item "EVP_MD_CTX_free()"
241 Cleans up digest context \fIctx\fR and frees up the space allocated to it.
242 If the argument is NULL, nothing is done.
243 .IP \fBEVP_MD_CTX_ctrl()\fR 4
244 .IX Item "EVP_MD_CTX_ctrl()"
245 \&\fIThis is a legacy method. \fR\f(BIEVP_MD_CTX_set_params()\fR\fI and \fR\f(BIEVP_MD_CTX_get_params()\fR\fI
246 is the mechanism that should be used to set and get parameters that are used by
247 providers.\fR
248 .Sp
249 Performs digest-specific control actions on context \fIctx\fR. The control command
250 is indicated in \fIcmd\fR and any additional arguments in \fIp1\fR and \fIp2\fR.
251 \&\fBEVP_MD_CTX_ctrl()\fR must be called after \fBEVP_DigestInit_ex2()\fR. Other restrictions
252 may apply depending on the control type and digest implementation.
253 .Sp
254 If this function happens to be used with a fetched \fBEVP_MD\fR, it will
255 translate the controls that are known to OpenSSL into \fBOSSL_PARAM\fR\|(3)
256 parameters with keys defined by OpenSSL and call \fBEVP_MD_CTX_get_params()\fR or
257 \&\fBEVP_MD_CTX_set_params()\fR as is appropriate for each control command.
258 .Sp
259 See "CONTROLS" below for more information, including what translations are
260 being done.
261 .IP \fBEVP_MD_get_params()\fR 4
262 .IX Item "EVP_MD_get_params()"
263 Retrieves the requested list of \fIparams\fR from a MD \fImd\fR.
264 See "PARAMETERS" below for more information.
265 .IP \fBEVP_MD_CTX_get_params()\fR 4
266 .IX Item "EVP_MD_CTX_get_params()"
267 Retrieves the requested list of \fIparams\fR from a MD context \fIctx\fR.
268 See "PARAMETERS" below for more information.
269 .IP \fBEVP_MD_CTX_set_params()\fR 4
270 .IX Item "EVP_MD_CTX_set_params()"
271 Sets the list of \fIparams\fR into a MD context \fIctx\fR.
272 See "PARAMETERS" below for more information.
273 .IP \fBEVP_MD_gettable_params()\fR 4
274 .IX Item "EVP_MD_gettable_params()"
275 Get a constant \fBOSSL_PARAM\fR\|(3) array that describes the retrievable parameters
276 that can be used with \fBEVP_MD_get_params()\fR.
277 .IP "\fBEVP_MD_gettable_ctx_params()\fR, \fBEVP_MD_CTX_gettable_params()\fR" 4
278 .IX Item "EVP_MD_gettable_ctx_params(), EVP_MD_CTX_gettable_params()"
279 Get a constant \fBOSSL_PARAM\fR\|(3) array that describes the retrievable parameters
280 that can be used with \fBEVP_MD_CTX_get_params()\fR. \fBEVP_MD_gettable_ctx_params()\fR
281 returns the parameters that can be retrieved from the algorithm, whereas
282 \&\fBEVP_MD_CTX_gettable_params()\fR returns the parameters that can be retrieved
283 in the context's current state.
284 .IP "\fBEVP_MD_settable_ctx_params()\fR, \fBEVP_MD_CTX_settable_params()\fR" 4
285 .IX Item "EVP_MD_settable_ctx_params(), EVP_MD_CTX_settable_params()"
286 Get a constant \fBOSSL_PARAM\fR\|(3) array that describes the settable parameters
287 that can be used with \fBEVP_MD_CTX_set_params()\fR. \fBEVP_MD_settable_ctx_params()\fR
288 returns the parameters that can be set from the algorithm, whereas
289 \&\fBEVP_MD_CTX_settable_params()\fR returns the parameters that can be set in the
290 context's current state.
291 .IP "\fBEVP_MD_CTX_set_flags()\fR, \fBEVP_MD_CTX_clear_flags()\fR, \fBEVP_MD_CTX_test_flags()\fR" 4
292 .IX Item "EVP_MD_CTX_set_flags(), EVP_MD_CTX_clear_flags(), EVP_MD_CTX_test_flags()"
293 Sets, clears and tests \fIctx\fR flags. See "FLAGS" below for more information.
294 .IP "\fBEVP_Q_digest()\fR is a quick one-shot digest function." 4
295 .IX Item "EVP_Q_digest() is a quick one-shot digest function."
296 It hashes \fIdatalen\fR bytes of data at \fIdata\fR using the digest algorithm
297 \&\fIname\fR, which is fetched using the optional \fIlibctx\fR and \fIpropq\fR parameters.
298 The digest value is placed in \fImd\fR and its length is written at \fImdlen\fR
299 if the pointer is not NULL. At most \fBEVP_MAX_MD_SIZE\fR bytes will be written.
300 .IP \fBEVP_Digest()\fR 4
301 .IX Item "EVP_Digest()"
302 A wrapper around the Digest Init_ex, Update and Final_ex functions.
303 Hashes \fIcount\fR bytes of data at \fIdata\fR using a digest \fItype\fR from ENGINE
304 \&\fIimpl\fR. The digest value is placed in \fImd\fR and its length is written at \fIsize\fR
305 if the pointer is not NULL. At most \fBEVP_MAX_MD_SIZE\fR bytes will be written.
306 If \fIimpl\fR is NULL the default implementation of digest \fItype\fR is used.
307 .IP \fBEVP_DigestInit_ex2()\fR 4
308 .IX Item "EVP_DigestInit_ex2()"
309 Sets up digest context \fIctx\fR to use a digest \fItype\fR.
310 \&\fItype\fR is typically supplied by a function such as \fBEVP_sha1()\fR, or a
311 value explicitly fetched with \fBEVP_MD_fetch()\fR. \fIctx\fR \fBMUST NOT\fR be NULL.
312 .Sp
313 The parameters \fBparams\fR are set on the context after initialisation.
314 .Sp
315 The \fItype\fR parameter can be NULL if \fIctx\fR has been already initialized
316 with another \fBEVP_DigestInit_ex()\fR call and has not been reset with
317 \&\fBEVP_MD_CTX_reset()\fR.
318 .IP \fBEVP_DigestInit_ex()\fR 4
319 .IX Item "EVP_DigestInit_ex()"
320 Sets up digest context \fIctx\fR to use a digest \fItype\fR.
321 \&\fItype\fR is typically supplied by a function such as \fBEVP_sha1()\fR, or a
322 value explicitly fetched with \fBEVP_MD_fetch()\fR.
323 .Sp
324 If \fIimpl\fR is non-NULL, its implementation of the digest \fItype\fR is used if
325 there is one, and if not, the default implementation is used.
326 .Sp
327 The \fItype\fR parameter can be NULL if \fIctx\fR has been already initialized
328 with another \fBEVP_DigestInit_ex()\fR call and has not been reset with
329 \&\fBEVP_MD_CTX_reset()\fR.
330 .IP \fBEVP_DigestUpdate()\fR 4
331 .IX Item "EVP_DigestUpdate()"
332 Hashes \fIcnt\fR bytes of data at \fId\fR into the digest context \fIctx\fR. This
333 function can be called several times on the same \fIctx\fR to hash additional
334 data.
335 .IP \fBEVP_DigestFinal_ex()\fR 4
336 .IX Item "EVP_DigestFinal_ex()"
337 Retrieves the digest value from \fIctx\fR and places it in \fImd\fR. If the \fIs\fR
338 parameter is not NULL then the number of bytes of data written (i.e. the
339 length of the digest) will be written to the integer at \fIs\fR, at most
340 \&\fBEVP_MAX_MD_SIZE\fR bytes will be written unless the digest implementation
341 allows changing the digest size and it is set to a larger value by the
342 application. After calling \fBEVP_DigestFinal_ex()\fR no additional calls to
343 \&\fBEVP_DigestUpdate()\fR can be made, but \fBEVP_DigestInit_ex2()\fR can be called to
344 initialize a new digest operation. \fIctx\fR \fBMUST NOT\fR be NULL.
345 .IP \fBEVP_DigestFinalXOF()\fR 4
346 .IX Item "EVP_DigestFinalXOF()"
347 Interfaces to extendable-output functions, XOFs, such as SHAKE128 and SHAKE256.
348 It retrieves the digest value from \fIctx\fR and places it in \fIoutlen\fR\-sized \fIout\fR.
349 After calling this function no additional calls to \fBEVP_DigestUpdate()\fR can be
350 made, but \fBEVP_DigestInit_ex2()\fR can be called to initialize a new operation.
351 \&\fBEVP_DigestFinalXOF()\fR may only be called once
352 .IP \fBEVP_DigestSqueeze()\fR 4
353 .IX Item "EVP_DigestSqueeze()"
354 Similar to \fBEVP_DigestFinalXOF()\fR but allows multiple calls to be made to
355 squeeze variable length output data.
356 \&\fBEVP_DigestFinalXOF()\fR should not be called after this.
357 .IP \fBEVP_MD_CTX_dup()\fR 4
358 .IX Item "EVP_MD_CTX_dup()"
359 Can be used to duplicate the message digest state from \fIin\fR. This is useful
360 to avoid multiple \fBEVP_MD_fetch()\fR calls or if large amounts of data are to be
361 hashed which only differ in the last few bytes.
362 .IP \fBEVP_MD_CTX_copy_ex()\fR 4
363 .IX Item "EVP_MD_CTX_copy_ex()"
364 Can be used to copy the message digest state from \fIin\fR to \fIout\fR. This is
365 useful if large amounts of data are to be hashed which only differ in the last
366 few bytes.
367 .IP \fBEVP_DigestInit()\fR 4
368 .IX Item "EVP_DigestInit()"
369 Behaves in the same way as \fBEVP_DigestInit_ex2()\fR except it doesn't set any
370 parameters and calls \fBEVP_MD_CTX_reset()\fR so it cannot be used with an \fItype\fR
371 of NULL.
372 .IP \fBEVP_DigestFinal()\fR 4
373 .IX Item "EVP_DigestFinal()"
374 Similar to \fBEVP_DigestFinal_ex()\fR except after computing the digest
375 the digest context \fIctx\fR is automatically cleaned up with \fBEVP_MD_CTX_reset()\fR.
376 .IP \fBEVP_MD_CTX_copy()\fR 4
377 .IX Item "EVP_MD_CTX_copy()"
378 Similar to \fBEVP_MD_CTX_copy_ex()\fR except the destination \fIout\fR does not have to
379 be initialized.
380 .IP \fBEVP_MD_is_a()\fR 4
381 .IX Item "EVP_MD_is_a()"
382 Returns 1 if \fImd\fR is an implementation of an algorithm that's
383 identifiable with \fIname\fR, otherwise 0.
384 .Sp
385 If \fImd\fR is a legacy digest (it's the return value from the likes of
386 \&\fBEVP_sha256()\fR rather than the result of an \fBEVP_MD_fetch()\fR), only cipher
387 names registered with the default library context (see
388 \&\fBOSSL_LIB_CTX\fR\|(3)) will be considered.
389 .IP \fBEVP_MD_xof()\fR 4
390 .IX Item "EVP_MD_xof()"
391 Returns 1 if \fImd\fR is an Extendable-output Function (XOF) otherwise it returns
392 0. SHAKE128 and SHAKE256 are XOF functions.
393 It returns 0 for BLAKE2B algorithms.
394 .IP "\fBEVP_MD_get0_name()\fR, \fBEVP_MD_CTX_get0_name()\fR" 4
395 .IX Item "EVP_MD_get0_name(), EVP_MD_CTX_get0_name()"
396 Return the name of the given message digest. For fetched message
397 digests with multiple names, only one of them is returned; it's
398 recommended to use \fBEVP_MD_names_do_all()\fR instead.
399 .IP \fBEVP_MD_names_do_all()\fR 4
400 .IX Item "EVP_MD_names_do_all()"
401 Traverses all names for the \fImd\fR, and calls \fIfn\fR with each name and
402 \&\fIdata\fR. This is only useful with fetched \fBEVP_MD\fRs.
403 .IP \fBEVP_MD_get0_description()\fR 4
404 .IX Item "EVP_MD_get0_description()"
405 Returns a description of the digest, meant for display and human consumption.
406 The description is at the discretion of the digest implementation.
407 .IP \fBEVP_MD_get0_provider()\fR 4
408 .IX Item "EVP_MD_get0_provider()"
409 Returns an \fBOSSL_PROVIDER\fR pointer to the provider that implements the given
410 \&\fBEVP_MD\fR.
411 .IP \fBEVP_MD_get_size()\fR 4
412 .IX Item "EVP_MD_get_size()"
413 Return the size of the message digest when passed an \fBEVP_MD\fR, i.e. the size of
414 the hash. A negative value or 0 can occur for invalid size.
415 For an XOF with no default size this returns 0.
416 .IP "\fBEVP_MD_CTX_get_size_ex()\fR, \fBEVP_MD_CTX_get_size()\fR" 4
417 .IX Item "EVP_MD_CTX_get_size_ex(), EVP_MD_CTX_get_size()"
418 For a normal digest this is the same as \fBEVP_MD_get_size()\fR.
419 For an XOF this returns the "xoflen" if it has been set, otherwise it returns 0.
420 .IP "\fBEVP_MD_get_block_size()\fR, \fBEVP_MD_CTX_get_block_size()\fR" 4
421 .IX Item "EVP_MD_get_block_size(), EVP_MD_CTX_get_block_size()"
422 Return the block size of the message digest when passed an \fBEVP_MD\fR or an
423 \&\fBEVP_MD_CTX\fR structure.
424 .IP "\fBEVP_MD_get_type()\fR, \fBEVP_MD_CTX_get_type()\fR" 4
425 .IX Item "EVP_MD_get_type(), EVP_MD_CTX_get_type()"
426 Return the NID of the OBJECT IDENTIFIER representing the given message digest
427 when passed an \fBEVP_MD\fR structure. For example, \f(CW\*(C`EVP_MD_get_type(EVP_sha1())\*(C'\fR
428 returns \fBNID_sha1\fR. This function is normally used when setting ASN1 OIDs.
429 .IP \fBEVP_MD_CTX_get0_md_data()\fR 4
430 .IX Item "EVP_MD_CTX_get0_md_data()"
431 Return the digest method private data for the passed \fBEVP_MD_CTX\fR.
432 The space is allocated by OpenSSL and has the size originally set with
433 \&\fBEVP_MD_meth_set_app_datasize()\fR.
434 .IP "\fBEVP_MD_CTX_get0_md()\fR, \fBEVP_MD_CTX_get1_md()\fR" 4
435 .IX Item "EVP_MD_CTX_get0_md(), EVP_MD_CTX_get1_md()"
436 \&\fBEVP_MD_CTX_get0_md()\fR returns
437 the \fBEVP_MD\fR structure corresponding to the passed \fBEVP_MD_CTX\fR. This
438 will be the same \fBEVP_MD\fR object originally passed to \fBEVP_DigestInit_ex2()\fR (or
439 other similar function) when the EVP_MD_CTX was first initialised. Note that
440 where explicit fetch is in use (see \fBEVP_MD_fetch\fR\|(3)) the value returned from
441 this function will not have its reference count incremented and therefore it
442 should not be used after the EVP_MD_CTX is freed.
443 \&\fBEVP_MD_CTX_get1_md()\fR is the same except the ownership is passed to the
444 caller and is from the passed \fBEVP_MD_CTX\fR.
445 .IP \fBEVP_MD_CTX_set_update_fn()\fR 4
446 .IX Item "EVP_MD_CTX_set_update_fn()"
447 Sets the update function for \fIctx\fR to \fIupdate\fR.
448 This is the function that is called by \fBEVP_DigestUpdate()\fR. If not set, the
449 update function from the \fBEVP_MD\fR type specified at initialization is used.
450 .IP \fBEVP_MD_CTX_update_fn()\fR 4
451 .IX Item "EVP_MD_CTX_update_fn()"
452 Returns the update function for \fIctx\fR.
453 .IP \fBEVP_MD_get_flags()\fR 4
454 .IX Item "EVP_MD_get_flags()"
455 Returns the \fImd\fR flags. Note that these are different from the \fBEVP_MD_CTX\fR
456 ones. See \fBEVP_MD_meth_set_flags\fR\|(3) for more information.
457 .IP \fBEVP_MD_get_pkey_type()\fR 4
458 .IX Item "EVP_MD_get_pkey_type()"
459 Returns the NID of the public key signing algorithm associated with this
460 digest. For example \fBEVP_sha1()\fR is associated with RSA so this will return
461 \&\fBNID_sha1WithRSAEncryption\fR. Since digests and signature algorithms are no
462 longer linked this function is only retained for compatibility reasons.
463 .IP \fBEVP_md_null()\fR 4
464 .IX Item "EVP_md_null()"
465 A "null" message digest that does nothing: i.e. the hash it returns is of zero
466 length.
467 .IP "\fBEVP_get_digestbyname()\fR, \fBEVP_get_digestbynid()\fR, \fBEVP_get_digestbyobj()\fR" 4
468 .IX Item "EVP_get_digestbyname(), EVP_get_digestbynid(), EVP_get_digestbyobj()"
469 Returns an \fBEVP_MD\fR structure when passed a digest name, a digest \fBNID\fR or an
470 \&\fBASN1_OBJECT\fR structure respectively.
471 .Sp
472 The \fBEVP_get_digestbyname()\fR function is present for backwards compatibility with
473 OpenSSL prior to version 3 and is different to the \fBEVP_MD_fetch()\fR function
474 since it does not attempt to "fetch" an implementation of the cipher.
475 Additionally, it only knows about digests that are built-in to OpenSSL and have
476 an associated NID. Similarly \fBEVP_get_digestbynid()\fR and \fBEVP_get_digestbyobj()\fR
477 also return objects without an associated implementation.
478 .Sp
479 When the digest objects returned by these functions are used (such as in a call
480 to \fBEVP_DigestInit_ex()\fR) an implementation of the digest will be implicitly
481 fetched from the loaded providers. This fetch could fail if no suitable
482 implementation is available. Use \fBEVP_MD_fetch()\fR instead to explicitly fetch
483 the algorithm and an associated implementation from a provider.
484 .Sp
485 See "ALGORITHM FETCHING" in \fBcrypto\fR\|(7) for more information about fetching.
486 .Sp
487 The digest objects returned from these functions do not need to be freed with
488 \&\fBEVP_MD_free()\fR.
489 .IP \fBEVP_MD_CTX_get_pkey_ctx()\fR 4
490 .IX Item "EVP_MD_CTX_get_pkey_ctx()"
491 Returns the \fBEVP_PKEY_CTX\fR assigned to \fIctx\fR. The returned pointer should not
492 be freed by the caller.
493 .IP \fBEVP_MD_CTX_set_pkey_ctx()\fR 4
494 .IX Item "EVP_MD_CTX_set_pkey_ctx()"
495 Assigns an \fBEVP_PKEY_CTX\fR to \fBEVP_MD_CTX\fR. This is usually used to provide
496 a customized \fBEVP_PKEY_CTX\fR to \fBEVP_DigestSignInit\fR\|(3) or
497 \&\fBEVP_DigestVerifyInit\fR\|(3). The \fIpctx\fR passed to this function should be freed
498 by the caller. A NULL \fIpctx\fR pointer is also allowed to clear the \fBEVP_PKEY_CTX\fR
499 assigned to \fIctx\fR. In such case, freeing the cleared \fBEVP_PKEY_CTX\fR or not
500 depends on how the \fBEVP_PKEY_CTX\fR is created.
501 .IP \fBEVP_MD_do_all_provided()\fR 4
502 .IX Item "EVP_MD_do_all_provided()"
503 Traverses all messages digests implemented by all activated providers
504 in the given library context \fIlibctx\fR, and for each of the implementations,
505 calls the given function \fIfn\fR with the implementation method and the given
506 \&\fIarg\fR as argument.
507 .SH PARAMETERS
508 .IX Header "PARAMETERS"
509 See \fBOSSL_PARAM\fR\|(3) for information about passing parameters.
510 .PP
511 \&\fBEVP_MD_CTX_set_params()\fR and \fBEVP_MD_CTX_get_params()\fR can be used with the
512 following OSSL_PARAM keys:
513 .IP """xoflen"" (\fBOSSL_DIGEST_PARAM_XOFLEN\fR) <unsigned integer>" 4
514 .IX Item """xoflen"" (OSSL_DIGEST_PARAM_XOFLEN) <unsigned integer>"
515 Sets or gets the digest length for extendable output functions.
516 The value should not exceed what can be given using a \fBsize_t\fR.
517 It may be used by SHAKE\-128 and SHAKE\-256 to set the
518 output length used by \fBEVP_DigestFinal_ex()\fR and \fBEVP_DigestFinal()\fR.
519 .IP """size"" (\fBOSSL_DIGEST_PARAM_SIZE\fR) <unsigned integer>" 4
520 .IX Item """size"" (OSSL_DIGEST_PARAM_SIZE) <unsigned integer>"
521 Sets or gets a fixed digest length.
522 The value should not exceed what can be given using a \fBsize_t\fR.
523 It may be used by BLAKE2B\-512 to set the output length used by
524 \&\fBEVP_DigestFinal_ex()\fR and \fBEVP_DigestFinal()\fR.
525 .PP
526 \&\fBEVP_MD_CTX_set_params()\fR can be used with the following OSSL_PARAM keys:
527 .IP """pad-type"" (\fBOSSL_DIGEST_PARAM_PAD_TYPE\fR) <unsigned integer>" 4
528 .IX Item """pad-type"" (OSSL_DIGEST_PARAM_PAD_TYPE) <unsigned integer>"
529 Sets the padding type.
530 It is used by the MDC2 algorithm.
531 .PP
532 \&\fBEVP_MD_CTX_get_params()\fR can be used with the following OSSL_PARAM keys:
533 .IP """micalg"" (\fBOSSL_DIGEST_PARAM_MICALG\fR) <UTF8 string>." 4
534 .IX Item """micalg"" (OSSL_DIGEST_PARAM_MICALG) <UTF8 string>."
535 Gets the digest Message Integrity Check algorithm string. This is used when
536 creating S/MIME multipart/signed messages, as specified in RFC 3851.
537 It may be used by external engines or providers.
538 .SH CONTROLS
539 .IX Header "CONTROLS"
540 \&\fBEVP_MD_CTX_ctrl()\fR can be used to send the following standard controls:
541 .IP EVP_MD_CTRL_MICALG 4
542 .IX Item "EVP_MD_CTRL_MICALG"
543 Gets the digest Message Integrity Check algorithm string. This is used when
544 creating S/MIME multipart/signed messages, as specified in RFC 3851.
545 The string value is written to \fIp2\fR.
546 .Sp
547 When used with a fetched \fBEVP_MD\fR, \fBEVP_MD_CTX_get_params()\fR gets called with
548 an \fBOSSL_PARAM\fR\|(3) item with the key "micalg" (\fBOSSL_DIGEST_PARAM_MICALG\fR).
549 .IP EVP_MD_CTRL_XOF_LEN 4
550 .IX Item "EVP_MD_CTRL_XOF_LEN"
551 This control sets the digest length for extendable output functions to \fIp1\fR.
552 Sending this control directly should not be necessary, the use of
553 \&\fBEVP_DigestFinalXOF()\fR is preferred.
554 Currently used by SHAKE algorithms.
555 .Sp
556 When used with a fetched \fBEVP_MD\fR, \fBEVP_MD_CTX_get_params()\fR gets called with
557 an \fBOSSL_PARAM\fR\|(3) item with the key "xoflen" (\fBOSSL_DIGEST_PARAM_XOFLEN\fR).
558 .SH FLAGS
559 .IX Header "FLAGS"
560 \&\fBEVP_MD_CTX_set_flags()\fR, \fBEVP_MD_CTX_clear_flags()\fR and \fBEVP_MD_CTX_test_flags()\fR
561 can be used the manipulate and test these \fBEVP_MD_CTX\fR flags:
562 .IP EVP_MD_CTX_FLAG_ONESHOT 4
563 .IX Item "EVP_MD_CTX_FLAG_ONESHOT"
564 This flag instructs the digest to optimize for one update only, if possible.
565 .IP EVP_MD_CTX_FLAG_CLEANED 4
566 .IX Item "EVP_MD_CTX_FLAG_CLEANED"
567 This flag is for internal use only and \fImust not\fR be used in user code.
568 .IP EVP_MD_CTX_FLAG_REUSE 4
569 .IX Item "EVP_MD_CTX_FLAG_REUSE"
570 This flag is for internal use only and \fImust not\fR be used in user code.
571 .IP EVP_MD_CTX_FLAG_NO_INIT 4
572 .IX Item "EVP_MD_CTX_FLAG_NO_INIT"
573 This flag instructs \fBEVP_DigestInit()\fR and similar not to initialise the
574 implementation specific data.
575 .IP EVP_MD_CTX_FLAG_FINALISE 4
576 .IX Item "EVP_MD_CTX_FLAG_FINALISE"
577 Some functions such as EVP_DigestSign only finalise copies of internal
578 contexts so additional data can be included after the finalisation call.
579 This is inefficient if this functionality is not required, and can be
580 disabled with this flag.
581 .SH "RETURN VALUES"
582 .IX Header "RETURN VALUES"
583 .IP \fBEVP_MD_fetch()\fR 4
584 .IX Item "EVP_MD_fetch()"
585 Returns a pointer to a \fBEVP_MD\fR for success or NULL for failure.
586 .IP \fBEVP_MD_up_ref()\fR 4
587 .IX Item "EVP_MD_up_ref()"
588 Returns 1 for success or 0 for failure.
589 .IP "\fBEVP_Q_digest()\fR, \fBEVP_Digest()\fR, \fBEVP_DigestInit_ex2()\fR, \fBEVP_DigestInit_ex()\fR, \fBEVP_DigestInit()\fR, \fBEVP_DigestUpdate()\fR, \fBEVP_DigestFinal_ex()\fR, \fBEVP_DigestFinalXOF()\fR, and \fBEVP_DigestFinal()\fR" 4
590 .IX Item "EVP_Q_digest(), EVP_Digest(), EVP_DigestInit_ex2(), EVP_DigestInit_ex(), EVP_DigestInit(), EVP_DigestUpdate(), EVP_DigestFinal_ex(), EVP_DigestFinalXOF(), and EVP_DigestFinal()"
591 return 1 for
592 success and 0 for failure.
593 .IP \fBEVP_MD_CTX_ctrl()\fR 4
594 .IX Item "EVP_MD_CTX_ctrl()"
595 Returns 1 if successful or 0 for failure.
596 .IP "\fBEVP_MD_CTX_set_params()\fR, \fBEVP_MD_CTX_get_params()\fR" 4
597 .IX Item "EVP_MD_CTX_set_params(), EVP_MD_CTX_get_params()"
598 Returns 1 if successful or 0 for failure.
599 .IP "\fBEVP_MD_CTX_settable_params()\fR, \fBEVP_MD_CTX_gettable_params()\fR" 4
600 .IX Item "EVP_MD_CTX_settable_params(), EVP_MD_CTX_gettable_params()"
601 Return an array of constant \fBOSSL_PARAM\fR\|(3)s, or NULL if there is none
602 to get.
603 .IP \fBEVP_MD_CTX_dup()\fR 4
604 .IX Item "EVP_MD_CTX_dup()"
605 Returns a new EVP_MD_CTX if successful or NULL on failure.
606 .IP \fBEVP_MD_CTX_copy_ex()\fR 4
607 .IX Item "EVP_MD_CTX_copy_ex()"
608 Returns 1 if successful or 0 for failure.
609 .IP "\fBEVP_MD_get_type()\fR, \fBEVP_MD_get_pkey_type()\fR" 4
610 .IX Item "EVP_MD_get_type(), EVP_MD_get_pkey_type()"
611 Returns the NID of the corresponding OBJECT IDENTIFIER or NID_undef if none
612 exists.
613 .IP "\fBEVP_MD_get_size()\fR, \fBEVP_MD_get_block_size()\fR, \fBEVP_MD_CTX_get_size()\fR, \fBEVP_MD_CTX_get_block_size()\fR" 4
614 .IX Item "EVP_MD_get_size(), EVP_MD_get_block_size(), EVP_MD_CTX_get_size(), EVP_MD_CTX_get_block_size()"
615 Returns the digest or block size in bytes or \-1 for failure.
616 .IP \fBEVP_md_null()\fR 4
617 .IX Item "EVP_md_null()"
618 Returns a pointer to the \fBEVP_MD\fR structure of the "null" message digest.
619 .IP "\fBEVP_get_digestbyname()\fR, \fBEVP_get_digestbynid()\fR, \fBEVP_get_digestbyobj()\fR" 4
620 .IX Item "EVP_get_digestbyname(), EVP_get_digestbynid(), EVP_get_digestbyobj()"
621 Returns either an \fBEVP_MD\fR structure or NULL if an error occurs.
622 .IP \fBEVP_MD_CTX_set_pkey_ctx()\fR 4
623 .IX Item "EVP_MD_CTX_set_pkey_ctx()"
624 This function has no return value.
625 .IP \fBEVP_MD_names_do_all()\fR 4
626 .IX Item "EVP_MD_names_do_all()"
627 Returns 1 if the callback was called for all names. A return value of 0 means
628 that the callback was not called for any names.
629 .SH NOTES
630 .IX Header "NOTES"
631 The \fBEVP\fR interface to message digests should almost always be used in
632 preference to the low-level interfaces. This is because the code then becomes
633 transparent to the digest used and much more flexible.
634 .PP
635 New applications should use the SHA\-2 (such as \fBEVP_sha256\fR\|(3)) or the SHA\-3
636 digest algorithms (such as \fBEVP_sha3_512\fR\|(3)). The other digest algorithms
637 are still in common use.
638 .PP
639 For most applications the \fIimpl\fR parameter to \fBEVP_DigestInit_ex()\fR will be
640 set to NULL to use the default digest implementation.
641 .PP
642 Ignoring failure returns of \fBEVP_DigestInit_ex()\fR, \fBEVP_DigestInit_ex2()\fR, or
643 \&\fBEVP_DigestInit()\fR can lead to undefined behavior on subsequent calls
644 updating or finalizing the \fBEVP_MD_CTX\fR such as the \fBEVP_DigestUpdate()\fR or
645 \&\fBEVP_DigestFinal()\fR functions. The only valid calls on the \fBEVP_MD_CTX\fR
646 when initialization fails are calls that attempt another initialization of
647 the context or release the context.
648 .PP
649 The functions \fBEVP_DigestInit()\fR, \fBEVP_DigestFinal()\fR and \fBEVP_MD_CTX_copy()\fR are
650 obsolete but are retained to maintain compatibility with existing code. New
651 applications should use \fBEVP_DigestInit_ex()\fR, \fBEVP_DigestFinal_ex()\fR and
652 \&\fBEVP_MD_CTX_copy_ex()\fR because they can efficiently reuse a digest context
653 instead of initializing and cleaning it up on each call and allow non default
654 implementations of digests to be specified.
655 .PP
656 If digest contexts are not cleaned up after use,
657 memory leaks will occur.
658 .PP
659 \&\fBEVP_MD_CTX_get0_name()\fR, \fBEVP_MD_CTX_get_size()\fR, \fBEVP_MD_CTX_get_block_size()\fR,
660 \&\fBEVP_MD_CTX_get_type()\fR, \fBEVP_get_digestbynid()\fR and \fBEVP_get_digestbyobj()\fR are
661 defined as macros.
662 .PP
663 \&\fBEVP_MD_CTX_ctrl()\fR sends commands to message digests for additional configuration
664 or control.
665 .SH EXAMPLES
666 .IX Header "EXAMPLES"
667 This example digests the data "Test Message\en" and "Hello World\en", using the
668 digest name passed on the command line.
669 .PP
670 .Vb 3
671 \& #include <stdio.h>
672 \& #include <string.h>
673 \& #include <openssl/evp.h>
674 \&
675 \& int main(int argc, char *argv[])
676 \& {
677 \& EVP_MD_CTX *mdctx;
678 \& const EVP_MD *md;
679 \& char mess1[] = "Test Message\en";
680 \& char mess2[] = "Hello World\en";
681 \& unsigned char md_value[EVP_MAX_MD_SIZE];
682 \& unsigned int md_len, i;
683 \&
684 \& if (argv[1] == NULL) {
685 \& printf("Usage: mdtest digestname\en");
686 \& exit(1);
687 \& }
688 \&
689 \& md = EVP_get_digestbyname(argv[1]);
690 \& if (md == NULL) {
691 \& printf("Unknown message digest %s\en", argv[1]);
692 \& exit(1);
693 \& }
694 \&
695 \& mdctx = EVP_MD_CTX_new();
696 \& if (mdctx == NULL) {
697 \& printf("Message digest create failed.\en");
698 \& exit(1);
699 \& }
700 \& if (!EVP_DigestInit_ex2(mdctx, md, NULL)) {
701 \& printf("Message digest initialization failed.\en");
702 \& EVP_MD_CTX_free(mdctx);
703 \& exit(1);
704 \& }
705 \& if (!EVP_DigestUpdate(mdctx, mess1, strlen(mess1))) {
706 \& printf("Message digest update failed.\en");
707 \& EVP_MD_CTX_free(mdctx);
708 \& exit(1);
709 \& }
710 \& if (!EVP_DigestUpdate(mdctx, mess2, strlen(mess2))) {
711 \& printf("Message digest update failed.\en");
712 \& EVP_MD_CTX_free(mdctx);
713 \& exit(1);
714 \& }
715 \& if (!EVP_DigestFinal_ex(mdctx, md_value, &md_len)) {
716 \& printf("Message digest finalization failed.\en");
717 \& EVP_MD_CTX_free(mdctx);
718 \& exit(1);
719 \& }
720 \& EVP_MD_CTX_free(mdctx);
721 \&
722 \& printf("Digest is: ");
723 \& for (i = 0; i < md_len; i++)
724 \& printf("%02x", md_value[i]);
725 \& printf("\en");
726 \&
727 \& exit(0);
728 \& }
729 .Ve
730 .SH "SEE ALSO"
731 .IX Header "SEE ALSO"
732 \&\fBEVP_MD_meth_new\fR\|(3),
733 \&\fBopenssl\-dgst\fR\|(1),
734 \&\fBevp\fR\|(7),
735 \&\fBOSSL_PROVIDER\fR\|(3),
736 \&\fBOSSL_PARAM\fR\|(3),
737 \&\fBproperty\fR\|(7),
738 "ALGORITHM FETCHING" in \fBcrypto\fR\|(7),
739 \&\fBprovider\-digest\fR\|(7),
740 \&\fBlife_cycle\-digest\fR\|(7)
741 .PP
742 The full list of digest algorithms are provided below.
743 .PP
744 \&\fBEVP_blake2b512\fR\|(3),
745 \&\fBEVP_md2\fR\|(3),
746 \&\fBEVP_md4\fR\|(3),
747 \&\fBEVP_md5\fR\|(3),
748 \&\fBEVP_mdc2\fR\|(3),
749 \&\fBEVP_ripemd160\fR\|(3),
750 \&\fBEVP_sha1\fR\|(3),
751 \&\fBEVP_sha224\fR\|(3),
752 \&\fBEVP_sha3_224\fR\|(3),
753 \&\fBEVP_sm3\fR\|(3),
754 \&\fBEVP_whirlpool\fR\|(3)
755 .SH HISTORY
756 .IX Header "HISTORY"
757 The \fBEVP_MD_CTX_create()\fR and \fBEVP_MD_CTX_destroy()\fR functions were renamed to
758 \&\fBEVP_MD_CTX_new()\fR and \fBEVP_MD_CTX_free()\fR in OpenSSL 1.1.0, respectively.
759 .PP
760 The link between digests and signing algorithms was fixed in OpenSSL 1.0 and
761 later, so now \fBEVP_sha1()\fR can be used with RSA and DSA.
762 .PP
763 The \fBEVP_dss1()\fR function was removed in OpenSSL 1.1.0.
764 .PP
765 The \fBEVP_MD_CTX_set_pkey_ctx()\fR function was added in OpenSSL 1.1.1.
766 .PP
767 The \fBEVP_Q_digest()\fR, \fBEVP_DigestInit_ex2()\fR,
768 \&\fBEVP_MD_fetch()\fR, \fBEVP_MD_free()\fR, \fBEVP_MD_up_ref()\fR,
769 \&\fBEVP_MD_get_params()\fR, \fBEVP_MD_CTX_set_params()\fR, \fBEVP_MD_CTX_get_params()\fR,
770 \&\fBEVP_MD_gettable_params()\fR, \fBEVP_MD_gettable_ctx_params()\fR,
771 \&\fBEVP_MD_settable_ctx_params()\fR, \fBEVP_MD_CTX_settable_params()\fR and
772 \&\fBEVP_MD_CTX_gettable_params()\fR functions were added in OpenSSL 3.0.
773 .PP
774 The \fBEVP_MD_type()\fR, \fBEVP_MD_nid()\fR, \fBEVP_MD_name()\fR, \fBEVP_MD_pkey_type()\fR,
775 \&\fBEVP_MD_size()\fR, \fBEVP_MD_block_size()\fR, \fBEVP_MD_flags()\fR, \fBEVP_MD_CTX_size()\fR,
776 \&\fBEVP_MD_CTX_block_size()\fR, \fBEVP_MD_CTX_type()\fR, and \fBEVP_MD_CTX_md_data()\fR
777 functions were renamed to include \f(CW\*(C`get\*(C'\fR or \f(CW\*(C`get0\*(C'\fR in their names in
778 OpenSSL 3.0, respectively. The old names are kept as non-deprecated
779 alias macros.
780 .PP
781 The \fBEVP_MD_CTX_md()\fR function was deprecated in OpenSSL 3.0; use
782 \&\fBEVP_MD_CTX_get0_md()\fR instead.
783 \&\fBEVP_MD_CTX_update_fn()\fR and \fBEVP_MD_CTX_set_update_fn()\fR were deprecated
784 in OpenSSL 3.0.
785 .PP
786 The \fBEVP_MD_CTX_dup()\fR function was added in OpenSSL 3.1.
787 .PP
788 The \fBEVP_DigestSqueeze()\fR function was added in OpenSSL 3.3.
789 .PP
790 The \fBEVP_MD_CTX_get_size_ex()\fR and \fBEVP_xof()\fR functions were added in OpenSSL 3.4.
791 The macros \fBEVP_MD_CTX_get_size()\fR and EVP_MD_CTX_size were changed in OpenSSL 3.4
792 to be aliases for \fBEVP_MD_CTX_get_size_ex()\fR, previously they were aliases for
793 EVP_MD_get_size which returned a constant value. This is required for XOF
794 digests since they do not have a fixed size.
795 .SH COPYRIGHT
796 .IX Header "COPYRIGHT"
797 Copyright 2000\-2024 The OpenSSL Project Authors. All Rights Reserved.
798 .PP
799 Licensed under the Apache License 2.0 (the "License"). You may not use
800 this file except in compliance with the License. You can obtain a copy
801 in the file LICENSE in the source distribution or at
802 <https://www.openssl.org/source/license.html>.