1EVP_MD_METH_NEW(3ossl) OpenSSL EVP_MD_METH_NEW(3ossl)
2
3
4
6 EVP_MD_meth_new, EVP_MD_meth_dup, EVP_MD_meth_free,
7 EVP_MD_meth_set_input_blocksize, EVP_MD_meth_set_result_size,
8 EVP_MD_meth_set_app_datasize, EVP_MD_meth_set_flags,
9 EVP_MD_meth_set_init, EVP_MD_meth_set_update, EVP_MD_meth_set_final,
10 EVP_MD_meth_set_copy, EVP_MD_meth_set_cleanup, EVP_MD_meth_set_ctrl,
11 EVP_MD_meth_get_input_blocksize, EVP_MD_meth_get_result_size,
12 EVP_MD_meth_get_app_datasize, EVP_MD_meth_get_flags,
13 EVP_MD_meth_get_init, EVP_MD_meth_get_update, EVP_MD_meth_get_final,
14 EVP_MD_meth_get_copy, EVP_MD_meth_get_cleanup, EVP_MD_meth_get_ctrl -
15 Routines to build up legacy EVP_MD methods
16
18 #include <openssl/evp.h>
19
20 The following functions have been deprecated since OpenSSL 3.0, and can
21 be hidden entirely by defining OPENSSL_API_COMPAT with a suitable
22 version value, see openssl_user_macros(7):
23
24 EVP_MD *EVP_MD_meth_new(int md_type, int pkey_type);
25 void EVP_MD_meth_free(EVP_MD *md);
26 EVP_MD *EVP_MD_meth_dup(const EVP_MD *md);
27
28 int EVP_MD_meth_set_input_blocksize(EVP_MD *md, int blocksize);
29 int EVP_MD_meth_set_result_size(EVP_MD *md, int resultsize);
30 int EVP_MD_meth_set_app_datasize(EVP_MD *md, int datasize);
31 int EVP_MD_meth_set_flags(EVP_MD *md, unsigned long flags);
32 int EVP_MD_meth_set_init(EVP_MD *md, int (*init)(EVP_MD_CTX *ctx));
33 int EVP_MD_meth_set_update(EVP_MD *md, int (*update)(EVP_MD_CTX *ctx,
34 const void *data,
35 size_t count));
36 int EVP_MD_meth_set_final(EVP_MD *md, int (*final)(EVP_MD_CTX *ctx,
37 unsigned char *md));
38 int EVP_MD_meth_set_copy(EVP_MD *md, int (*copy)(EVP_MD_CTX *to,
39 const EVP_MD_CTX *from));
40 int EVP_MD_meth_set_cleanup(EVP_MD *md, int (*cleanup)(EVP_MD_CTX *ctx));
41 int EVP_MD_meth_set_ctrl(EVP_MD *md, int (*ctrl)(EVP_MD_CTX *ctx, int cmd,
42 int p1, void *p2));
43
44 int EVP_MD_meth_get_input_blocksize(const EVP_MD *md);
45 int EVP_MD_meth_get_result_size(const EVP_MD *md);
46 int EVP_MD_meth_get_app_datasize(const EVP_MD *md);
47 unsigned long EVP_MD_meth_get_flags(const EVP_MD *md);
48 int (*EVP_MD_meth_get_init(const EVP_MD *md))(EVP_MD_CTX *ctx);
49 int (*EVP_MD_meth_get_update(const EVP_MD *md))(EVP_MD_CTX *ctx,
50 const void *data,
51 size_t count);
52 int (*EVP_MD_meth_get_final(const EVP_MD *md))(EVP_MD_CTX *ctx,
53 unsigned char *md);
54 int (*EVP_MD_meth_get_copy(const EVP_MD *md))(EVP_MD_CTX *to,
55 const EVP_MD_CTX *from);
56 int (*EVP_MD_meth_get_cleanup(const EVP_MD *md))(EVP_MD_CTX *ctx);
57 int (*EVP_MD_meth_get_ctrl(const EVP_MD *md))(EVP_MD_CTX *ctx, int cmd,
58 int p1, void *p2);
59
61 All of the functions described on this page are deprecated.
62 Applications should instead use the OSSL_PROVIDER APIs.
63
64 The EVP_MD type is a structure for digest method implementation. It
65 can also have associated public/private key signing and verifying
66 routines.
67
68 EVP_MD_meth_new() creates a new EVP_MD structure. These EVP_MD
69 structures are reference counted.
70
71 EVP_MD_meth_dup() creates a copy of md.
72
73 EVP_MD_meth_free() decrements the reference count for the EVP_MD
74 structure. If the reference count drops to 0 then the structure is
75 freed.
76
77 EVP_MD_meth_set_input_blocksize() sets the internal input block size
78 for the method md to blocksize bytes.
79
80 EVP_MD_meth_set_result_size() sets the size of the result that the
81 digest method in md is expected to produce to resultsize bytes.
82
83 The digest method may have its own private data, which OpenSSL will
84 allocate for it. EVP_MD_meth_set_app_datasize() should be used to set
85 the size for it to datasize.
86
87 EVP_MD_meth_set_flags() sets the flags to describe optional behaviours
88 in the particular md. Several flags can be or'd together. The
89 available flags are:
90
91 EVP_MD_FLAG_ONESHOT
92 This digest method can only handle one block of input.
93
94 EVP_MD_FLAG_XOF
95 This digest method is an extensible-output function (XOF) and
96 supports the EVP_MD_CTRL_XOF_LEN control.
97
98 EVP_MD_FLAG_DIGALGID_NULL
99 When setting up a DigestAlgorithmIdentifier, this flag will have
100 the parameter set to NULL by default. Use this for PKCS#1. Note:
101 if combined with EVP_MD_FLAG_DIGALGID_ABSENT, the latter will
102 override.
103
104 EVP_MD_FLAG_DIGALGID_ABSENT
105 When setting up a DigestAlgorithmIdentifier, this flag will have
106 the parameter be left absent by default. Note: if combined with
107 EVP_MD_FLAG_DIGALGID_NULL, the latter will be overridden.
108
109 EVP_MD_FLAG_DIGALGID_CUSTOM
110 Custom DigestAlgorithmIdentifier handling via ctrl, with
111 EVP_MD_FLAG_DIGALGID_ABSENT as default. Note: if combined with
112 EVP_MD_FLAG_DIGALGID_NULL, the latter will be overridden.
113 Currently unused.
114
115 EVP_MD_FLAG_FIPS
116 This digest method is suitable for use in FIPS mode. Currently
117 unused.
118
119 EVP_MD_meth_set_init() sets the digest init function for md. The
120 digest init function is called by EVP_Digest(), EVP_DigestInit(),
121 EVP_DigestInit_ex(), EVP_SignInit, EVP_SignInit_ex(), EVP_VerifyInit()
122 and EVP_VerifyInit_ex().
123
124 EVP_MD_meth_set_update() sets the digest update function for md. The
125 digest update function is called by EVP_Digest(), EVP_DigestUpdate()
126 and EVP_SignUpdate().
127
128 EVP_MD_meth_set_final() sets the digest final function for md. The
129 digest final function is called by EVP_Digest(), EVP_DigestFinal(),
130 EVP_DigestFinal_ex(), EVP_SignFinal() and EVP_VerifyFinal().
131
132 EVP_MD_meth_set_copy() sets the function for md to do extra
133 computations after the method's private data structure has been copied
134 from one EVP_MD_CTX to another. If all that's needed is to copy the
135 data, there is no need for this copy function. Note that the copy
136 function is passed two EVP_MD_CTX *, the private data structure is then
137 available with EVP_MD_CTX_get0_md_data(). This copy function is called
138 by EVP_MD_CTX_copy() and EVP_MD_CTX_copy_ex().
139
140 EVP_MD_meth_set_cleanup() sets the function for md to do extra cleanup
141 before the method's private data structure is cleaned out and freed.
142 Note that the cleanup function is passed a EVP_MD_CTX *, the private
143 data structure is then available with EVP_MD_CTX_get0_md_data(). This
144 cleanup function is called by EVP_MD_CTX_reset() and EVP_MD_CTX_free().
145
146 EVP_MD_meth_set_ctrl() sets the control function for md. See
147 EVP_MD_CTX_ctrl(3) for the available controls.
148
149 EVP_MD_meth_get_input_blocksize(), EVP_MD_meth_get_result_size(),
150 EVP_MD_meth_get_app_datasize(), EVP_MD_meth_get_flags(),
151 EVP_MD_meth_get_init(), EVP_MD_meth_get_update(),
152 EVP_MD_meth_get_final(), EVP_MD_meth_get_copy(),
153 EVP_MD_meth_get_cleanup() and EVP_MD_meth_get_ctrl() are all used to
154 retrieve the method data given with the EVP_MD_meth_set_*() functions
155 above.
156
158 EVP_MD_meth_new() and EVP_MD_meth_dup() return a pointer to a newly
159 created EVP_MD, or NULL on failure. All EVP_MD_meth_set_*() functions
160 return 1. EVP_MD_get_input_blocksize(), EVP_MD_meth_get_result_size(),
161 EVP_MD_meth_get_app_datasize() and EVP_MD_meth_get_flags() return the
162 indicated sizes or flags. All other EVP_CIPHER_meth_get_*() functions
163 return pointers to their respective md function.
164
166 EVP_DigestInit(3), EVP_SignInit(3), EVP_VerifyInit(3)
167
169 All of these functions were deprecated in OpenSSL 3.0.
170
171 The EVP_MD structure was openly available in OpenSSL before version
172 1.1. The functions described here were added in OpenSSL 1.1. The
173 EVP_MD structure created with these functions became reference counted
174 in OpenSSL 3.0.
175
177 Copyright 2015-2021 The OpenSSL Project Authors. All Rights Reserved.
178
179 Licensed under the Apache License 2.0 (the "License"). You may not use
180 this file except in compliance with the License. You can obtain a copy
181 in the file LICENSE in the source distribution or at
182 <https://www.openssl.org/source/license.html>.
183
184
185
1863.0.9 2023-07-27 EVP_MD_METH_NEW(3ossl)