1EVP_MD_METH_NEW(3)                  OpenSSL                 EVP_MD_METH_NEW(3)
2
3
4

NAME

6       EVP_MD_meth_dup, EVP_MD_meth_new, 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 EVP_MD methods
16

SYNOPSIS

18        #include <openssl/evp.h>
19
20        EVP_MD *EVP_MD_meth_new(int md_type, int pkey_type);
21        void EVP_MD_meth_free(EVP_MD *md);
22        EVP_MD *EVP_MD_meth_dup(const EVP_MD *md);
23
24        int EVP_MD_meth_set_input_blocksize(EVP_MD *md, int blocksize);
25        int EVP_MD_meth_set_result_size(EVP_MD *md, int resultsize);
26        int EVP_MD_meth_set_app_datasize(EVP_MD *md, int datasize);
27        int EVP_MD_meth_set_flags(EVP_MD *md, unsigned long flags);
28        int EVP_MD_meth_set_init(EVP_MD *md, int (*init)(EVP_MD_CTX *ctx));
29        int EVP_MD_meth_set_update(EVP_MD *md, int (*update)(EVP_MD_CTX *ctx,
30                                                             const void *data,
31                                                             size_t count));
32        int EVP_MD_meth_set_final(EVP_MD *md, int (*final)(EVP_MD_CTX *ctx,
33                                                           unsigned char *md));
34        int EVP_MD_meth_set_copy(EVP_MD *md, int (*copy)(EVP_MD_CTX *to,
35                                                         const EVP_MD_CTX *from));
36        int EVP_MD_meth_set_cleanup(EVP_MD *md, int (*cleanup)(EVP_MD_CTX *ctx));
37        int EVP_MD_meth_set_ctrl(EVP_MD *md, int (*ctrl)(EVP_MD_CTX *ctx, int cmd,
38                                                         int p1, void *p2));
39
40        int EVP_MD_meth_get_input_blocksize(const EVP_MD *md);
41        int EVP_MD_meth_get_result_size(const EVP_MD *md);
42        int EVP_MD_meth_get_app_datasize(const EVP_MD *md);
43        unsigned long EVP_MD_meth_get_flags(const EVP_MD *md);
44        int (*EVP_MD_meth_get_init(const EVP_MD *md))(EVP_MD_CTX *ctx);
45        int (*EVP_MD_meth_get_update(const EVP_MD *md))(EVP_MD_CTX *ctx,
46                                                        const void *data,
47                                                        size_t count);
48        int (*EVP_MD_meth_get_final(const EVP_MD *md))(EVP_MD_CTX *ctx,
49                                                       unsigned char *md);
50        int (*EVP_MD_meth_get_copy(const EVP_MD *md))(EVP_MD_CTX *to,
51                                                      const EVP_MD_CTX *from);
52        int (*EVP_MD_meth_get_cleanup(const EVP_MD *md))(EVP_MD_CTX *ctx);
53        int (*EVP_MD_meth_get_ctrl(const EVP_MD *md))(EVP_MD_CTX *ctx, int cmd,
54                                                      int p1, void *p2);
55

DESCRIPTION

