1EVP_CIPHER_METH_NEW(3ossl)          OpenSSL         EVP_CIPHER_METH_NEW(3ossl)
2
3
4

NAME

6       EVP_CIPHER_meth_new, EVP_CIPHER_meth_dup, EVP_CIPHER_meth_free,
7       EVP_CIPHER_meth_set_iv_length, EVP_CIPHER_meth_set_flags,
8       EVP_CIPHER_meth_set_impl_ctx_size, EVP_CIPHER_meth_set_init,
9       EVP_CIPHER_meth_set_do_cipher, EVP_CIPHER_meth_set_cleanup,
10       EVP_CIPHER_meth_set_set_asn1_params,
11       EVP_CIPHER_meth_set_get_asn1_params, EVP_CIPHER_meth_set_ctrl,
12       EVP_CIPHER_meth_get_init, EVP_CIPHER_meth_get_do_cipher,
13       EVP_CIPHER_meth_get_cleanup, EVP_CIPHER_meth_get_set_asn1_params,
14       EVP_CIPHER_meth_get_get_asn1_params, EVP_CIPHER_meth_get_ctrl -
15       Routines to build up EVP_CIPHER methods
16

SYNOPSIS

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_CIPHER *EVP_CIPHER_meth_new(int cipher_type, int block_size, int key_len);
25        EVP_CIPHER *EVP_CIPHER_meth_dup(const EVP_CIPHER *cipher);
26        void EVP_CIPHER_meth_free(EVP_CIPHER *cipher);
27
28        int EVP_CIPHER_meth_set_iv_length(EVP_CIPHER *cipher, int iv_len);
29        int EVP_CIPHER_meth_set_flags(EVP_CIPHER *cipher, unsigned long flags);
30        int EVP_CIPHER_meth_set_impl_ctx_size(EVP_CIPHER *cipher, int ctx_size);
31        int EVP_CIPHER_meth_set_init(EVP_CIPHER *cipher,
32                                     int (*init)(EVP_CIPHER_CTX *ctx,
33                                                 const unsigned char *key,
34                                                 const unsigned char *iv,
35                                                 int enc));
36        int EVP_CIPHER_meth_set_do_cipher(EVP_CIPHER *cipher,
37                                          int (*do_cipher)(EVP_CIPHER_CTX *ctx,
38                                                           unsigned char *out,
39                                                           const unsigned char *in,
40                                                           size_t inl));
41        int EVP_CIPHER_meth_set_cleanup(EVP_CIPHER *cipher,
42                                        int (*cleanup)(EVP_CIPHER_CTX *));
43        int EVP_CIPHER_meth_set_set_asn1_params(EVP_CIPHER *cipher,
44                                                int (*set_asn1_parameters)(EVP_CIPHER_CTX *,
45                                                                           ASN1_TYPE *));
46        int EVP_CIPHER_meth_set_get_asn1_params(EVP_CIPHER *cipher,
47                                                int (*get_asn1_parameters)(EVP_CIPHER_CTX *,
48                                                                           ASN1_TYPE *));
49        int EVP_CIPHER_meth_set_ctrl(EVP_CIPHER *cipher,
50                                     int (*ctrl)(EVP_CIPHER_CTX *, int type,
51                                                 int arg, void *ptr));
52
53        int (*EVP_CIPHER_meth_get_init(const EVP_CIPHER *cipher))(EVP_CIPHER_CTX *ctx,
54                                                                  const unsigned char *key,
55                                                                  const unsigned char *iv,
56                                                                  int enc);
57        int (*EVP_CIPHER_meth_get_do_cipher(const EVP_CIPHER *cipher))(EVP_CIPHER_CTX *ctx,
58                                                                       unsigned char *out,
59                                                                       const unsigned char *in,
60                                                                       size_t inl);
61        int (*EVP_CIPHER_meth_get_cleanup(const EVP_CIPHER *cipher))(EVP_CIPHER_CTX *);
62        int (*EVP_CIPHER_meth_get_set_asn1_params(const EVP_CIPHER *cipher))(EVP_CIPHER_CTX *,
63                                                                             ASN1_TYPE *);
64        int (*EVP_CIPHER_meth_get_get_asn1_params(const EVP_CIPHER *cipher))(EVP_CIPHER_CTX *,
65                                                                             ASN1_TYPE *);
66        int (*EVP_CIPHER_meth_get_ctrl(const EVP_CIPHER *cipher))(EVP_CIPHER_CTX *,
67                                                                  int type, int arg,
68                                                                  void *ptr);
69

