1.\" $OpenBSD: EVP_DigestInit.3,v 1.19 2020/06/24 16:06:27 schwarze 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: June 24 2020 $ 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_dss , 109.Nm EVP_dss1 , 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_dss void 247.Ft const EVP_MD * 248.Fn EVP_dss1 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. 276It is also suitable for digest contexts on the stack that were 277used and are no longer needed. 278.Pp 279.Fn EVP_MD_CTX_free 280cleans up 281.Fa ctx 282and frees the space allocated to it. 283.Pp 284.Fn EVP_MD_CTX_init 285is a deprecated function to clear a digest context on the stack 286before use. 287Do not use it on a digest context returned from 288.Fn EVP_MD_CTX_new 289or one one that was already used. 290.Pp 291.Fn EVP_MD_CTX_create , 292.Fn EVP_MD_CTX_cleanup , 293and 294.Fn EVP_MD_CTX_destroy 295are deprecated aliases for 296.Fn EVP_MD_CTX_new , 297.Fn EVP_MD_CTX_reset , 298and 299.Fn EVP_MD_CTX_free , 300respectively. 301.Pp 302.Fn EVP_MD_CTX_ctrl 303performs digest-specific control actions on the context 304.Fa ctx . 305.Pp 306.Fn EVP_DigestInit_ex 307sets up the digest context 308.Fa ctx 309to use a digest 310.Fa type 311from 312.Vt ENGINE 313.Fa impl . 314The 315.Fa type 316will typically be supplied by a function such as 317.Fn EVP_sha1 . 318If 319.Fa impl 320is 321.Dv NULL , 322then the default implementation of digest 323.Fa type 324is used. 325If 326.Fa ctx 327points to an unused object on the stack, it must be initialized with 328.Fn EVP_MD_CTX_init 329before calling this function. 330.Pp 331.Fn EVP_DigestUpdate 332hashes 333.Fa cnt 334bytes of data at 335.Fa d 336into the digest context 337.Fa ctx . 338This function can be called several times on the same 339.Fa ctx 340to hash additional data. 341.Pp 342.Fn EVP_DigestFinal_ex 343retrieves the digest value from 344.Fa ctx 345and places it in 346.Fa md . 347If the 348.Fa s 349parameter is not 350.Dv NULL , 351then the number of bytes of data written (i.e. the length of the 352digest) will be written to the integer at 353.Fa s ; 354at most 355.Dv EVP_MAX_MD_SIZE 356bytes will be written. 357After calling 358.Fn EVP_DigestFinal_ex , 359no additional calls to 360.Fn EVP_DigestUpdate 361can be made, but 362.Fn EVP_DigestInit_ex 363can be called to initialize a new digest operation. 364.Pp 365.Fn EVP_Digest 366is a simple wrapper function to hash 367.Fa cnt 368bytes of data at 369.Fa d 370using the digest 371.Fa type 372from 373.Vt ENGINE 374.Fa impl 375in a one-shot operation and place the digest value into 376.Fa md , 377and, unless 378.Fa s 379is 380.Dv NULL , 381the length of the digest in bytes into 382.Pf * Fa s . 383This wrapper uses a temporary digest context and passes its arguments to 384.Fn EVP_DigestInit_ex , 385.Fn EVP_DigestUpdate , 386and 387.Fn EVP_DigestFinal_ex 388internally. 389.Pp 390.Fn EVP_MD_CTX_copy_ex 391can be used to copy the message digest state from 392.Fa in 393to 394.Fa out . 395This is useful if large amounts of data are to be hashed which only 396differ in the last few bytes. 397If 398.Fa out 399points to an unused object on the stack, it must be initialized with 400.Fn EVP_MD_CTX_init 401before calling this function. 402.Pp 403.Fn EVP_DigestInit 404is a deprecated function behaving like 405.Fn EVP_DigestInit_ex 406except that it always uses the default digest implementation 407and that it requires 408.Fn EVP_MD_CTX_reset 409before it can be used on a context that was already used. 410.Pp 411.Fn EVP_DigestFinal 412is a deprecated function behaving like 413.Fn EVP_DigestFinal_ex 414except that the digest context 415.Fa ctx 416is automatically cleaned up after use by calling 417.Fn EVP_MD_CTX_reset 418internally. 419.Pp 420.Fn EVP_MD_CTX_copy 421is a deprecated function behaving like 422.Fn EVP_MD_CTX_copy_ex 423except that it requires 424.Fn EVP_MD_CTX_reset 425before a context that was already used can be passed as 426.Fa out . 427.Pp 428.Fn EVP_MD_size 429and 430.Fn EVP_MD_CTX_size 431return the size of the message digest when passed an 432.Vt EVP_MD 433or an 434.Vt EVP_MD_CTX 435structure, i.e. the size of the hash. 436.Pp 437.Fn EVP_MD_block_size 438and 439.Fn EVP_MD_CTX_block_size 440return the block size of the message digest when passed an 441.Vt EVP_MD 442or an 443.Vt EVP_MD_CTX 444structure. 445.Pp 446.Fn EVP_MD_type 447and 448.Fn EVP_MD_CTX_type 449return the NID of the OBJECT IDENTIFIER representing the given message 450digest when passed an 451.Vt EVP_MD 452structure. 453For example 454.Fn EVP_MD_type EVP_sha1() 455returns 456.Dv NID_sha1 . 457This function is normally used when setting ASN.1 OIDs. 458.Pp 459.Fn EVP_MD_pkey_type 460returns the NID of the public key signing algorithm associated with this 461digest. 462For example 463.Fn EVP_sha1 464is associated with RSA so this will return 465.Dv NID_sha1WithRSAEncryption . 466Since digests and signature algorithms are no longer linked this 467function is only retained for compatibility reasons. 468.Pp 469.Fn EVP_md5 , 470.Fn EVP_sha1 , 471.Fn EVP_sha224 , 472.Fn EVP_sha256 , 473.Fn EVP_sha384 , 474.Fn EVP_sha512 , 475and 476.Fn EVP_ripemd160 477return 478.Vt EVP_MD 479structures for the MD5, SHA1, SHA224, SHA256, SHA384, SHA512 and 480RIPEMD160 digest algorithms respectively. 481.Pp 482.Fn EVP_md5_sha1 483returns an 484.Vt EVP_MD 485structure that provides concatenated MD5 and SHA1 message digests. 486.Pp 487.Fn EVP_dss 488and 489.Fn EVP_dss1 490return 491.Vt EVP_MD 492structures for SHA1 digest algorithms but using DSS (DSA) for the 493signature algorithm. 494Note: there is no need to use these pseudo-digests in OpenSSL 1.0.0 and 495later; they are however retained for compatibility. 496.Pp 497.Fn EVP_md_null 498is a "null" message digest that does nothing: 499i.e. the hash it returns is of zero length. 500.Pp 501.Fn EVP_get_digestbyname , 502.Fn EVP_get_digestbynid , 503and 504.Fn EVP_get_digestbyobj 505return an 506.Vt EVP_MD 507structure when passed a digest name, a digest NID, or an ASN1_OBJECT 508structure respectively. 509The digest table must be initialized using, for example, 510.Xr OpenSSL_add_all_digests 3 511for these functions to work. 512.Pp 513.Fn EVP_MD_CTX_size , 514.Fn EVP_MD_CTX_block_size , 515.Fn EVP_MD_CTX_type , 516.Fn EVP_get_digestbynid , 517and 518.Fn EVP_get_digestbyobj 519are implemented as macros. 520.Pp 521The EVP interface to message digests should almost always be used 522in preference to the low level interfaces. 523This is because the code then becomes transparent to the digest used and 524much more flexible. 525.Pp 526New applications should use the SHA2 digest algorithms such as SHA256. 527The other digest algorithms are still in common use. 528.Pp 529For most applications the 530.Fa impl 531parameter to 532.Fn EVP_DigestInit_ex 533will be set to NULL to use the default digest implementation. 534.Pp 535The functions 536.Fn EVP_DigestInit , 537.Fn EVP_DigestFinal , 538and 539.Fn EVP_MD_CTX_copy 540are obsolete but are retained to maintain compatibility with existing 541code. 542New applications should use 543.Fn EVP_DigestInit_ex , 544.Fn EVP_DigestFinal_ex , 545and 546.Fn EVP_MD_CTX_copy_ex 547because they can efficiently reuse a digest context instead of 548initializing and cleaning it up on each call and allow non-default 549implementations of digests to be specified. 550.Pp 551If digest contexts are not cleaned up after use, memory leaks will occur. 552.Sh RETURN VALUES 553.Fn EVP_MD_CTX_new 554and 555.Fn EVP_MD_CTX_create 556return the new 557.Vt EVP_MD_CTX 558object or 559.Dv NULL 560for failure. 561.Pp 562.Fn EVP_MD_CTX_reset 563and 564.Fn EVP_MD_CTX_cleanup 565always return 1. 566.Pp 567.Fn EVP_MD_CTX_ctrl , 568.Fn EVP_DigestInit_ex , 569.Fn EVP_DigestUpdate , 570.Fn EVP_DigestFinal_ex , 571.Fn EVP_Digest , 572.Fn EVP_MD_CTX_copy_ex , 573.Fn EVP_DigestInit , 574.Fn EVP_DigestFinal , 575and 576.Fn EVP_MD_CTX_copy 577return 1 for success or 0 for failure. 578.Pp 579.Fn EVP_MD_type , 580.Fn EVP_MD_pkey_type , 581and 582.Fn EVP_MD_CTX_type 583return the NID of the corresponding OBJECT IDENTIFIER or 584.Dv NID_undef 585if none exists. 586.Pp 587.Fn EVP_MD_size , 588.Fn EVP_MD_block_size , 589.Fn EVP_MD_CTX_size , 590and 591.Fn EVP_MD_CTX_block_size 592return the digest or block size in bytes. 593.Pp 594.Fn EVP_MD_CTX_md 595returns the 596.Vt EVP_MD 597object used by 598.Fa ctx , 599or 600.Dv NULL 601if 602.Fa ctx 603is 604.Dv NULL . 605.Pp 606.Fn EVP_md_null , 607.Fn EVP_md5 , 608.Fn EVP_md5_sha1 , 609.Fn EVP_sha1 , 610.Fn EVP_dss , 611.Fn EVP_dss1 , 612and 613.Fn EVP_ripemd160 614return pointers to the corresponding 615.Vt EVP_MD 616structures. 617.Pp 618.Fn EVP_get_digestbyname , 619.Fn EVP_get_digestbynid , 620and 621.Fn EVP_get_digestbyobj 622return either an 623.Vt EVP_MD 624structure or 625.Dv NULL 626if an error occurs. 627.Sh EXAMPLES 628This example digests the data "Test Message\en" and "Hello World\en", 629using the digest name passed on the command line. 630.Bd -literal -offset indent 631#include <stdio.h> 632#include <openssl/evp.h> 633 634int 635main(int argc, char *argv[]) 636{ 637 EVP_MD_CTX *mdctx; 638 const EVP_MD *md; 639 const char mess1[] = "Test Message\en"; 640 const char mess2[] = "Hello World\en"; 641 unsigned char md_value[EVP_MAX_MD_SIZE]; 642 int md_len, i; 643 644 OpenSSL_add_all_digests(); 645 646 if (argc <= 1) { 647 printf("Usage: mdtest digestname\en"); 648 exit(1); 649 } 650 651 md = EVP_get_digestbyname(argv[1]); 652 if (md == NULL) { 653 printf("Unknown message digest %s\en", argv[1]); 654 exit(1); 655 } 656 657 mdctx = EVP_MD_CTX_new(); 658 EVP_DigestInit_ex(mdctx, md, NULL); 659 EVP_DigestUpdate(mdctx, mess1, strlen(mess1)); 660 EVP_DigestUpdate(mdctx, mess2, strlen(mess2)); 661 EVP_DigestFinal_ex(mdctx, md_value, &md_len); 662 EVP_MD_CTX_free(mdctx); 663 664 printf("Digest is: "); 665 for(i = 0; i < md_len; i++) 666 printf("%02x", md_value[i]); 667 printf("\en"); 668 669 return 0; 670} 671.Ed 672.Sh SEE ALSO 673.Xr BIO_f_md 3 , 674.Xr CMAC_Init 3 , 675.Xr evp 3 , 676.Xr EVP_BytesToKey 3 , 677.Xr EVP_DigestSignInit 3 , 678.Xr EVP_DigestVerifyInit 3 , 679.Xr EVP_PKEY_CTX_set_signature_md 3 , 680.Xr EVP_PKEY_meth_set_signctx 3 , 681.Xr EVP_SignInit 3 , 682.Xr EVP_sm3 3 , 683.Xr EVP_VerifyInit 3 , 684.Xr EVP_whirlpool 3 , 685.Xr HMAC 3 , 686.Xr OCSP_basic_sign 3 , 687.Xr OCSP_request_sign 3 , 688.Xr PKCS5_PBKDF2_HMAC 3 , 689.Xr PKCS7_sign_add_signer 3 , 690.Xr X509_ALGOR_set_md 3 , 691.Xr X509_digest 3 , 692.Xr X509_sign 3 693.Sh HISTORY 694.Fn EVP_DigestInit , 695.Fn EVP_DigestUpdate , 696.Fn EVP_DigestFinal , 697.Dv EVP_MAX_MD_SIZE , 698.Fn EVP_md5 , 699and 700.Fn EVP_sha1 701first appeared in SSLeay 0.5.1. 702.Fn EVP_dss 703and 704.Fn EVP_dss1 705first appeared in SSLeay 0.6.0. 706.Fn EVP_MD_size 707first appeared in SSLeay 0.6.6. 708.Fn EVP_MD_CTX_size , 709.Fn EVP_MD_CTX_type , 710.Fn EVP_md_null , 711and 712.Fn EVP_get_digestbyname 713first appeared in SSLeay 0.8.0. 714.Fn EVP_MD_type , 715.Fn EVP_MD_pkey_type , 716.Fn EVP_get_digestbynid , 717and 718.Fn EVP_get_digestbyobj 719first appeared in SSLeay 0.8.1. 720.Fn EVP_MD_block_size , 721.Fn EVP_MD_CTX_size , 722.Fn EVP_MD_CTX_block_size , 723.Fn EVP_rc4_40 , 724.Fn EVP_rc2_40_cbc , 725and 726.Fn EVP_ripemd160 727first appeared in SSLeay 0.9.0. 728All these functions have been available since 729.Ox 2.4 . 730.Pp 731.Fn EVP_MD_CTX_copy 732first appeared in OpenSSL 0.9.2b and has been available since 733.Ox 2.6 . 734.Pp 735.Fn EVP_MD_CTX_md 736first appeared in OpenSSL 0.9.5 and has been available since 737.Ox 2.7 . 738.Pp 739.Fn EVP_MD_CTX_init , 740.Fn EVP_MD_CTX_create , 741.Fn EVP_MD_CTX_cleanup , 742.Fn EVP_MD_CTX_destroy , 743.Fn EVP_DigestInit_ex , 744.Fn EVP_DigestFinal_ex , 745.Fn EVP_Digest , 746and 747.Fn EVP_MD_CTX_copy_ex 748first appeared in OpenSSL 0.9.7 and have been available since 749.Ox 3.2 . 750.Pp 751.Fn EVP_sha224 , 752.Fn EVP_sha256 , 753.Fn EVP_sha384 , 754and 755.Fn EVP_sha512 756first appeared in OpenSSL 0.9.7h and 0.9.8a 757and have been available since 758.Ox 4.0 . 759.Pp 760.Fn EVP_MD_CTX_ctrl 761first appeared in OpenSSL 1.1.0 and has been available since 762.Ox 5.7 . 763.Pp 764.Fn EVP_MD_CTX_new , 765.Fn EVP_MD_CTX_reset , 766.Fn EVP_MD_CTX_free , 767and 768.Fn EVP_md5_sha1 769first appeared in OpenSSL 1.1.0 and have been available since 770.Ox 6.3 . 771.Pp 772The link between digests and signing algorithms was fixed in OpenSSL 1.0 773and later, so now 774.Fn EVP_sha1 775can be used with RSA and DSA; there is no need to use 776.Fn EVP_dss1 777any more. 778