57       The EVP_MD type is a structure for digest method implementation.  It
58       can also have associated public/private key signing and verifying
59       routines.
60
61       EVP_MD_meth_new() creates a new EVP_MD structure.
62
63       EVP_MD_meth_dup() creates a copy of md.
64
65       EVP_MD_meth_free() destroys a EVP_MD structure.
66
67       EVP_MD_meth_set_input_blocksize() sets the internal input block size
68       for the method md to blocksize bytes.
69
70       EVP_MD_meth_set_result_size() sets the size of the result that the
71       digest method in md is expected to produce to resultsize bytes.
72
73       The digest method may have its own private data, which OpenSSL will
74       allocate for it.  EVP_MD_meth_set_app_datasize() should be used to set
75       the size for it to datasize.
76
77       EVP_MD_meth_set_flags() sets the flags to describe optional behaviours
78       in the particular md.  Several flags can be or'd together.  The
79       available flags are:
80
81       EVP_MD_FLAG_ONESHOT
82           This digest method can only handles one block of input.
83
84       EVP_MD_FLAG_DIGALGID_NULL
85           When setting up a DigestAlgorithmIdentifier, this flag will have
86           the parameter set to NULL by default.  Use this for PKCS#1.  Note:
87           if combined with EVP_MD_FLAG_DIGALGID_ABSENT, the latter will
88           override.
89
90       EVP_MD_FLAG_DIGALGID_ABSENT
91           When setting up a DigestAlgorithmIdentifier, this flag will have
92           the parameter be left absent by default.  Note: if combined with
93           EVP_MD_FLAG_DIGALGID_NULL, the latter will be overridden.
94
95       EVP_MD_FLAG_DIGALGID_CUSTOM
96           Custom DigestAlgorithmIdentifier handling via ctrl, with
97           EVP_MD_FLAG_DIGALGID_ABSENT as default.  Note: if combined with
98           EVP_MD_FLAG_DIGALGID_NULL, the latter will be overridden.
99           Currently unused.
100
101       EVP_MD_meth_set_init() sets the digest init function for md.  The
102       digest init function is called by EVP_DigestInit(),
103       EVP_DigestInit_ex(), EVP_SignInit, EVP_SignInit_ex(), EVP_VerifyInit()
104       and EVP_VerifyInit_ex().
105
106       EVP_MD_meth_set_update() sets the digest update function for md.  The
107       digest update function is called by EVP_DigestUpdate(),
108       EVP_SignUpdate().
109
110       EVP_MD_meth_set_final() sets the digest final function for md.  The
111       digest final function is called by EVP_DigestFinal(),
112       EVP_DigestFinal_ex(), EVP_SignFinal() and EVP_VerifyFinal().
113
114       EVP_MD_meth_set_copy() sets the function for md to do extra
115       computations after the method's private data structure has been copied
116       from one EVP_MD_CTX to another.  If all that's needed is to copy the
117       data, there is no need for this copy function.  Note that the copy
118       function is passed two EVP_MD_CTX *, the private data structure is then
119       available with EVP_MD_CTX_md_data().  This copy function is called by
120       EVP_MD_CTX_copy() and EVP_MD_CTX_copy_ex().
121
122       EVP_MD_meth_set_cleanup() sets the function for md to do extra cleanup
123       before the method's private data structure is cleaned out and freed.
124       Note that the cleanup function is passed a EVP_MD_CTX *, the private
125       data structure is then available with EVP_MD_CTX_md_data().  This
126       cleanup function is called by EVP_MD_CTX_reset() and EVP_MD_CTX_free().
127
128       EVP_MD_meth_set_ctrl() sets the control function for md.
129
130       EVP_MD_meth_get_input_blocksize(), EVP_MD_meth_get_result_size(),
131       EVP_MD_meth_get_app_datasize(), EVP_MD_meth_get_flags(),
132       EVP_MD_meth_get_init(), EVP_MD_meth_get_update(),
133       EVP_MD_meth_get_final(), EVP_MD_meth_get_copy(),
134       EVP_MD_meth_get_cleanup() and EVP_MD_meth_get_ctrl() are all used to
135       retrieve the method data given with the EVP_MD_meth_set_*() functions
136       above.
137

RETURN VALUES

139       EVP_MD_meth_new() and EVP_MD_meth_dup() return a pointer to a newly
140       created EVP_MD, or NULL on failure.  All EVP_MD_meth_set_*() functions
141       return 1.  EVP_MD_get_input_blocksize(), EVP_MD_meth_get_result_size(),
142       EVP_MD_meth_get_app_datasize() and EVP_MD_meth_get_flags() return the
143       indicated sizes or flags.  All other EVP_CIPHER_meth_get_*() functions
144       return pointers to their respective md function.
145

SEE ALSO

147       EVP_DigestInit(3), EVP_SignInit(3), EVP_VerifyInit(3)
148

HISTORY

150       The EVP_MD structure was openly available in OpenSSL before version
151       1.1.  The functions described here were added in OpenSSL 1.1.
152
154       Copyright 2015-2017 The OpenSSL Project Authors. All Rights Reserved.
155
156       Licensed under the OpenSSL license (the "License").  You may not use
157       this file except in compliance with the License.  You can obtain a copy
158       in the file LICENSE in the source distribution or at
159       <https://www.openssl.org/source/license.html>.
160
161
162
1631.1.1d                            2019-10-03                EVP_MD_METH_NEW(3)
Impressum