summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/man/EVP_DigestInit.3
diff options
context:
space:
mode:
authorschwarze <>2023-09-07 14:22:11 +0000
committerschwarze <>2023-09-07 14:22:11 +0000
commitac20bb42fcec4c75215a5bca5b62760f3476c869 (patch)
tree95e47c798b76d1bffba9f0c2b5167978aedf8509 /src/lib/libcrypto/man/EVP_DigestInit.3
parentc420d880d863c7e796d3b74a384e422cddc42734 (diff)
downloadopenbsd-ac20bb42fcec4c75215a5bca5b62760f3476c869.tar.gz
openbsd-ac20bb42fcec4c75215a5bca5b62760f3476c869.tar.bz2
openbsd-ac20bb42fcec4c75215a5bca5b62760f3476c869.zip
Split two new manual pages EVP_MD_nid(3) and EVP_MD_CTX_ctrl(3)
out of the large EVP_DigestInit(3). No text change.
Diffstat (limited to 'src/lib/libcrypto/man/EVP_DigestInit.3')
-rw-r--r--src/lib/libcrypto/man/EVP_DigestInit.3319
1 files changed, 7 insertions, 312 deletions
diff --git a/src/lib/libcrypto/man/EVP_DigestInit.3 b/src/lib/libcrypto/man/EVP_DigestInit.3
index 54cc771b10..562592b3c8 100644
--- a/src/lib/libcrypto/man/EVP_DigestInit.3
+++ b/src/lib/libcrypto/man/EVP_DigestInit.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: EVP_DigestInit.3,v 1.29 2023/08/27 15:33:08 schwarze Exp $ 1.\" $OpenBSD: EVP_DigestInit.3,v 1.30 2023/09/07 14:22:11 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.\"
@@ -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 27 2023 $ 73.Dd $Mdocdate: September 7 2023 $
74.Dt EVP_DIGESTINIT 3 74.Dt EVP_DIGESTINIT 3
75.Os 75.Os
76.Sh NAME 76.Sh NAME
@@ -81,10 +81,6 @@
81.Nm EVP_MD_CTX_create , 81.Nm EVP_MD_CTX_create ,
82.Nm EVP_MD_CTX_cleanup , 82.Nm EVP_MD_CTX_cleanup ,
83.Nm EVP_MD_CTX_destroy , 83.Nm EVP_MD_CTX_destroy ,
84.Nm EVP_MD_CTX_ctrl ,
85.Nm EVP_MD_CTX_set_flags ,
86.Nm EVP_MD_CTX_clear_flags ,
87.Nm EVP_MD_CTX_test_flags ,
88.Nm EVP_DigestInit_ex , 84.Nm EVP_DigestInit_ex ,
89.Nm EVP_DigestUpdate , 85.Nm EVP_DigestUpdate ,
90.Nm EVP_DigestFinal_ex , 86.Nm EVP_DigestFinal_ex ,
@@ -94,18 +90,7 @@
94.Nm EVP_DigestFinal , 90.Nm EVP_DigestFinal ,
95.Nm EVP_MD_CTX_copy , 91.Nm EVP_MD_CTX_copy ,
96.Nm EVP_MAX_MD_SIZE , 92.Nm EVP_MAX_MD_SIZE ,
97.Nm EVP_MD_type ,
98.Nm EVP_MD_pkey_type ,
99.Nm EVP_MD_size ,
100.Nm EVP_MD_block_size ,
101.Nm EVP_MD_flags ,
102.Nm EVP_MD_CTX_md , 93.Nm EVP_MD_CTX_md ,
103.Nm EVP_MD_CTX_size ,
104.Nm EVP_MD_CTX_block_size ,
105.Nm EVP_MD_CTX_type ,
106.Nm EVP_MD_CTX_md_data ,
107.Nm EVP_MD_CTX_pkey_ctx ,
108.Nm EVP_MD_CTX_set_pkey_ctx ,
109.Nm EVP_md_null , 94.Nm EVP_md_null ,
110.Nm EVP_sha224 , 95.Nm EVP_sha224 ,
111.Nm EVP_sha256 , 96.Nm EVP_sha256 ,
@@ -145,28 +130,6 @@
145.Fa "EVP_MD_CTX *ctx" 130.Fa "EVP_MD_CTX *ctx"
146.Fc 131.Fc
147.Ft int 132.Ft int
148.Fo EVP_MD_CTX_ctrl
149.Fa "EVP_MD_CTX *ctx"
150.Fa "int command"
151.Fa "int p1"
152.Fa "void* p2"
153.Fc
154.Ft void
155.Fo EVP_MD_CTX_set_flags
156.Fa "EVP_MD_CTX *ctx"
157.Fa "int flags"
158.Fc
159.Ft void
160.Fo EVP_MD_CTX_clear_flags
161.Fa "EVP_MD_CTX *ctx"
162.Fa "int flags"
163.Fc
164.Ft int
165.Fo EVP_MD_CTX_test_flags
166.Fa "const EVP_MD_CTX *ctx"
167.Fa "int flags"
168.Fc
169.Ft int
170.Fo EVP_DigestInit_ex 133.Fo EVP_DigestInit_ex
171.Fa "EVP_MD_CTX *ctx" 134.Fa "EVP_MD_CTX *ctx"
172.Fa "const EVP_MD *type" 135.Fa "const EVP_MD *type"
@@ -215,55 +178,10 @@
215.Fa "EVP_MD_CTX *in" 178.Fa "EVP_MD_CTX *in"
216.Fc 179.Fc
217.Fd #define EVP_MAX_MD_SIZE 64 /* SHA512 */ 180.Fd #define EVP_MAX_MD_SIZE 64 /* SHA512 */
218.Ft int
219.Fo EVP_MD_type
220.Fa "const EVP_MD *md"
221.Fc
222.Ft int
223.Fo EVP_MD_pkey_type
224.Fa "const EVP_MD *md"
225.Fc
226.Ft int
227.Fo EVP_MD_size
228.Fa "const EVP_MD *md"
229.Fc
230.Ft int
231.Fo EVP_MD_block_size
232.Fa "const EVP_MD *md"
233.Fc
234.Ft unsigned long
235.Fo EVP_MD_flags
236.Fa "const EVP_MD *md"
237.Fc
238.Ft const EVP_MD * 181.Ft const EVP_MD *
239.Fo EVP_MD_CTX_md 182.Fo EVP_MD_CTX_md
240.Fa "const EVP_MD_CTX *ctx" 183.Fa "const EVP_MD_CTX *ctx"
241.Fc 184.Fc
242.Ft int
243.Fo EVP_MD_CTX_size
244.Fa "const EVP_MD_CTX *ctx"
245.Fc
246.Ft int
247.Fo EVP_MD_CTX_block_size
248.Fa "const EVP_MD_CTX *ctx"
249.Fc
250.Ft int
251.Fo EVP_MD_CTX_type
252.Fa "const EVP_MD_CTX *ctx"
253.Fc
254.Ft void *
255.Fo EVP_MD_CTX_md_data
256.Fa "const EVP_MD_CTX *ctx"
257.Fc
258.Ft EVP_PKEY_CTX *
259.Fo EVP_MD_CTX_pkey_ctx
260.Fa "const EVP_MD_CTX *ctx"
261.Fc
262.Ft void
263.Fo EVP_MD_CTX_set_pkey_ctx
264.Fa "EVP_MD_CTX *ctx"
265.Fa "EVP_PKEY_CTX *pctx"
266.Fc
267.Ft const EVP_MD * 185.Ft const EVP_MD *
268.Fn EVP_md_null void 186.Fn EVP_md_null void
269.Ft const EVP_MD * 187.Ft const EVP_MD *
@@ -329,70 +247,6 @@ and
329.Fn EVP_MD_CTX_free , 247.Fn EVP_MD_CTX_free ,
330respectively. 248respectively.
331.Pp 249.Pp
332.Fn EVP_MD_CTX_ctrl
333performs the digest-specific control
334.Fa command
335with the command-specific arguments
336.Fa p1
337and
338.Fa p2
339on
340.Fa ctx ,
341which needs to already be set up with
342.Fn EVP_DigestInit_ex
343before calling this function.
344Other restrictions may apply depending on the control
345.Fa command
346and digest implementation.
347.Pp
348If the
349.Fa command
350is
351.Dv EVP_MD_CTRL_MICALG ,
352.Fa p1
353is ignored and
354.Fa p2
355is an output argument of the type
356.Fa "char **p2" .
357A string specifying the digest Message Integrity Check algorithm
358is allocated and a pointer to this string is returned in
359.Pf * Fa p2 .
360It is the responsibility of the caller to
361.Xr free 3
362.Pf * Fa p2
363when it is no longer needed.
364This
365.Fa command
366is used by
367.Xr SMIME_write_ASN1 3
368when creating S/MIME multipart/signed messages as specified in RFC 3851.
369.Pp
370.Fn EVP_MD_CTX_set_flags
371sets and
372.Fn EVP_MD_CTX_clear_flags
373clears all the flag bits in
374.Fa ctx
375that are set in the
376.Fa flags
377argument.
378.Fn EVP_MD_CTX_test_flags
379tests which of the flag bits that are set in the
380.Fa flags
381argument are also set in
382.Fa ctx .
383Possible flag bits are:
384.Bl -tag -width Ds -offset 2n
385.It Dv EVP_MD_CTX_FLAG_NO_INIT
386Instruct
387.Fn EVP_DigestInit_ex
388and functions calling it not to initialise the internal data
389that is specific to the digest method and its implementation.
390.It Dv EVP_MD_CTX_FLAG_ONESHOT
391Instruct the digest to optimize for one update only, if possible.
392For digest algorithms built into the library, this flag usually
393has no effect.
394.El
395.Pp
396.Fn EVP_DigestInit_ex 250.Fn EVP_DigestInit_ex
397sets up the digest context 251sets up the digest context
398.Fa ctx 252.Fa ctx
@@ -505,111 +359,6 @@ except that it requires
505before a context that was already used can be passed as 359before a context that was already used can be passed as
506.Fa out . 360.Fa out .
507.Pp 361.Pp
508.Fn EVP_MD_size
509and
510.Fn EVP_MD_CTX_size
511return the size of the message digest when passed an
512.Vt EVP_MD
513or an
514.Vt EVP_MD_CTX
515structure, i.e. the size of the hash.
516.Pp
517.Fn EVP_MD_block_size
518and
519.Fn EVP_MD_CTX_block_size
520return the block size of the message digest when passed an
521.Vt EVP_MD
522or an
523.Vt EVP_MD_CTX
524structure.
525.Pp
526.Fn EVP_MD_type
527and
528.Fn EVP_MD_CTX_type
529return the NID of the OBJECT IDENTIFIER representing the message digest.
530For example
531.Fn EVP_MD_type EVP_sha512()
532returns
533.Dv NID_sha512 .
534These functions are normally used when setting ASN.1 OIDs.
535.Pp
536.Fn EVP_MD_CTX_md_data
537returns the digest method private data of
538.Fa ctx .
539The space was allocated and its size set with
540.Xr EVP_MD_meth_set_app_datasize 3 .
541.Pp
542.Fn EVP_MD_flags
543returns the
544.Fa md
545flags.
546These are different from the
547.Vt EVP_MD_CTX
548ones.
549See
550.Xr EVP_MD_meth_set_flags 3
551for more information.
552.Pp
553.Fn EVP_MD_pkey_type
554returns the NID of the public key signing algorithm associated with this
555digest.
556For example
557.Fn EVP_sha512
558is associated with RSA so this will return
559.Dv NID_sha512WithRSAEncryption .
560Since digests and signature algorithms are no longer linked, this
561function is only retained for compatibility reasons.
562.Pp
563.Fn EVP_MD_CTX_pkey_ctx
564returns the
565.Vt EVP_PKEY_CTX
566assigned to
567.Fa ctx .
568The returned pointer should not be freed by the caller.
569.Pp
570.Fn EVP_MD_CTX_set_pkey_ctx
571assigns
572.Fa pctx
573to
574.Fa ctx .
575This is normally used to provide a customized
576.Vt EVP_PKEY_CTX
577to
578.Xr EVP_DigestSignInit 3
579or
580.Xr EVP_DigestVerifyInit 3 .
581The caller retains ownership of the
582.Fa pctx
583passed to this function and is responsible for freeing it
584when it is no longer needed.
585.Pp
586If the
587.Fa ctx
588already contains a
589.Vt EVP_PKEY_CTX
590when this function is called, that old
591.Vt EVP_PKEY_CTX
592is freed if it was created internally, but if it was also installed with
593.Fn EVP_MD_CTX_set_pkey_ctx ,
594the pointer to the old
595.Vt EVP_PKEY_CTX
596is merely replaced by the new pointer and ownership of the old
597.Vt EVP_PKEY_CTX
598remains with the previous caller.
599.Pp
600Passing a
601.Dv NULL
602pointer for the
603.Fa pctx
604argument is also allowed.
605In that case, any
606.Vt EVP_PKEY_CTX
607already assigned to
608.Fa ctx
609is dissociated from it as described above, but no new
610.Vt EVP_PKEY_CTX
611is assigned.
612.Pp
613.Fn EVP_sha224 , 362.Fn EVP_sha224 ,
614.Fn EVP_sha256 , 363.Fn EVP_sha256 ,
615.Fn EVP_sha384 , 364.Fn EVP_sha384 ,
@@ -642,10 +391,7 @@ return an
642structure when passed a digest name, a digest NID, or an ASN1_OBJECT 391structure when passed a digest name, a digest NID, or an ASN1_OBJECT
643structure respectively. 392structure respectively.
644.Pp 393.Pp
645.Fn EVP_MD_CTX_size , 394.Fn EVP_get_digestbynid
646.Fn EVP_MD_CTX_block_size ,
647.Fn EVP_MD_CTX_type ,
648.Fn EVP_get_digestbynid ,
649and 395and
650.Fn EVP_get_digestbyobj 396.Fn EVP_get_digestbyobj
651are implemented as macros. 397are implemented as macros.
@@ -693,7 +439,6 @@ and
693.Fn EVP_MD_CTX_cleanup 439.Fn EVP_MD_CTX_cleanup
694always return 1. 440always return 1.
695.Pp 441.Pp
696.Fn EVP_MD_CTX_ctrl ,
697.Fn EVP_DigestInit_ex , 442.Fn EVP_DigestInit_ex ,
698.Fn EVP_DigestUpdate , 443.Fn EVP_DigestUpdate ,
699.Fn EVP_DigestFinal_ex , 444.Fn EVP_DigestFinal_ex ,
@@ -705,27 +450,6 @@ and
705.Fn EVP_MD_CTX_copy 450.Fn EVP_MD_CTX_copy
706return 1 for success or 0 for failure. 451return 1 for success or 0 for failure.
707.Pp 452.Pp
708.Fn EVP_MD_CTX_test_flags
709returns the bitwise OR of the
710.Fa flags
711argument and the flags set in
712.Fa ctx .
713.Pp
714.Fn EVP_MD_type ,
715.Fn EVP_MD_pkey_type ,
716and
717.Fn EVP_MD_CTX_type
718return the NID of the corresponding OBJECT IDENTIFIER or
719.Dv NID_undef
720if none exists.
721.Pp
722.Fn EVP_MD_size ,
723.Fn EVP_MD_block_size ,
724.Fn EVP_MD_CTX_size ,
725and
726.Fn EVP_MD_CTX_block_size
727return the digest or block size in bytes.
728.Pp
729.Fn EVP_MD_CTX_md 453.Fn EVP_MD_CTX_md
730returns the 454returns the
731.Vt EVP_MD 455.Vt EVP_MD
@@ -805,7 +529,9 @@ main(int argc, char *argv[])
805.Xr EVP_BytesToKey 3 , 529.Xr EVP_BytesToKey 3 ,
806.Xr EVP_DigestSignInit 3 , 530.Xr EVP_DigestSignInit 3 ,
807.Xr EVP_DigestVerifyInit 3 , 531.Xr EVP_DigestVerifyInit 3 ,
532.Xr EVP_MD_CTX_ctrl 3 ,
808.Xr EVP_MD_meth_new 3 , 533.Xr EVP_MD_meth_new 3 ,
534.Xr EVP_MD_nid 3 ,
809.Xr EVP_PKEY_CTX_set_signature_md 3 , 535.Xr EVP_PKEY_CTX_set_signature_md 3 ,
810.Xr EVP_PKEY_meth_set_signctx 3 , 536.Xr EVP_PKEY_meth_set_signctx 3 ,
811.Xr EVP_sha1 3 , 537.Xr EVP_sha1 3 ,
@@ -829,24 +555,14 @@ main(int argc, char *argv[])
829and 555and
830.Dv EVP_MAX_MD_SIZE 556.Dv EVP_MAX_MD_SIZE
831first appeared in SSLeay 0.5.1. 557first appeared in SSLeay 0.5.1.
832.Fn EVP_MD_size 558.Fn EVP_md_null
833first appeared in SSLeay 0.6.6.
834.Fn EVP_MD_CTX_size ,
835.Fn EVP_MD_CTX_type ,
836.Fn EVP_md_null ,
837and 559and
838.Fn EVP_get_digestbyname 560.Fn EVP_get_digestbyname
839first appeared in SSLeay 0.8.0. 561first appeared in SSLeay 0.8.0.
840.Fn EVP_MD_type , 562.Fn EVP_get_digestbynid
841.Fn EVP_MD_pkey_type ,
842.Fn EVP_get_digestbynid ,
843and 563and
844.Fn EVP_get_digestbyobj 564.Fn EVP_get_digestbyobj
845first appeared in SSLeay 0.8.1. 565first appeared in SSLeay 0.8.1.
846.Fn EVP_MD_block_size ,
847.Fn EVP_MD_CTX_size ,
848.Fn EVP_MD_CTX_block_size ,
849and
850.Fn EVP_ripemd160 566.Fn EVP_ripemd160
851first appeared in SSLeay 0.9.0. 567first appeared in SSLeay 0.9.0.
852All these functions have been available since 568All these functions have been available since
@@ -864,9 +580,6 @@ first appeared in OpenSSL 0.9.5 and has been available since
864.Fn EVP_MD_CTX_create , 580.Fn EVP_MD_CTX_create ,
865.Fn EVP_MD_CTX_cleanup , 581.Fn EVP_MD_CTX_cleanup ,
866.Fn EVP_MD_CTX_destroy , 582.Fn EVP_MD_CTX_destroy ,
867.Fn EVP_MD_CTX_set_flags ,
868.Fn EVP_MD_CTX_clear_flags ,
869.Fn EVP_MD_CTX_test_flags ,
870.Fn EVP_DigestInit_ex , 583.Fn EVP_DigestInit_ex ,
871.Fn EVP_DigestFinal_ex , 584.Fn EVP_DigestFinal_ex ,
872.Fn EVP_Digest , 585.Fn EVP_Digest ,
@@ -884,15 +597,6 @@ first appeared in OpenSSL 0.9.7h and 0.9.8a
884and have been available since 597and have been available since
885.Ox 4.0 . 598.Ox 4.0 .
886.Pp 599.Pp
887.Fn EVP_MD_flags
888first appeared in OpenSSL 1.0.0
889and has been available since
890.Ox 4.9 .
891.Pp
892.Fn EVP_MD_CTX_ctrl
893first appeared in OpenSSL 1.1.0 and has been available since
894.Ox 5.7 .
895.Pp
896.Fn EVP_MD_CTX_new , 600.Fn EVP_MD_CTX_new ,
897.Fn EVP_MD_CTX_reset , 601.Fn EVP_MD_CTX_reset ,
898and 602and
@@ -900,15 +604,6 @@ and
900first appeared in OpenSSL 1.1.0 and have been available since 604first appeared in OpenSSL 1.1.0 and have been available since
901.Ox 6.3 . 605.Ox 6.3 .
902.Pp 606.Pp
903.Fn EVP_MD_CTX_md_data
904and
905.Fn EVP_MD_CTX_pkey_ctx
906first appeared in OpenSSL 1.1.0 and
907.Fn EVP_MD_CTX_set_pkey_ctx
908in OpenSSL 1.1.1.
909These functions have been available since
910.Ox 7.1 .
911.Pp
912.Fn EVP_sha512_224 607.Fn EVP_sha512_224
913and 608and
914.Fn EVP_sha512_256 609.Fn EVP_sha512_256