summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorschwarze <>2023-08-12 16:12:19 +0000
committerschwarze <>2023-08-12 16:12:19 +0000
commitc6b606675a5e7a408130bcfcd86712f57285e1da (patch)
tree63df11f5a271c86fc6dc922d2d34972461d2c7e7 /src/lib
parent51d778d02def91e33b08f025db05cb37dafa1c9c (diff)
downloadopenbsd-c6b606675a5e7a408130bcfcd86712f57285e1da.tar.gz
openbsd-c6b606675a5e7a408130bcfcd86712f57285e1da.tar.bz2
openbsd-c6b606675a5e7a408130bcfcd86712f57285e1da.zip
1. Tweak the descriptions of EVP_MD_CTX_ctrl(3), EVP_MD_CTX_set_flags(3),
EVP_MD_CTX_clear_flags(3), EVP_MD_CTX_test_flags(3), and the atrocious EVP_MD_CTX_set_pkey_ctx(3) for precision. 2. Tweak the description of EVP_MD_type(3) and EVP_MD_CTX_type(3) for conciseness. 3. Add a few missing HISTORY bits.
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/libcrypto/man/EVP_DigestInit.3159
1 files changed, 107 insertions, 52 deletions
diff --git a/src/lib/libcrypto/man/EVP_DigestInit.3 b/src/lib/libcrypto/man/EVP_DigestInit.3
index 08b64b59b2..6c75adcc98 100644
--- a/src/lib/libcrypto/man/EVP_DigestInit.3
+++ b/src/lib/libcrypto/man/EVP_DigestInit.3
@@ -1,11 +1,11 @@
1.\" $OpenBSD: EVP_DigestInit.3,v 1.26 2023/08/11 18:08:43 schwarze Exp $ 1.\" $OpenBSD: EVP_DigestInit.3,v 1.27 2023/08/12 16:12:19 schwarze Exp $
2.\" full merge up to: OpenSSL 7f572e95 Dec 2 13:57:04 2015 +0000 2.\" full merge up to: OpenSSL 7f572e95 Dec 2 13:57:04 2015 +0000
3.\" selective merge up to: OpenSSL 24a535ea Sep 22 13:14:20 2020 +0100 3.\" selective merge up to: OpenSSL 24a535ea Sep 22 13:14:20 2020 +0100
4.\" 4.\"
5.\" This file is a derived work. 5.\" This file is a derived work.
6.\" The changes are covered by the following Copyright and license: 6.\" The changes are covered by the following Copyright and license:
7.\" 7.\"
8.\" Copyright (c) 2019 Ingo Schwarze <schwarze@openbsd.org> 8.\" Copyright (c) 2019, 2023 Ingo Schwarze <schwarze@openbsd.org>
9.\" 9.\"
10.\" Permission to use, copy, modify, and distribute this software for any 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 11.\" purpose with or without fee is hereby granted, provided that the above
@@ -70,7 +70,7 @@
70.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 70.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
71.\" OF THE POSSIBILITY OF SUCH DAMAGE. 71.\" OF THE POSSIBILITY OF SUCH DAMAGE.
72.\" 72.\"
73.Dd $Mdocdate: August 11 2023 $ 73.Dd $Mdocdate: August 12 2023 $
74.Dt EVP_DIGESTINIT 3 74.Dt EVP_DIGESTINIT 3
75.Os 75.Os
76.Sh NAME 76.Sh NAME
@@ -150,7 +150,7 @@
150.Ft int 150.Ft int
151.Fo EVP_MD_CTX_ctrl 151.Fo EVP_MD_CTX_ctrl
152.Fa "EVP_MD_CTX *ctx" 152.Fa "EVP_MD_CTX *ctx"
153.Fa "int cmd" 153.Fa "int command"
154.Fa "int p1" 154.Fa "int p1"
155.Fa "void* p2" 155.Fa "void* p2"
156.Fc 156.Fc
@@ -339,43 +339,67 @@ and
339respectively. 339respectively.
340.Pp 340.Pp
341.Fn EVP_MD_CTX_ctrl 341.Fn EVP_MD_CTX_ctrl
342performs digest-specific control actions on the context 342performs the digest-specific control
343.Fa ctx . 343.Fa command
344The control command is indicated in 344with the command-specific arguments
345.Fa cmd
346and any additional arguments in
347.Fa p1 345.Fa p1
348and 346and
349.Fa p2 . 347.Fa p2
350.Fn EVP_MD_CTX_ctrl 348on
351must be called after 349.Fa ctx ,
352.Fn EVP_DigestInit_ex . 350which needs to already be set up with
353Other restrictions may apply depending on the control type 351.Fn EVP_DigestInit_ex
352before calling this function.
353Other restrictions may apply depending on the control
354.Fa command
354and digest implementation. 355and digest implementation.
355.Pp 356.Pp
356If the 357If the
357.Fa cmd 358.Fa command
358is 359is
359.Dv EVP_MD_CTRL_MICALG , 360.Dv EVP_MD_CTRL_MICALG ,
360the digest Message Integrity Check algorithm string is written to 361.Fa p1
361.Pf * p2 . 362is ignored and
362This is used when creating S/MIME multipart/signed messages 363.Fa p2
363as specified in RFC 3851. 364is an output argument of the type
364.Pp 365.Fa "char **p2" .
365.Fn EVP_MD_CTX_set_flags , 366A string specifying the digest Message Integrity Check algorithm
366.Fn EVP_MD_CTX_clear_flags , 367is allocated and a pointer to this string is returned in
367and 368.Pf * Fa p2 .
368.Fn EVP_MD_CTX_test_flags 369It is the responsibility of the caller to
369set, clear and test the following 370.Xr free 3
371.Pf * Fa p2
372when it is no longer needed.
373This
374.Fa command
375is used by
376.Xr SMIME_write_ASN1 3
377when creating S/MIME multipart/signed messages as specified in RFC 3851.
378.Pp
379.Fn EVP_MD_CTX_set_flags
380sets and
381.Fn EVP_MD_CTX_clear_flags
382clears all the flag bits in
370.Fa ctx 383.Fa ctx
371flags: 384that are set in the
385.Fa flags
386argument.
387.Fn EVP_MD_CTX_test_flags
388tests which of the flag bits that are set in the
389.Fa flags
390argument are also set in
391.Fa ctx .
392Possible flag bits are:
372.Bl -tag -width Ds -offset 2n 393.Bl -tag -width Ds -offset 2n
373.It Dv EVP_MD_CTX_FLAG_NO_INIT 394.It Dv EVP_MD_CTX_FLAG_NO_INIT
374Instruct 395Instruct
375.Fn EVP_DigestInit 396.Fn EVP_DigestInit_ex
376and similar functions not to initialise the implementation specific data. 397and functions calling it not to initialise the internal data
398that is specific to the digest method and its implementation.
377.It Dv EVP_MD_CTX_FLAG_ONESHOT 399.It Dv EVP_MD_CTX_FLAG_ONESHOT
378Instruct the digest to optimize for one update only, if possible. 400Instruct the digest to optimize for one update only, if possible.
401For digest algorithms built into the library, this flag usually
402has no effect.
379.El 403.El
380.Pp 404.Pp
381.Fn EVP_DigestInit_ex 405.Fn EVP_DigestInit_ex
@@ -508,19 +532,15 @@ or an
508.Vt EVP_MD_CTX 532.Vt EVP_MD_CTX
509structure. 533structure.
510.Pp 534.Pp
511.Fn EVP_MD_type , 535.Fn EVP_MD_type
512.Fn EVP_MD_pkey_type ,
513and 536and
514.Fn EVP_MD_CTX_type 537.Fn EVP_MD_CTX_type
515return the NID of the OBJECT IDENTIFIER representing the given message 538return the NID of the OBJECT IDENTIFIER representing the message digest.
516digest when passed an
517.Vt EVP_MD
518structure.
519For example 539For example
520.Fn EVP_MD_type EVP_sha1() 540.Fn EVP_MD_type EVP_sha1()
521returns 541returns
522.Dv NID_sha1 . 542.Dv NID_sha1 .
523This function is normally used when setting ASN.1 OIDs. 543These functions are normally used when setting ASN.1 OIDs.
524.Pp 544.Pp
525.Fn EVP_MD_CTX_md_data 545.Fn EVP_MD_CTX_md_data
526returns the digest method private data of 546returns the digest method private data of
@@ -561,27 +581,43 @@ assigns
561.Fa pctx 581.Fa pctx
562to 582to
563.Fa ctx . 583.Fa ctx .
564This is usually used to provide a customized 584This is normally used to provide a customized
565.Vt EVP_PKEY_CTX 585.Vt EVP_PKEY_CTX
566to 586to
567.Xr EVP_DigestSignInit 3 587.Xr EVP_DigestSignInit 3
568or 588or
569.Xr EVP_DigestVerifyInit 3 . 589.Xr EVP_DigestVerifyInit 3 .
570The 590The caller retains ownership of the
571.Fa pctx 591.Fa pctx
572passed to this function should be freed by the caller. 592passed to this function and is responsible for freeing it
573A 593when it is no longer needed.
594.Pp
595If the
596.Fa ctx
597already contains a
598.Vt EVP_PKEY_CTX
599when this function is called, that old
600.Vt EVP_PKEY_CTX
601is freed if it was created internally, but if it was also installed with
602.Fn EVP_MD_CTX_set_pkey_ctx ,
603the pointer to the old
604.Vt EVP_PKEY_CTX
605is merely replaced by the new pointer and ownership of the old
606.Vt EVP_PKEY_CTX
607remains with the previous caller.
608.Pp
609Passing a
574.Dv NULL 610.Dv NULL
611pointer for the
575.Fa pctx 612.Fa pctx
576pointer is also allowed to clear the 613argument is also allowed.
577.Vt EVP_PKEY_CTX 614In that case, any
578assigned to
579.Fa ctx .
580In this case, freeing the cleared
581.Vt EVP_PKEY_CTX 615.Vt EVP_PKEY_CTX
582or not depends on how the 616already assigned to
617.Fa ctx
618is dissociated from it as described above, but no new
583.Vt EVP_PKEY_CTX 619.Vt EVP_PKEY_CTX
584was created. 620is assigned.
585.Pp 621.Pp
586.Fn EVP_md5 , 622.Fn EVP_md5 ,
587.Fn EVP_sha1 , 623.Fn EVP_sha1 ,
@@ -688,6 +724,12 @@ and
688.Fn EVP_MD_CTX_copy 724.Fn EVP_MD_CTX_copy
689return 1 for success or 0 for failure. 725return 1 for success or 0 for failure.
690.Pp 726.Pp
727.Fn EVP_MD_CTX_test_flags
728returns the bitwise OR of the
729.Fa flags
730argument and the flags set in
731.Fa ctx .
732.Pp
691.Fn EVP_MD_type , 733.Fn EVP_MD_type ,
692.Fn EVP_MD_pkey_type , 734.Fn EVP_MD_pkey_type ,
693and 735and
@@ -846,6 +888,9 @@ first appeared in OpenSSL 0.9.5 and has been available since
846.Fn EVP_MD_CTX_create , 888.Fn EVP_MD_CTX_create ,
847.Fn EVP_MD_CTX_cleanup , 889.Fn EVP_MD_CTX_cleanup ,
848.Fn EVP_MD_CTX_destroy , 890.Fn EVP_MD_CTX_destroy ,
891.Fn EVP_MD_CTX_set_flags ,
892.Fn EVP_MD_CTX_clear_flags ,
893.Fn EVP_MD_CTX_test_flags ,
849.Fn EVP_DigestInit_ex , 894.Fn EVP_DigestInit_ex ,
850.Fn EVP_DigestFinal_ex , 895.Fn EVP_DigestFinal_ex ,
851.Fn EVP_Digest , 896.Fn EVP_Digest ,
@@ -863,11 +908,10 @@ first appeared in OpenSSL 0.9.7h and 0.9.8a
863and have been available since 908and have been available since
864.Ox 4.0 . 909.Ox 4.0 .
865.Pp 910.Pp
866.Fn EVP_sha512_224 911.Fn EVP_MD_flags
867and 912first appeared in OpenSSL 1.0.0
868.Fn EVP_sha512_256 913and has been available since
869first appeared in OpenSSL 1.1.1 and has been available since 914.Ox 4.9 .
870.Ox 7.4 .
871.Pp 915.Pp
872.Fn EVP_MD_CTX_ctrl 916.Fn EVP_MD_CTX_ctrl
873first appeared in OpenSSL 1.1.0 and has been available since 917first appeared in OpenSSL 1.1.0 and has been available since
@@ -881,10 +925,21 @@ and
881first appeared in OpenSSL 1.1.0 and have been available since 925first appeared in OpenSSL 1.1.0 and have been available since
882.Ox 6.3 . 926.Ox 6.3 .
883.Pp 927.Pp
928.Fn EVP_MD_CTX_md_data
929and
930.Fn EVP_MD_CTX_pkey_ctx
931first appeared in OpenSSL 1.1.0 and
884.Fn EVP_MD_CTX_set_pkey_ctx 932.Fn EVP_MD_CTX_set_pkey_ctx
885first appeared in OpenSSL 1.1.1 and has been available since 933in OpenSSL 1.1.1.
934These functions have been available since
886.Ox 7.1 . 935.Ox 7.1 .
887.Pp 936.Pp
937.Fn EVP_sha512_224
938and
939.Fn EVP_sha512_256
940first appeared in OpenSSL 1.1.1 and have been available since
941.Ox 7.4 .
942.Pp
888The link between digests and signing algorithms was fixed in OpenSSL 1.0 943The link between digests and signing algorithms was fixed in OpenSSL 1.0
889and later, so now 944and later, so now
890.Fn EVP_sha1 945.Fn EVP_sha1