1.\" $OpenBSD: EVP_DigestInit.3,v 1.25 2023/04/23 18:24:01 job 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: April 23 2023 $ 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_sha512_224 , 109.Nm EVP_sha512_256 , 110.Nm EVP_ripemd160 , 111.Nm EVP_get_digestbyname , 112.Nm EVP_get_digestbynid , 113.Nm EVP_get_digestbyobj 114.Nd EVP digest routines 115.Sh SYNOPSIS 116.In openssl/evp.h 117.Ft EVP_MD_CTX * 118.Fn EVP_MD_CTX_new void 119.Ft int 120.Fo EVP_MD_CTX_reset 121.Fa "EVP_MD_CTX *ctx" 122.Fc 123.Ft void 124.Fo EVP_MD_CTX_free 125.Fa "EVP_MD_CTX *ctx" 126.Fc 127.Ft void 128.Fo EVP_MD_CTX_init 129.Fa "EVP_MD_CTX *ctx" 130.Fc 131.Ft EVP_MD_CTX * 132.Fn EVP_MD_CTX_create void 133.Ft int 134.Fo EVP_MD_CTX_cleanup 135.Fa "EVP_MD_CTX *ctx" 136.Fc 137.Ft void 138.Fo EVP_MD_CTX_destroy 139.Fa "EVP_MD_CTX *ctx" 140.Fc 141.Ft int 142.Fo EVP_MD_CTX_ctrl 143.Fa "EVP_MD_CTX *ctx" 144.Fa "int cmd" 145.Fa "int p1" 146.Fa "void* p2" 147.Fc 148.Ft int 149.Fo EVP_DigestInit_ex 150.Fa "EVP_MD_CTX *ctx" 151.Fa "const EVP_MD *type" 152.Fa "ENGINE *impl" 153.Fc 154.Ft int 155.Fo EVP_DigestUpdate 156.Fa "EVP_MD_CTX *ctx" 157.Fa "const void *d" 158.Fa "size_t cnt" 159.Fc 160.Ft int 161.Fo EVP_DigestFinal_ex 162.Fa "EVP_MD_CTX *ctx" 163.Fa "unsigned char *md" 164.Fa "unsigned int *s" 165.Fc 166.Ft int 167.Fo EVP_Digest 168.Fa "const void *d" 169.Fa "size_t cnt" 170.Fa "unsigned char *md" 171.Fa "unsigned int *s" 172.Fa "const EVP_MD *type" 173.Fa "ENGINE *impl" 174.Fc 175.Ft int 176.Fo EVP_MD_CTX_copy_ex 177.Fa "EVP_MD_CTX *out" 178.Fa "const EVP_MD_CTX *in" 179.Fc 180.Ft int 181.Fo EVP_DigestInit 182.Fa "EVP_MD_CTX *ctx" 183.Fa "const EVP_MD *type" 184.Fc 185.Ft int 186.Fo EVP_DigestFinal 187.Fa "EVP_MD_CTX *ctx" 188.Fa "unsigned char *md" 189.Fa "unsigned int *s" 190.Fc 191.Ft int 192.Fo EVP_MD_CTX_copy 193.Fa "EVP_MD_CTX *out" 194.Fa "EVP_MD_CTX *in" 195.Fc 196.Fd #define EVP_MAX_MD_SIZE 64 /* SHA512 */ 197.Ft int 198.Fo EVP_MD_type 199.Fa "const EVP_MD *md" 200.Fc 201.Ft int 202.Fo EVP_MD_pkey_type 203.Fa "const EVP_MD *md" 204.Fc 205.Ft int 206.Fo EVP_MD_size 207.Fa "const EVP_MD *md" 208.Fc 209.Ft int 210.Fo EVP_MD_block_size 211.Fa "const EVP_MD *md" 212.Fc 213.Ft const EVP_MD * 214.Fo EVP_MD_CTX_md 215.Fa "const EVP_MD_CTX *ctx" 216.Fc 217.Ft int 218.Fo EVP_MD_CTX_size 219.Fa "const EVP_MD *ctx" 220.Fc 221.Ft int 222.Fo EVP_MD_CTX_block_size 223.Fa "const EVP_MD *ctx" 224.Fc 225.Ft int 226.Fo EVP_MD_CTX_type 227.Fa "const EVP_MD *ctx" 228.Fc 229.Ft const EVP_MD * 230.Fn EVP_md_null void 231.Ft const EVP_MD * 232.Fn EVP_md5 void 233.Ft const EVP_MD * 234.Fn EVP_md5_sha1 void 235.Ft const EVP_MD * 236.Fn EVP_sha1 void 237.Ft const EVP_MD * 238.Fn EVP_sha224 void 239.Ft const EVP_MD * 240.Fn EVP_sha256 void 241.Ft const EVP_MD * 242.Fn EVP_sha384 void 243.Ft const EVP_MD * 244.Fn EVP_sha512 void 245.Ft const EVP_MD * 246.Fn EVP_sha512_224 void 247.Ft const EVP_MD * 248.Fn EVP_sha512_256 void 249.Ft const EVP_MD * 250.Fn EVP_ripemd160 void 251.Ft const EVP_MD * 252.Fo EVP_get_digestbyname 253.Fa "const char *name" 254.Fc 255.Ft const EVP_MD * 256.Fo EVP_get_digestbynid 257.Fa "int type" 258.Fc 259.Ft const EVP_MD * 260.Fo EVP_get_digestbyobj 261.Fa "const ASN1_OBJECT *o" 262.Fc 263.Sh DESCRIPTION 264The EVP digest routines are a high level interface to message digests 265and should be used instead of the cipher-specific functions. 266.Pp 267.Fn EVP_MD_CTX_new 268allocates a new, empty digest context. 269.Pp 270.Fn EVP_MD_CTX_reset 271cleans up 272.Fa ctx 273and resets it to the state it had after 274.Fn EVP_MD_CTX_new , 275such that it can be reused. 276.Pp 277.Fn EVP_MD_CTX_free 278cleans up 279.Fa ctx 280and frees the space allocated to it. 281.Pp 282.Fn EVP_MD_CTX_init 283is a deprecated function to clear a digest context on the stack 284before use. 285Do not use it on a digest context returned from 286.Fn EVP_MD_CTX_new 287or one that was already used. 288.Pp 289.Fn EVP_MD_CTX_create , 290.Fn EVP_MD_CTX_cleanup , 291and 292.Fn EVP_MD_CTX_destroy 293are deprecated aliases for 294.Fn EVP_MD_CTX_new , 295.Fn EVP_MD_CTX_reset , 296and 297.Fn EVP_MD_CTX_free , 298respectively. 299.Pp 300.Fn EVP_MD_CTX_ctrl 301performs digest-specific control actions on the context 302.Fa ctx . 303.Pp 304.Fn EVP_DigestInit_ex 305sets up the digest context 306.Fa ctx 307to use a digest 308.Fa type 309from 310.Vt ENGINE 311.Fa impl . 312The 313.Fa type 314will typically be supplied by a function such as 315.Fn EVP_sha1 . 316If 317.Fa impl 318is 319.Dv NULL , 320then the default implementation of digest 321.Fa type 322is used. 323.Pp 324.Fn EVP_DigestUpdate 325hashes 326.Fa cnt 327bytes of data at 328.Fa d 329into the digest context 330.Fa ctx . 331This function can be called several times on the same 332.Fa ctx 333to hash additional data. 334.Pp 335.Fn EVP_DigestFinal_ex 336retrieves the digest value from 337.Fa ctx 338and places it in 339.Fa md . 340If the 341.Fa s 342parameter is not 343.Dv NULL , 344then the number of bytes of data written (i.e. the length of the 345digest) will be written to the integer at 346.Fa s ; 347at most 348.Dv EVP_MAX_MD_SIZE 349bytes will be written. 350After calling 351.Fn EVP_DigestFinal_ex , 352no additional calls to 353.Fn EVP_DigestUpdate 354can be made, but 355.Fn EVP_DigestInit_ex 356can be called to initialize a new digest operation. 357.Pp 358.Fn EVP_Digest 359is a simple wrapper function to hash 360.Fa cnt 361bytes of data at 362.Fa d 363using the digest 364.Fa type 365from 366.Vt ENGINE 367.Fa impl 368in a one-shot operation and place the digest value into 369.Fa md , 370and, unless 371.Fa s 372is 373.Dv NULL , 374the length of the digest in bytes into 375.Pf * Fa s . 376This wrapper uses a temporary digest context and passes its arguments to 377.Fn EVP_DigestInit_ex , 378.Fn EVP_DigestUpdate , 379and 380.Fn EVP_DigestFinal_ex 381internally. 382.Pp 383.Fn EVP_MD_CTX_copy_ex 384can be used to copy the message digest state from 385.Fa in 386to 387.Fa out . 388This is useful if large amounts of data are to be hashed which only 389differ in the last few bytes. 390.Pp 391.Fn EVP_DigestInit 392is a deprecated function behaving like 393.Fn EVP_DigestInit_ex 394except that it always uses the default digest implementation 395and that it requires 396.Fn EVP_MD_CTX_reset 397before it can be used on a context that was already used. 398.Pp 399.Fn EVP_DigestFinal 400is a deprecated function behaving like 401.Fn EVP_DigestFinal_ex 402except that the digest context 403.Fa ctx 404is automatically cleaned up after use by calling 405.Fn EVP_MD_CTX_reset 406internally. 407.Pp 408.Fn EVP_MD_CTX_copy 409is a deprecated function behaving like 410.Fn EVP_MD_CTX_copy_ex 411except that it requires 412.Fn EVP_MD_CTX_reset 413before a context that was already used can be passed as 414.Fa out . 415.Pp 416.Fn EVP_MD_size 417and 418.Fn EVP_MD_CTX_size 419return the size of the message digest when passed an 420.Vt EVP_MD 421or an 422.Vt EVP_MD_CTX 423structure, i.e. the size of the hash. 424.Pp 425.Fn EVP_MD_block_size 426and 427.Fn EVP_MD_CTX_block_size 428return the block size of the message digest when passed an 429.Vt EVP_MD 430or an 431.Vt EVP_MD_CTX 432structure. 433.Pp 434.Fn EVP_MD_type 435and 436.Fn EVP_MD_CTX_type 437return the NID of the OBJECT IDENTIFIER representing the given message 438digest when passed an 439.Vt EVP_MD 440structure. 441For example 442.Fn EVP_MD_type EVP_sha1() 443returns 444.Dv NID_sha1 . 445This function is normally used when setting ASN.1 OIDs. 446.Pp 447.Fn EVP_MD_pkey_type 448returns the NID of the public key signing algorithm associated with this 449digest. 450For example 451.Fn EVP_sha1 452is associated with RSA so this will return 453.Dv NID_sha1WithRSAEncryption . 454Since digests and signature algorithms are no longer linked, this 455function is only retained for compatibility reasons. 456.Pp 457.Fn EVP_md5 , 458.Fn EVP_sha1 , 459.Fn EVP_sha224 , 460.Fn EVP_sha256 , 461.Fn EVP_sha384 , 462.Fn EVP_sha512 , 463and 464.Fn EVP_ripemd160 465return 466.Vt EVP_MD 467structures for the MD5, SHA1, SHA224, SHA256, SHA384, SHA512 and 468RIPEMD160 digest algorithms respectively. 469.Pp 470.Fn EVP_sha512_224 471and 472.Fn EVP_sha512_256 473return an 474.Vt EVP_MD 475structure that provides the truncated SHA512 variants SHA512/224 and SHA512/256, 476respectively. 477.Pp 478.Fn EVP_md5_sha1 479returns an 480.Vt EVP_MD 481structure that provides concatenated MD5 and SHA1 message digests. 482.Pp 483.Fn EVP_md_null 484is a "null" message digest that does nothing: 485i.e. the hash it returns is of zero length. 486.Pp 487.Fn EVP_get_digestbyname , 488.Fn EVP_get_digestbynid , 489and 490.Fn EVP_get_digestbyobj 491return an 492.Vt EVP_MD 493structure when passed a digest name, a digest NID, or an ASN1_OBJECT 494structure respectively. 495.Pp 496.Fn EVP_MD_CTX_size , 497.Fn EVP_MD_CTX_block_size , 498.Fn EVP_MD_CTX_type , 499.Fn EVP_get_digestbynid , 500and 501.Fn EVP_get_digestbyobj 502are implemented as macros. 503.Pp 504The EVP interface to message digests should almost always be used 505in preference to the low level interfaces. 506This is because the code then becomes transparent to the digest used and 507much more flexible. 508.Pp 509New applications should use the SHA2 digest algorithms such as SHA256. 510The other digest algorithms are still in common use. 511.Pp 512For most applications the 513.Fa impl 514parameter to 515.Fn EVP_DigestInit_ex 516will be set to NULL to use the default digest implementation. 517.Pp 518The functions 519.Fn EVP_DigestInit , 520.Fn EVP_DigestFinal , 521and 522.Fn EVP_MD_CTX_copy 523are obsolete but are retained to maintain compatibility with existing 524code. 525New applications should use 526.Fn EVP_DigestInit_ex , 527.Fn EVP_DigestFinal_ex , 528and 529.Fn EVP_MD_CTX_copy_ex 530because they can efficiently reuse a digest context instead of 531initializing and cleaning it up on each call and allow non-default 532implementations of digests to be specified. 533.Pp 534If digest contexts are not cleaned up after use, memory leaks will occur. 535.Sh RETURN VALUES 536.Fn EVP_MD_CTX_new 537and 538.Fn EVP_MD_CTX_create 539return the new 540.Vt EVP_MD_CTX 541object or 542.Dv NULL 543for failure. 544.Pp 545.Fn EVP_MD_CTX_reset 546and 547.Fn EVP_MD_CTX_cleanup 548always return 1. 549.Pp 550.Fn EVP_MD_CTX_ctrl , 551.Fn EVP_DigestInit_ex , 552.Fn EVP_DigestUpdate , 553.Fn EVP_DigestFinal_ex , 554.Fn EVP_Digest , 555.Fn EVP_MD_CTX_copy_ex , 556.Fn EVP_DigestInit , 557.Fn EVP_DigestFinal , 558and 559.Fn EVP_MD_CTX_copy 560return 1 for success or 0 for failure. 561.Pp 562.Fn EVP_MD_type , 563.Fn EVP_MD_pkey_type , 564and 565.Fn EVP_MD_CTX_type 566return the NID of the corresponding OBJECT IDENTIFIER or 567.Dv NID_undef 568if none exists. 569.Pp 570.Fn EVP_MD_size , 571.Fn EVP_MD_block_size , 572.Fn EVP_MD_CTX_size , 573and 574.Fn EVP_MD_CTX_block_size 575return the digest or block size in bytes. 576.Pp 577.Fn EVP_MD_CTX_md 578returns the 579.Vt EVP_MD 580object used by 581.Fa ctx , 582or 583.Dv NULL 584if 585.Fa ctx 586is 587.Dv NULL . 588.Pp 589.Fn EVP_md_null , 590.Fn EVP_md5 , 591.Fn EVP_md5_sha1 , 592.Fn EVP_sha1 , 593and 594.Fn EVP_ripemd160 595return pointers to the corresponding 596.Vt EVP_MD 597structures. 598.Pp 599.Fn EVP_get_digestbyname , 600.Fn EVP_get_digestbynid , 601and 602.Fn EVP_get_digestbyobj 603return either an 604.Vt EVP_MD 605structure or 606.Dv NULL 607if an error occurs. 608.Sh EXAMPLES 609This example digests the data "Test Message\en" and "Hello World\en", 610using the digest name passed on the command line. 611.Bd -literal -offset indent 612#include <stdio.h> 613#include <openssl/evp.h> 614 615int 616main(int argc, char *argv[]) 617{ 618 EVP_MD_CTX *mdctx; 619 const EVP_MD *md; 620 const char mess1[] = "Test Message\en"; 621 const char mess2[] = "Hello World\en"; 622 unsigned char md_value[EVP_MAX_MD_SIZE]; 623 int md_len, i; 624 625 if (argc <= 1) { 626 printf("Usage: mdtest digestname\en"); 627 exit(1); 628 } 629 630 md = EVP_get_digestbyname(argv[1]); 631 if (md == NULL) { 632 printf("Unknown message digest %s\en", argv[1]); 633 exit(1); 634 } 635 636 mdctx = EVP_MD_CTX_new(); 637 EVP_DigestInit_ex(mdctx, md, NULL); 638 EVP_DigestUpdate(mdctx, mess1, strlen(mess1)); 639 EVP_DigestUpdate(mdctx, mess2, strlen(mess2)); 640 EVP_DigestFinal_ex(mdctx, md_value, &md_len); 641 EVP_MD_CTX_free(mdctx); 642 643 printf("Digest is: "); 644 for(i = 0; i < md_len; i++) 645 printf("%02x", md_value[i]); 646 printf("\en"); 647 648 return 0; 649} 650.Ed 651.Sh SEE ALSO 652.Xr BIO_f_md 3 , 653.Xr CMAC_Init 3 , 654.Xr evp 3 , 655.Xr EVP_BytesToKey 3 , 656.Xr EVP_DigestSignInit 3 , 657.Xr EVP_DigestVerifyInit 3 , 658.Xr EVP_PKEY_CTX_set_signature_md 3 , 659.Xr EVP_PKEY_meth_set_signctx 3 , 660.Xr EVP_SignInit 3 , 661.Xr EVP_sm3 3 , 662.Xr EVP_VerifyInit 3 , 663.Xr EVP_whirlpool 3 , 664.Xr HMAC 3 , 665.Xr OCSP_basic_sign 3 , 666.Xr OCSP_request_sign 3 , 667.Xr PKCS5_PBKDF2_HMAC 3 , 668.Xr PKCS7_sign_add_signer 3 , 669.Xr X509_ALGOR_set_md 3 , 670.Xr X509_digest 3 , 671.Xr X509_sign 3 672.Sh HISTORY 673.Fn EVP_DigestInit , 674.Fn EVP_DigestUpdate , 675.Fn EVP_DigestFinal , 676.Dv EVP_MAX_MD_SIZE , 677.Fn EVP_md5 , 678and 679.Fn EVP_sha1 680first appeared in SSLeay 0.5.1. 681.Fn EVP_MD_size 682first appeared in SSLeay 0.6.6. 683.Fn EVP_MD_CTX_size , 684.Fn EVP_MD_CTX_type , 685.Fn EVP_md_null , 686and 687.Fn EVP_get_digestbyname 688first appeared in SSLeay 0.8.0. 689.Fn EVP_MD_type , 690.Fn EVP_MD_pkey_type , 691.Fn EVP_get_digestbynid , 692and 693.Fn EVP_get_digestbyobj 694first appeared in SSLeay 0.8.1. 695.Fn EVP_MD_block_size , 696.Fn EVP_MD_CTX_size , 697.Fn EVP_MD_CTX_block_size , 698.Fn EVP_rc4_40 , 699.Fn EVP_rc2_40_cbc , 700and 701.Fn EVP_ripemd160 702first appeared in SSLeay 0.9.0. 703All these functions have been available since 704.Ox 2.4 . 705.Pp 706.Fn EVP_MD_CTX_copy 707first appeared in OpenSSL 0.9.2b and has been available since 708.Ox 2.6 . 709.Pp 710.Fn EVP_MD_CTX_md 711first appeared in OpenSSL 0.9.5 and has been available since 712.Ox 2.7 . 713.Pp 714.Fn EVP_MD_CTX_init , 715.Fn EVP_MD_CTX_create , 716.Fn EVP_MD_CTX_cleanup , 717.Fn EVP_MD_CTX_destroy , 718.Fn EVP_DigestInit_ex , 719.Fn EVP_DigestFinal_ex , 720.Fn EVP_Digest , 721and 722.Fn EVP_MD_CTX_copy_ex 723first appeared in OpenSSL 0.9.7 and have been available since 724.Ox 3.2 . 725.Pp 726.Fn EVP_sha224 , 727.Fn EVP_sha256 , 728.Fn EVP_sha384 , 729and 730.Fn EVP_sha512 731first appeared in OpenSSL 0.9.7h and 0.9.8a 732and have been available since 733.Ox 4.0 . 734.Pp 735.Fn EVP_sha512_224 736and 737.Fn EVP_sha512_256 738first appeared in OpenSSL 1.1.1 and has been available since 739.Ox 7.4 . 740.Pp 741.Fn EVP_MD_CTX_ctrl 742first appeared in OpenSSL 1.1.0 and has been available since 743.Ox 5.7 . 744.Pp 745.Fn EVP_MD_CTX_new , 746.Fn EVP_MD_CTX_reset , 747.Fn EVP_MD_CTX_free , 748and 749.Fn EVP_md5_sha1 750first appeared in OpenSSL 1.1.0 and have been available since 751.Ox 6.3 . 752.Pp 753The link between digests and signing algorithms was fixed in OpenSSL 1.0 754and later, so now 755.Fn EVP_sha1 756can be used with RSA and DSA. 757