xref: /openbsd-src/lib/libcrypto/man/EVP_DigestInit.3 (revision c1a45aed656e7d5627c30c92421893a76f370ccb)
1.\" $OpenBSD: EVP_DigestInit.3,v 1.23 2022/03/31 17:27:16 naddy Exp $
2.\" full merge up to: OpenSSL 7f572e95 Dec 2 13:57:04 2015 +0000
3.\" selective merge up to: OpenSSL a95d7574 Jul 2 12:16:38 2017 -0400
4.\"
5.\" This file is a derived work.
6.\" The changes are covered by the following Copyright and license:
7.\"
8.\" Copyright (c) 2019 Ingo Schwarze <schwarze@openbsd.org>
9.\"
10.\" Permission to use, copy, modify, and distribute this software for any
11.\" purpose with or without fee is hereby granted, provided that the above
12.\" copyright notice and this permission notice appear in all copies.
13.\"
14.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
15.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
16.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
17.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
18.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
19.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
20.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
21.\"
22.\" The original file was written by Dr. Stephen Henson <steve@openssl.org>
23.\" and Richard Levitte <levitte@openssl.org>.
24.\" Copyright (c) 2000-2004, 2009, 2012-2016 The OpenSSL Project.
25.\" All rights reserved.
26.\"
27.\" Redistribution and use in source and binary forms, with or without
28.\" modification, are permitted provided that the following conditions
29.\" are met:
30.\"
31.\" 1. Redistributions of source code must retain the above copyright
32.\"    notice, this list of conditions and the following disclaimer.
33.\"
34.\" 2. Redistributions in binary form must reproduce the above copyright
35.\"    notice, this list of conditions and the following disclaimer in
36.\"    the documentation and/or other materials provided with the
37.\"    distribution.
38.\"
39.\" 3. All advertising materials mentioning features or use of this
40.\"    software must display the following acknowledgment:
41.\"    "This product includes software developed by the OpenSSL Project
42.\"    for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
43.\"
44.\" 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
45.\"    endorse or promote products derived from this software without
46.\"    prior written permission. For written permission, please contact
47.\"    openssl-core@openssl.org.
48.\"
49.\" 5. Products derived from this software may not be called "OpenSSL"
50.\"    nor may "OpenSSL" appear in their names without prior written
51.\"    permission of the OpenSSL Project.
52.\"
53.\" 6. Redistributions of any form whatsoever must retain the following
54.\"    acknowledgment:
55.\"    "This product includes software developed by the OpenSSL Project
56.\"    for use in the OpenSSL Toolkit (http://www.openssl.org/)"
57.\"
58.\" THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
59.\" EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
60.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
61.\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR
62.\" ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
63.\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
64.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
65.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
66.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
67.\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
68.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
69.\" OF THE POSSIBILITY OF SUCH DAMAGE.
70.\"
71.Dd $Mdocdate: March 31 2022 $
72.Dt EVP_DIGESTINIT 3
73.Os
74.Sh NAME
75.Nm EVP_MD_CTX_new ,
76.Nm EVP_MD_CTX_reset ,
77.Nm EVP_MD_CTX_free ,
78.Nm EVP_MD_CTX_init ,
79.Nm EVP_MD_CTX_create ,
80.Nm EVP_MD_CTX_cleanup ,
81.Nm EVP_MD_CTX_destroy ,
82.Nm EVP_MD_CTX_ctrl ,
83.Nm EVP_DigestInit_ex ,
84.Nm EVP_DigestUpdate ,
85.Nm EVP_DigestFinal_ex ,
86.Nm EVP_Digest ,
87.Nm EVP_MD_CTX_copy_ex ,
88.Nm EVP_DigestInit ,
89.Nm EVP_DigestFinal ,
90.Nm EVP_MD_CTX_copy ,
91.Nm EVP_MAX_MD_SIZE ,
92.Nm EVP_MD_type ,
93.Nm EVP_MD_pkey_type ,
94.Nm EVP_MD_size ,
95.Nm EVP_MD_block_size ,
96.Nm EVP_MD_CTX_md ,
97.Nm EVP_MD_CTX_size ,
98.Nm EVP_MD_CTX_block_size ,
99.Nm EVP_MD_CTX_type ,
100.Nm EVP_md_null ,
101.Nm EVP_md5 ,
102.Nm EVP_md5_sha1 ,
103.Nm EVP_sha1 ,
104.Nm EVP_sha224 ,
105.Nm EVP_sha256 ,
106.Nm EVP_sha384 ,
107.Nm EVP_sha512 ,
108.Nm EVP_ripemd160 ,
109.Nm EVP_get_digestbyname ,
110.Nm EVP_get_digestbynid ,
111.Nm EVP_get_digestbyobj
112.Nd EVP digest routines
113.Sh SYNOPSIS
114.In openssl/evp.h
115.Ft EVP_MD_CTX *
116.Fn EVP_MD_CTX_new void
117.Ft int
118.Fo EVP_MD_CTX_reset
119.Fa "EVP_MD_CTX *ctx"
120.Fc
121.Ft void
122.Fo EVP_MD_CTX_free
123.Fa "EVP_MD_CTX *ctx"
124.Fc
125.Ft void
126.Fo EVP_MD_CTX_init
127.Fa "EVP_MD_CTX *ctx"
128.Fc
129.Ft EVP_MD_CTX *
130.Fn EVP_MD_CTX_create void
131.Ft int
132.Fo EVP_MD_CTX_cleanup
133.Fa "EVP_MD_CTX *ctx"
134.Fc
135.Ft void
136.Fo EVP_MD_CTX_destroy
137.Fa "EVP_MD_CTX *ctx"
138.Fc
139.Ft int
140.Fo EVP_MD_CTX_ctrl
141.Fa "EVP_MD_CTX *ctx"
142.Fa "int cmd"
143.Fa "int p1"
144.Fa "void* p2"
145.Fc
146.Ft int
147.Fo EVP_DigestInit_ex
148.Fa "EVP_MD_CTX *ctx"
149.Fa "const EVP_MD *type"
150.Fa "ENGINE *impl"
151.Fc
152.Ft int
153.Fo EVP_DigestUpdate
154.Fa "EVP_MD_CTX *ctx"
155.Fa "const void *d"
156.Fa "size_t cnt"
157.Fc
158.Ft int
159.Fo EVP_DigestFinal_ex
160.Fa "EVP_MD_CTX *ctx"
161.Fa "unsigned char *md"
162.Fa "unsigned int *s"
163.Fc
164.Ft int
165.Fo EVP_Digest
166.Fa "const void *d"
167.Fa "size_t cnt"
168.Fa "unsigned char *md"
169.Fa "unsigned int *s"
170.Fa "const EVP_MD *type"
171.Fa "ENGINE *impl"
172.Fc
173.Ft int
174.Fo EVP_MD_CTX_copy_ex
175.Fa "EVP_MD_CTX *out"
176.Fa "const EVP_MD_CTX *in"
177.Fc
178.Ft int
179.Fo EVP_DigestInit
180.Fa "EVP_MD_CTX *ctx"
181.Fa "const EVP_MD *type"
182.Fc
183.Ft int
184.Fo EVP_DigestFinal
185.Fa "EVP_MD_CTX *ctx"
186.Fa "unsigned char *md"
187.Fa "unsigned int *s"
188.Fc
189.Ft int
190.Fo EVP_MD_CTX_copy
191.Fa "EVP_MD_CTX *out"
192.Fa "EVP_MD_CTX *in"
193.Fc
194.Fd #define EVP_MAX_MD_SIZE 64	/* SHA512 */
195.Ft int
196.Fo EVP_MD_type
197.Fa "const EVP_MD *md"
198.Fc
199.Ft int
200.Fo EVP_MD_pkey_type
201.Fa "const EVP_MD *md"
202.Fc
203.Ft int
204.Fo EVP_MD_size
205.Fa "const EVP_MD *md"
206.Fc
207.Ft int
208.Fo EVP_MD_block_size
209.Fa "const EVP_MD *md"
210.Fc
211.Ft const EVP_MD *
212.Fo EVP_MD_CTX_md
213.Fa "const EVP_MD_CTX *ctx"
214.Fc
215.Ft int
216.Fo EVP_MD_CTX_size
217.Fa "const EVP_MD *ctx"
218.Fc
219.Ft int
220.Fo EVP_MD_CTX_block_size
221.Fa "const EVP_MD *ctx"
222.Fc
223.Ft int
224.Fo EVP_MD_CTX_type
225.Fa "const EVP_MD *ctx"
226.Fc
227.Ft const EVP_MD *
228.Fn EVP_md_null void
229.Ft const EVP_MD *
230.Fn EVP_md5 void
231.Ft const EVP_MD *
232.Fn EVP_md5_sha1 void
233.Ft const EVP_MD *
234.Fn EVP_sha1 void
235.Ft const EVP_MD *
236.Fn EVP_sha224 void
237.Ft const EVP_MD *
238.Fn EVP_sha256 void
239.Ft const EVP_MD *
240.Fn EVP_sha384 void
241.Ft const EVP_MD *
242.Fn EVP_sha512 void
243.Ft const EVP_MD *
244.Fn EVP_ripemd160 void
245.Ft const EVP_MD *
246.Fo EVP_get_digestbyname
247.Fa "const char *name"
248.Fc
249.Ft const EVP_MD *
250.Fo EVP_get_digestbynid
251.Fa "int type"
252.Fc
253.Ft const EVP_MD *
254.Fo EVP_get_digestbyobj
255.Fa "const ASN1_OBJECT *o"
256.Fc
257.Sh DESCRIPTION
258The EVP digest routines are a high level interface to message digests
259and should be used instead of the cipher-specific functions.
260.Pp
261.Fn EVP_MD_CTX_new
262allocates a new, empty digest context.
263.Pp
264.Fn EVP_MD_CTX_reset
265cleans up
266.Fa ctx
267and resets it to the state it had after
268.Fn EVP_MD_CTX_new ,
269such that it can be reused.
270It is also suitable for digest contexts on the stack that were
271used and are no longer needed.
272.Pp
273.Fn EVP_MD_CTX_free
274cleans up
275.Fa ctx
276and frees the space allocated to it.
277.Pp
278.Fn EVP_MD_CTX_init
279is a deprecated function to clear a digest context on the stack
280before use.
281Do not use it on a digest context returned from
282.Fn EVP_MD_CTX_new
283or one that was already used.
284.Pp
285.Fn EVP_MD_CTX_create ,
286.Fn EVP_MD_CTX_cleanup ,
287and
288.Fn EVP_MD_CTX_destroy
289are deprecated aliases for
290.Fn EVP_MD_CTX_new ,
291.Fn EVP_MD_CTX_reset ,
292and
293.Fn EVP_MD_CTX_free ,
294respectively.
295.Pp
296.Fn EVP_MD_CTX_ctrl
297performs digest-specific control actions on the context
298.Fa ctx .
299.Pp
300.Fn EVP_DigestInit_ex
301sets up the digest context
302.Fa ctx
303to use a digest
304.Fa type
305from
306.Vt ENGINE
307.Fa impl .
308The
309.Fa type
310will typically be supplied by a function such as
311.Fn EVP_sha1 .
312If
313.Fa impl
314is
315.Dv NULL ,
316then the default implementation of digest
317.Fa type
318is used.
319If
320.Fa ctx
321points to an unused object on the stack, it must be initialized with
322.Fn EVP_MD_CTX_init
323before calling this function.
324.Pp
325.Fn EVP_DigestUpdate
326hashes
327.Fa cnt
328bytes of data at
329.Fa d
330into the digest context
331.Fa ctx .
332This function can be called several times on the same
333.Fa ctx
334to hash additional data.
335.Pp
336.Fn EVP_DigestFinal_ex
337retrieves the digest value from
338.Fa ctx
339and places it in
340.Fa md .
341If the
342.Fa s
343parameter is not
344.Dv NULL ,
345then the number of bytes of data written (i.e. the length of the
346digest) will be written to the integer at
347.Fa s ;
348at most
349.Dv EVP_MAX_MD_SIZE
350bytes will be written.
351After calling
352.Fn EVP_DigestFinal_ex ,
353no additional calls to
354.Fn EVP_DigestUpdate
355can be made, but
356.Fn EVP_DigestInit_ex
357can be called to initialize a new digest operation.
358.Pp
359.Fn EVP_Digest
360is a simple wrapper function to hash
361.Fa cnt
362bytes of data at
363.Fa d
364using the digest
365.Fa type
366from
367.Vt ENGINE
368.Fa impl
369in a one-shot operation and place the digest value into
370.Fa md ,
371and, unless
372.Fa s
373is
374.Dv NULL ,
375the length of the digest in bytes into
376.Pf * Fa s .
377This wrapper uses a temporary digest context and passes its arguments to
378.Fn EVP_DigestInit_ex ,
379.Fn EVP_DigestUpdate ,
380and
381.Fn EVP_DigestFinal_ex
382internally.
383.Pp
384.Fn EVP_MD_CTX_copy_ex
385can be used to copy the message digest state from
386.Fa in
387to
388.Fa out .
389This is useful if large amounts of data are to be hashed which only
390differ in the last few bytes.
391If
392.Fa out
393points to an unused object on the stack, it must be initialized with
394.Fn EVP_MD_CTX_init
395before calling this function.
396.Pp
397.Fn EVP_DigestInit
398is a deprecated function behaving like
399.Fn EVP_DigestInit_ex
400except that it always uses the default digest implementation
401and that it requires
402.Fn EVP_MD_CTX_reset
403before it can be used on a context that was already used.
404.Pp
405.Fn EVP_DigestFinal
406is a deprecated function behaving like
407.Fn EVP_DigestFinal_ex
408except that the digest context
409.Fa ctx
410is automatically cleaned up after use by calling
411.Fn EVP_MD_CTX_reset
412internally.
413.Pp
414.Fn EVP_MD_CTX_copy
415is a deprecated function behaving like
416.Fn EVP_MD_CTX_copy_ex
417except that it requires
418.Fn EVP_MD_CTX_reset
419before a context that was already used can be passed as
420.Fa out .
421.Pp
422.Fn EVP_MD_size
423and
424.Fn EVP_MD_CTX_size
425return the size of the message digest when passed an
426.Vt EVP_MD
427or an
428.Vt EVP_MD_CTX
429structure, i.e. the size of the hash.
430.Pp
431.Fn EVP_MD_block_size
432and
433.Fn EVP_MD_CTX_block_size
434return the block size of the message digest when passed an
435.Vt EVP_MD
436or an
437.Vt EVP_MD_CTX
438structure.
439.Pp
440.Fn EVP_MD_type
441and
442.Fn EVP_MD_CTX_type
443return the NID of the OBJECT IDENTIFIER representing the given message
444digest when passed an
445.Vt EVP_MD
446structure.
447For example
448.Fn EVP_MD_type EVP_sha1()
449returns
450.Dv NID_sha1 .
451This function is normally used when setting ASN.1 OIDs.
452.Pp
453.Fn EVP_MD_pkey_type
454returns the NID of the public key signing algorithm associated with this
455digest.
456For example
457.Fn EVP_sha1
458is associated with RSA so this will return
459.Dv NID_sha1WithRSAEncryption .
460Since digests and signature algorithms are no longer linked, this
461function is only retained for compatibility reasons.
462.Pp
463.Fn EVP_md5 ,
464.Fn EVP_sha1 ,
465.Fn EVP_sha224 ,
466.Fn EVP_sha256 ,
467.Fn EVP_sha384 ,
468.Fn EVP_sha512 ,
469and
470.Fn EVP_ripemd160
471return
472.Vt EVP_MD
473structures for the MD5, SHA1, SHA224, SHA256, SHA384, SHA512 and
474RIPEMD160 digest algorithms respectively.
475.Pp
476.Fn EVP_md5_sha1
477returns an
478.Vt EVP_MD
479structure that provides concatenated MD5 and SHA1 message digests.
480.Pp
481.Fn EVP_md_null
482is a "null" message digest that does nothing:
483i.e. the hash it returns is of zero length.
484.Pp
485.Fn EVP_get_digestbyname ,
486.Fn EVP_get_digestbynid ,
487and
488.Fn EVP_get_digestbyobj
489return an
490.Vt EVP_MD
491structure when passed a digest name, a digest NID, or an ASN1_OBJECT
492structure respectively.
493.Pp
494.Fn EVP_MD_CTX_size ,
495.Fn EVP_MD_CTX_block_size ,
496.Fn EVP_MD_CTX_type ,
497.Fn EVP_get_digestbynid ,
498and
499.Fn EVP_get_digestbyobj
500are implemented as macros.
501.Pp
502The EVP interface to message digests should almost always be used
503in preference to the low level interfaces.
504This is because the code then becomes transparent to the digest used and
505much more flexible.
506.Pp
507New applications should use the SHA2 digest algorithms such as SHA256.
508The other digest algorithms are still in common use.
509.Pp
510For most applications the
511.Fa impl
512parameter to
513.Fn EVP_DigestInit_ex
514will be set to NULL to use the default digest implementation.
515.Pp
516The functions
517.Fn EVP_DigestInit ,
518.Fn EVP_DigestFinal ,
519and
520.Fn EVP_MD_CTX_copy
521are obsolete but are retained to maintain compatibility with existing
522code.
523New applications should use
524.Fn EVP_DigestInit_ex ,
525.Fn EVP_DigestFinal_ex ,
526and
527.Fn EVP_MD_CTX_copy_ex
528because they can efficiently reuse a digest context instead of
529initializing and cleaning it up on each call and allow non-default
530implementations of digests to be specified.
531.Pp
532If digest contexts are not cleaned up after use, memory leaks will occur.
533.Sh RETURN VALUES
534.Fn EVP_MD_CTX_new
535and
536.Fn EVP_MD_CTX_create
537return the new
538.Vt EVP_MD_CTX
539object or
540.Dv NULL
541for failure.
542.Pp
543.Fn EVP_MD_CTX_reset
544and
545.Fn EVP_MD_CTX_cleanup
546always return 1.
547.Pp
548.Fn EVP_MD_CTX_ctrl ,
549.Fn EVP_DigestInit_ex ,
550.Fn EVP_DigestUpdate ,
551.Fn EVP_DigestFinal_ex ,
552.Fn EVP_Digest ,
553.Fn EVP_MD_CTX_copy_ex ,
554.Fn EVP_DigestInit ,
555.Fn EVP_DigestFinal ,
556and
557.Fn EVP_MD_CTX_copy
558return 1 for success or 0 for failure.
559.Pp
560.Fn EVP_MD_type ,
561.Fn EVP_MD_pkey_type ,
562and
563.Fn EVP_MD_CTX_type
564return the NID of the corresponding OBJECT IDENTIFIER or
565.Dv NID_undef
566if none exists.
567.Pp
568.Fn EVP_MD_size ,
569.Fn EVP_MD_block_size ,
570.Fn EVP_MD_CTX_size ,
571and
572.Fn EVP_MD_CTX_block_size
573return the digest or block size in bytes.
574.Pp
575.Fn EVP_MD_CTX_md
576returns the
577.Vt EVP_MD
578object used by
579.Fa ctx ,
580or
581.Dv NULL
582if
583.Fa ctx
584is
585.Dv NULL .
586.Pp
587.Fn EVP_md_null ,
588.Fn EVP_md5 ,
589.Fn EVP_md5_sha1 ,
590.Fn EVP_sha1 ,
591and
592.Fn EVP_ripemd160
593return pointers to the corresponding
594.Vt EVP_MD
595structures.
596.Pp
597.Fn EVP_get_digestbyname ,
598.Fn EVP_get_digestbynid ,
599and
600.Fn EVP_get_digestbyobj
601return either an
602.Vt EVP_MD
603structure or
604.Dv NULL
605if an error occurs.
606.Sh EXAMPLES
607This example digests the data "Test Message\en" and "Hello World\en",
608using the digest name passed on the command line.
609.Bd -literal -offset indent
610#include <stdio.h>
611#include <openssl/evp.h>
612
613int
614main(int argc, char *argv[])
615{
616	EVP_MD_CTX *mdctx;
617	const EVP_MD *md;
618	const char mess1[] = "Test Message\en";
619	const char mess2[] = "Hello World\en";
620	unsigned char md_value[EVP_MAX_MD_SIZE];
621	int md_len, i;
622
623	if (argc <= 1) {
624		printf("Usage: mdtest digestname\en");
625		exit(1);
626	}
627
628	md = EVP_get_digestbyname(argv[1]);
629	if (md == NULL) {
630		printf("Unknown message digest %s\en", argv[1]);
631		exit(1);
632	}
633
634	mdctx = EVP_MD_CTX_new();
635	EVP_DigestInit_ex(mdctx, md, NULL);
636	EVP_DigestUpdate(mdctx, mess1, strlen(mess1));
637	EVP_DigestUpdate(mdctx, mess2, strlen(mess2));
638	EVP_DigestFinal_ex(mdctx, md_value, &md_len);
639	EVP_MD_CTX_free(mdctx);
640
641	printf("Digest is: ");
642	for(i = 0; i < md_len; i++)
643		printf("%02x", md_value[i]);
644	printf("\en");
645
646	return 0;
647}
648.Ed
649.Sh SEE ALSO
650.Xr BIO_f_md 3 ,
651.Xr CMAC_Init 3 ,
652.Xr evp 3 ,
653.Xr EVP_BytesToKey 3 ,
654.Xr EVP_DigestSignInit 3 ,
655.Xr EVP_DigestVerifyInit 3 ,
656.Xr EVP_PKEY_CTX_set_signature_md 3 ,
657.Xr EVP_PKEY_meth_set_signctx 3 ,
658.Xr EVP_SignInit 3 ,
659.Xr EVP_sm3 3 ,
660.Xr EVP_VerifyInit 3 ,
661.Xr EVP_whirlpool 3 ,
662.Xr HMAC 3 ,
663.Xr OCSP_basic_sign 3 ,
664.Xr OCSP_request_sign 3 ,
665.Xr PKCS5_PBKDF2_HMAC 3 ,
666.Xr PKCS7_sign_add_signer 3 ,
667.Xr X509_ALGOR_set_md 3 ,
668.Xr X509_digest 3 ,
669.Xr X509_sign 3
670.Sh HISTORY
671.Fn EVP_DigestInit ,
672.Fn EVP_DigestUpdate ,
673.Fn EVP_DigestFinal ,
674.Dv EVP_MAX_MD_SIZE ,
675.Fn EVP_md5 ,
676and
677.Fn EVP_sha1
678first appeared in SSLeay 0.5.1.
679.Fn EVP_MD_size
680first appeared in SSLeay 0.6.6.
681.Fn EVP_MD_CTX_size ,
682.Fn EVP_MD_CTX_type ,
683.Fn EVP_md_null ,
684and
685.Fn EVP_get_digestbyname
686first appeared in SSLeay 0.8.0.
687.Fn EVP_MD_type ,
688.Fn EVP_MD_pkey_type ,
689.Fn EVP_get_digestbynid ,
690and
691.Fn EVP_get_digestbyobj
692first appeared in SSLeay 0.8.1.
693.Fn EVP_MD_block_size ,
694.Fn EVP_MD_CTX_size ,
695.Fn EVP_MD_CTX_block_size ,
696.Fn EVP_rc4_40 ,
697.Fn EVP_rc2_40_cbc ,
698and
699.Fn EVP_ripemd160
700first appeared in SSLeay 0.9.0.
701All these functions have been available since
702.Ox 2.4 .
703.Pp
704.Fn EVP_MD_CTX_copy
705first appeared in OpenSSL 0.9.2b and has been available since
706.Ox 2.6 .
707.Pp
708.Fn EVP_MD_CTX_md
709first appeared in OpenSSL 0.9.5 and has been available since
710.Ox 2.7 .
711.Pp
712.Fn EVP_MD_CTX_init ,
713.Fn EVP_MD_CTX_create ,
714.Fn EVP_MD_CTX_cleanup ,
715.Fn EVP_MD_CTX_destroy ,
716.Fn EVP_DigestInit_ex ,
717.Fn EVP_DigestFinal_ex ,
718.Fn EVP_Digest ,
719and
720.Fn EVP_MD_CTX_copy_ex
721first appeared in OpenSSL 0.9.7 and have been available since
722.Ox 3.2 .
723.Pp
724.Fn EVP_sha224 ,
725.Fn EVP_sha256 ,
726.Fn EVP_sha384 ,
727and
728.Fn EVP_sha512
729first appeared in OpenSSL 0.9.7h and 0.9.8a
730and have been available since
731.Ox 4.0 .
732.Pp
733.Fn EVP_MD_CTX_ctrl
734first appeared in OpenSSL 1.1.0 and has been available since
735.Ox 5.7 .
736.Pp
737.Fn EVP_MD_CTX_new ,
738.Fn EVP_MD_CTX_reset ,
739.Fn EVP_MD_CTX_free ,
740and
741.Fn EVP_md5_sha1
742first appeared in OpenSSL 1.1.0 and have been available since
743.Ox 6.3 .
744.Pp
745The link between digests and signing algorithms was fixed in OpenSSL 1.0
746and later, so now
747.Fn EVP_sha1
748can be used with RSA and DSA.
749