DESCRIPTION

71       All of the functions described on this page are deprecated.
72       Applications should instead use the OSSL_PROVIDER APIs.
73
74       The EVP_CIPHER type is a structure for symmetric cipher method
75       implementation.
76
77       EVP_CIPHER_meth_new() creates a new EVP_CIPHER structure.
78
79       EVP_CIPHER_meth_dup() creates a copy of cipher.
80
81       EVP_CIPHER_meth_free() destroys a EVP_CIPHER structure.
82
83       EVP_CIPHER_meth_set_iv_length() sets the length of the IV.  This is
84       only needed when the implemented cipher mode requires it.
85
86       EVP_CIPHER_meth_set_flags() sets the flags to describe optional
87       behaviours in the particular cipher.  With the exception of cipher
88       modes, of which only one may be present, several flags can be or'd
89       together.  The available flags are:
90
91       EVP_CIPH_STREAM_CIPHER, EVP_CIPH_ECB_MODE EVP_CIPH_CBC_MODE,
92       EVP_CIPH_CFB_MODE, EVP_CIPH_OFB_MODE, EVP_CIPH_CTR_MODE,
93       EVP_CIPH_GCM_MODE, EVP_CIPH_CCM_MODE, EVP_CIPH_XTS_MODE,
94       EVP_CIPH_WRAP_MODE, EVP_CIPH_OCB_MODE, EVP_CIPH_SIV_MODE
95           The cipher mode.
96
97       EVP_CIPH_VARIABLE_LENGTH
98           This cipher is of variable length.
99
100       EVP_CIPH_CUSTOM_IV
101           Storing and initialising the IV is left entirely to the
102           implementation.
103
104       EVP_CIPH_ALWAYS_CALL_INIT
105           Set this if the implementation's init() function should be called
106           even if key is NULL.
107
108       EVP_CIPH_CTRL_INIT
109           Set this to have the implementation's ctrl() function called with
110           command code EVP_CTRL_INIT early in its setup.
111
112       EVP_CIPH_CUSTOM_KEY_LENGTH
113           Checking and setting the key length after creating the EVP_CIPHER
114           is left to the implementation.  Whenever someone uses
115           EVP_CIPHER_CTX_set_key_length() on a EVP_CIPHER with this flag set,
116           the implementation's ctrl() function will be called with the
117           control code EVP_CTRL_SET_KEY_LENGTH and the key length in arg.
118
119       EVP_CIPH_NO_PADDING
120           Don't use standard block padding.
121
122       EVP_CIPH_RAND_KEY
123           Making a key with random content is left to the implementation.
124           This is done by calling the implementation's ctrl() function with
125           the control code EVP_CTRL_RAND_KEY and the pointer to the key
126           memory storage in ptr.
127
128       EVP_CIPH_CUSTOM_COPY
129           Set this to have the implementation's ctrl() function called with
130           command code EVP_CTRL_COPY at the end of EVP_CIPHER_CTX_copy().
131           The intended use is for further things to deal with after the
132           implementation specific data block has been copied.  The
133           destination EVP_CIPHER_CTX is passed to the control with the ptr
134           parameter.  The implementation specific data block is reached with
135           EVP_CIPHER_CTX_get_cipher_data().
136
137       EVP_CIPH_FLAG_DEFAULT_ASN1
138           Use the default EVP routines to pass IV to and from ASN.1.
139
140       EVP_CIPH_FLAG_LENGTH_BITS
141           Signals that the length of the input buffer for encryption /
142           decryption is to be understood as the number of bits instead of
143           bytes for this implementation.  This is only useful for CFB1
144           ciphers.
145
146       EVP_CIPH_FLAG_CTS
147           Indicates that the cipher uses ciphertext stealing. This is
148           currently used to indicate that the cipher is a one shot that only
149           allows a single call to EVP_CipherUpdate().
150
151       EVP_CIPH_FLAG_CUSTOM_CIPHER
152           This indicates that the implementation takes care of everything,
153           including padding, buffering and finalization.  The EVP routines
154           will simply give them control and do nothing more.
155
156       EVP_CIPH_FLAG_AEAD_CIPHER
157           This indicates that this is an AEAD cipher implementation.
158
159       EVP_CIPH_FLAG_TLS1_1_MULTIBLOCK
160           Allow interleaving of crypto blocks, a particular optimization only
161           applicable to certain TLS ciphers.
162
163       EVP_CIPHER_meth_set_impl_ctx_size() sets the size of the EVP_CIPHER's
164       implementation context so that it can be automatically allocated.
165
166       EVP_CIPHER_meth_set_init() sets the cipher init function for cipher.
167       The cipher init function is called by EVP_CipherInit(),
168       EVP_CipherInit_ex(), EVP_EncryptInit(), EVP_EncryptInit_ex(),
169       EVP_DecryptInit(), EVP_DecryptInit_ex().
170
171       EVP_CIPHER_meth_set_do_cipher() sets the cipher function for cipher.
172       The cipher function is called by EVP_CipherUpdate(),
173       EVP_EncryptUpdate(), EVP_DecryptUpdate(), EVP_CipherFinal(),
174       EVP_EncryptFinal(), EVP_EncryptFinal_ex(), EVP_DecryptFinal() and
175       EVP_DecryptFinal_ex().
176
177       EVP_CIPHER_meth_set_cleanup() sets the function for cipher to do extra
178       cleanup before the method's private data structure is cleaned out and
179       freed.  Note that the cleanup function is passed a EVP_CIPHER_CTX *,
180       the private data structure is then available with
181       EVP_CIPHER_CTX_get_cipher_data().  This cleanup function is called by
182       EVP_CIPHER_CTX_reset() and EVP_CIPHER_CTX_free().
183
184       EVP_CIPHER_meth_set_set_asn1_params() sets the function for cipher to
185       set the AlgorithmIdentifier "parameter" based on the passed cipher.
186       This function is called by EVP_CIPHER_param_to_asn1().
187       EVP_CIPHER_meth_set_get_asn1_params() sets the function for cipher that
188       sets the cipher parameters based on an ASN.1 AlgorithmIdentifier
189       "parameter".  Both these functions are needed when there is a need for
190       custom data (more or other than the cipher IV).  They are called by
191       EVP_CIPHER_param_to_asn1() and EVP_CIPHER_asn1_to_param() respectively
192       if defined.
193
194       EVP_CIPHER_meth_set_ctrl() sets the control function for cipher.
195
196       EVP_CIPHER_meth_get_init(), EVP_CIPHER_meth_get_do_cipher(),
197       EVP_CIPHER_meth_get_cleanup(), EVP_CIPHER_meth_get_set_asn1_params(),
198       EVP_CIPHER_meth_get_get_asn1_params() and EVP_CIPHER_meth_get_ctrl()
199       are all used to retrieve the method data given with the
200       EVP_CIPHER_meth_set_*() functions above.
201

RETURN VALUES

203       EVP_CIPHER_meth_new() and EVP_CIPHER_meth_dup() return a pointer to a
204       newly created EVP_CIPHER, or NULL on failure.  All
205       EVP_CIPHER_meth_set_*() functions return 1.  All
206       EVP_CIPHER_meth_get_*() functions return pointers to their respective
207       cipher function.
208

SEE ALSO

210       EVP_EncryptInit(3)
211

HISTORY

213       All of these functions were deprecated in OpenSSL 3.0.
214
215       The functions described here were added in OpenSSL 1.1.0.  The
216       EVP_CIPHER structure created with these functions became reference
217       counted in OpenSSL 3.0.
218
220       Copyright 2016-2021 The OpenSSL Project Authors. All Rights Reserved.
221
222       Licensed under the Apache License 2.0 (the "License").  You may not use
223       this file except in compliance with the License.  You can obtain a copy
224       in the file LICENSE in the source distribution or at
225       <https://www.openssl.org/source/license.html>.
226
227
228
2293.0.5                             2022-11-01        EVP_CIPHER_METH_NEW(3ossl)
Impressum