Debian Codegraph @

upstream/debian-unstable/man3/EVP_MD_meth_new.3ssl

raw
1 .\" -*- mode: troff; coding: utf-8 -*-
2 .\" Automatically generated by Pod::Man 5.0102 (Pod::Simple 3.45)
3 .\"
4 .\" Standard preamble:
5 .\" ========================================================================
6 .de Sp \" Vertical space (when we can't use .PP)
7 .if t .sp .5v
8 .if n .sp
9 ..
10 .de Vb \" Begin verbatim text
11 .ft CW
12 .nf
13 .ne \\$1
14 ..
15 .de Ve \" End verbatim text
16 .ft R
17 .fi
18 ..
19 .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>.
20 .ie n \{\
21 . ds C` ""
22 . ds C' ""
23 'br\}
24 .el\{\
25 . ds C`
26 . ds C'
27 'br\}
28 .\"
29 .\" Escape single quotes in literal strings from groff's Unicode transform.
30 .ie \n(.g .ds Aq \(aq
31 .el .ds Aq '
32 .\"
33 .\" If the F register is >0, we'll generate index entries on stderr for
34 .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
35 .\" entries marked with X<> in POD. Of course, you'll have to process the
36 .\" output yourself in some meaningful fashion.
37 .\"
38 .\" Avoid warning from groff about undefined register 'F'.
39 .de IX
40 ..
41 .nr rF 0
42 .if \n(.g .if rF .nr rF 1
43 .if (\n(rF:(\n(.g==0)) \{\
44 . if \nF \{\
45 . de IX
46 . tm Index:\\$1\t\\n%\t"\\$2"
47 ..
48 . if !\nF==2 \{\
49 . nr % 0
50 . nr F 2
51 . \}
52 . \}
53 .\}
54 .rr rF
55 .\" ========================================================================
56 .\"
57 .IX Title "EVP_MD_METH_NEW 3SSL"
58 .TH EVP_MD_METH_NEW 3SSL 2026-04-07 3.6.2 OpenSSL
59 .\" For nroff, turn off justification. Always turn off hyphenation; it makes
60 .\" way too many mistakes in technical documents.
61 .if n .ad l
62 .nh
63 .SH NAME
64 EVP_MD_meth_new, EVP_MD_meth_dup, EVP_MD_meth_free,
65 EVP_MD_meth_set_input_blocksize,
66 EVP_MD_meth_set_result_size, EVP_MD_meth_set_app_datasize,
67 EVP_MD_meth_set_flags, EVP_MD_meth_set_init, EVP_MD_meth_set_update,
68 EVP_MD_meth_set_final, EVP_MD_meth_set_copy, EVP_MD_meth_set_cleanup,
69 EVP_MD_meth_set_ctrl, EVP_MD_meth_get_input_blocksize,
70 EVP_MD_meth_get_result_size, EVP_MD_meth_get_app_datasize,
71 EVP_MD_meth_get_flags, EVP_MD_meth_get_init, EVP_MD_meth_get_update,
72 EVP_MD_meth_get_final, EVP_MD_meth_get_copy, EVP_MD_meth_get_cleanup,
73 EVP_MD_meth_get_ctrl
74 \&\- Routines to build up legacy EVP_MD methods
75 .SH SYNOPSIS
76 .IX Header "SYNOPSIS"
77 .Vb 1
78 \& #include <openssl/evp.h>
79 .Ve
80 .PP
81 The following functions have been deprecated since OpenSSL 3.0, and can be
82 hidden entirely by defining \fBOPENSSL_API_COMPAT\fR with a suitable version value,
83 see \fBopenssl_user_macros\fR\|(7):
84 .PP
85 .Vb 3
86 \& EVP_MD *EVP_MD_meth_new(int md_type, int pkey_type);
87 \& void EVP_MD_meth_free(EVP_MD *md);
88 \& EVP_MD *EVP_MD_meth_dup(const EVP_MD *md);
89 \&
90 \& int EVP_MD_meth_set_input_blocksize(EVP_MD *md, int blocksize);
91 \& int EVP_MD_meth_set_result_size(EVP_MD *md, int resultsize);
92 \& int EVP_MD_meth_set_app_datasize(EVP_MD *md, int datasize);
93 \& int EVP_MD_meth_set_flags(EVP_MD *md, unsigned long flags);
94 \& int EVP_MD_meth_set_init(EVP_MD *md, int (*init)(EVP_MD_CTX *ctx));
95 \& int EVP_MD_meth_set_update(EVP_MD *md, int (*update)(EVP_MD_CTX *ctx,
96 \& const void *data,
97 \& size_t count));
98 \& int EVP_MD_meth_set_final(EVP_MD *md, int (*final)(EVP_MD_CTX *ctx,
99 \& unsigned char *md));
100 \& int EVP_MD_meth_set_copy(EVP_MD *md, int (*copy)(EVP_MD_CTX *to,
101 \& const EVP_MD_CTX *from));
102 \& int EVP_MD_meth_set_cleanup(EVP_MD *md, int (*cleanup)(EVP_MD_CTX *ctx));
103 \& int EVP_MD_meth_set_ctrl(EVP_MD *md, int (*ctrl)(EVP_MD_CTX *ctx, int cmd,
104 \& int p1, void *p2));
105 \&
106 \& int EVP_MD_meth_get_input_blocksize(const EVP_MD *md);
107 \& int EVP_MD_meth_get_result_size(const EVP_MD *md);
108 \& int EVP_MD_meth_get_app_datasize(const EVP_MD *md);
109 \& unsigned long EVP_MD_meth_get_flags(const EVP_MD *md);
110 \& int (*EVP_MD_meth_get_init(const EVP_MD *md))(EVP_MD_CTX *ctx);
111 \& int (*EVP_MD_meth_get_update(const EVP_MD *md))(EVP_MD_CTX *ctx,
112 \& const void *data,
113 \& size_t count);
114 \& int (*EVP_MD_meth_get_final(const EVP_MD *md))(EVP_MD_CTX *ctx,
115 \& unsigned char *md);
116 \& int (*EVP_MD_meth_get_copy(const EVP_MD *md))(EVP_MD_CTX *to,
117 \& const EVP_MD_CTX *from);
118 \& int (*EVP_MD_meth_get_cleanup(const EVP_MD *md))(EVP_MD_CTX *ctx);
119 \& int (*EVP_MD_meth_get_ctrl(const EVP_MD *md))(EVP_MD_CTX *ctx, int cmd,
120 \& int p1, void *p2);
121 .Ve
122 .SH DESCRIPTION
123 .IX Header "DESCRIPTION"
124 All of the functions described on this page are deprecated.
125 Applications should instead use the OSSL_PROVIDER APIs.
126 .PP
127 The \fBEVP_MD\fR type is a structure for digest method implementation.
128 It can also have associated public/private key signing and verifying
129 routines.
130 .PP
131 \&\fBEVP_MD_meth_new()\fR creates a new \fBEVP_MD\fR structure.
132 These \fBEVP_MD\fR structures are reference counted.
133 .PP
134 \&\fBEVP_MD_meth_dup()\fR creates a copy of \fBmd\fR.
135 .PP
136 \&\fBEVP_MD_meth_free()\fR decrements the reference count for the \fBEVP_MD\fR structure.
137 If the reference count drops to 0 then the structure is freed.
138 If the argument is NULL, nothing is done.
139 .PP
140 \&\fBEVP_MD_meth_set_input_blocksize()\fR sets the internal input block size
141 for the method \fBmd\fR to \fBblocksize\fR bytes.
142 .PP
143 \&\fBEVP_MD_meth_set_result_size()\fR sets the size of the result that the
144 digest method in \fBmd\fR is expected to produce to \fBresultsize\fR bytes.
145 .PP
146 The digest method may have its own private data, which OpenSSL will
147 allocate for it. \fBEVP_MD_meth_set_app_datasize()\fR should be used to
148 set the size for it to \fBdatasize\fR.
149 .PP
150 \&\fBEVP_MD_meth_set_flags()\fR sets the flags to describe optional
151 behaviours in the particular \fBmd\fR. Several flags can be or'd
152 together. The available flags are:
153 .IP EVP_MD_FLAG_ONESHOT 4
154 .IX Item "EVP_MD_FLAG_ONESHOT"
155 This digest method can only handle one block of input.
156 .IP EVP_MD_FLAG_XOF 4
157 .IX Item "EVP_MD_FLAG_XOF"
158 This digest method is an extensible-output function (XOF) and supports
159 the \fBEVP_MD_CTRL_XOF_LEN\fR control.
160 .IP EVP_MD_FLAG_DIGALGID_NULL 4
161 .IX Item "EVP_MD_FLAG_DIGALGID_NULL"
162 When setting up a DigestAlgorithmIdentifier, this flag will have the
163 parameter set to NULL by default. Use this for PKCS#1. \fINote: if
164 combined with EVP_MD_FLAG_DIGALGID_ABSENT, the latter will override.\fR
165 .IP EVP_MD_FLAG_DIGALGID_ABSENT 4
166 .IX Item "EVP_MD_FLAG_DIGALGID_ABSENT"
167 When setting up a DigestAlgorithmIdentifier, this flag will have the
168 parameter be left absent by default. \fINote: if combined with
169 EVP_MD_FLAG_DIGALGID_NULL, the latter will be overridden.\fR
170 .IP EVP_MD_FLAG_DIGALGID_CUSTOM 4
171 .IX Item "EVP_MD_FLAG_DIGALGID_CUSTOM"
172 Custom DigestAlgorithmIdentifier handling via ctrl, with
173 \&\fBEVP_MD_FLAG_DIGALGID_ABSENT\fR as default. \fINote: if combined with
174 EVP_MD_FLAG_DIGALGID_NULL, the latter will be overridden.\fR
175 Currently unused.
176 .IP EVP_MD_FLAG_FIPS 4
177 .IX Item "EVP_MD_FLAG_FIPS"
178 This digest method is suitable for use in FIPS mode.
179 Currently unused.
180 .PP
181 \&\fBEVP_MD_meth_set_init()\fR sets the digest init function for \fBmd\fR.
182 The digest init function is called by \fBEVP_Digest()\fR, \fBEVP_DigestInit()\fR,
183 \&\fBEVP_DigestInit_ex()\fR, EVP_SignInit, \fBEVP_SignInit_ex()\fR, \fBEVP_VerifyInit()\fR
184 and \fBEVP_VerifyInit_ex()\fR.
185 .PP
186 \&\fBEVP_MD_meth_set_update()\fR sets the digest update function for \fBmd\fR.
187 The digest update function is called by \fBEVP_Digest()\fR, \fBEVP_DigestUpdate()\fR and
188 \&\fBEVP_SignUpdate()\fR.
189 .PP
190 \&\fBEVP_MD_meth_set_final()\fR sets the digest final function for \fBmd\fR.
191 The digest final function is called by \fBEVP_Digest()\fR, \fBEVP_DigestFinal()\fR,
192 \&\fBEVP_DigestFinal_ex()\fR, \fBEVP_SignFinal()\fR and \fBEVP_VerifyFinal()\fR.
193 .PP
194 \&\fBEVP_MD_meth_set_copy()\fR sets the function for \fBmd\fR to do extra
195 computations after the method's private data structure has been copied
196 from one \fBEVP_MD_CTX\fR to another. If all that's needed is to copy
197 the data, there is no need for this copy function.
198 Note that the copy function is passed two \fBEVP_MD_CTX *\fR, the private
199 data structure is then available with \fBEVP_MD_CTX_get0_md_data()\fR.
200 This copy function is called by \fBEVP_MD_CTX_copy()\fR and
201 \&\fBEVP_MD_CTX_copy_ex()\fR.
202 .PP
203 \&\fBEVP_MD_meth_set_cleanup()\fR sets the function for \fBmd\fR to do extra
204 cleanup before the method's private data structure is cleaned out and
205 freed.
206 Note that the cleanup function is passed a \fBEVP_MD_CTX *\fR, the
207 private data structure is then available with \fBEVP_MD_CTX_get0_md_data()\fR.
208 This cleanup function is called by \fBEVP_MD_CTX_reset()\fR and
209 \&\fBEVP_MD_CTX_free()\fR.
210 .PP
211 \&\fBEVP_MD_meth_set_ctrl()\fR sets the control function for \fBmd\fR.
212 See \fBEVP_MD_CTX_ctrl\fR\|(3) for the available controls.
213 .PP
214 \&\fBEVP_MD_meth_get_input_blocksize()\fR, \fBEVP_MD_meth_get_result_size()\fR,
215 \&\fBEVP_MD_meth_get_app_datasize()\fR, \fBEVP_MD_meth_get_flags()\fR,
216 \&\fBEVP_MD_meth_get_init()\fR, \fBEVP_MD_meth_get_update()\fR,
217 \&\fBEVP_MD_meth_get_final()\fR, \fBEVP_MD_meth_get_copy()\fR,
218 \&\fBEVP_MD_meth_get_cleanup()\fR and \fBEVP_MD_meth_get_ctrl()\fR are all used
219 to retrieve the method data given with the EVP_MD_meth_set_*()
220 functions above.
221 .SH "RETURN VALUES"
222 .IX Header "RETURN VALUES"
223 \&\fBEVP_MD_meth_new()\fR and \fBEVP_MD_meth_dup()\fR return a pointer to a newly
224 created \fBEVP_MD\fR, or NULL on failure.
225 All EVP_MD_meth_set_*() functions return 1.
226 \&\fBEVP_MD_get_input_blocksize()\fR, \fBEVP_MD_meth_get_result_size()\fR,
227 \&\fBEVP_MD_meth_get_app_datasize()\fR and \fBEVP_MD_meth_get_flags()\fR return the
228 indicated sizes or flags.
229 All other EVP_CIPHER_meth_get_*() functions return pointers to their
230 respective \fBmd\fR function.
231 .SH "SEE ALSO"
232 .IX Header "SEE ALSO"
233 \&\fBEVP_DigestInit\fR\|(3), \fBEVP_SignInit\fR\|(3), \fBEVP_VerifyInit\fR\|(3)
234 .SH HISTORY
235 .IX Header "HISTORY"
236 All of these functions were deprecated in OpenSSL 3.0.
237 .PP
238 The \fBEVP_MD\fR structure was openly available in OpenSSL before version
239 1.1.
240 The functions described here were added in OpenSSL 1.1.
241 The \fBEVP_MD\fR structure created with these functions became reference
242 counted in OpenSSL 3.0.
243 .SH COPYRIGHT
244 .IX Header "COPYRIGHT"
245 Copyright 2015\-2024 The OpenSSL Project Authors. All Rights Reserved.
246 .PP
247 Licensed under the Apache License 2.0 (the "License"). You may not use
248 this file except in compliance with the License. You can obtain a copy
249 in the file LICENSE in the source distribution or at
250 <https://www.openssl.org/source/license.html>.