Remove legacy fields from the EVP_CIPHER structure

We remove legacy fields that are no longer used for anything from the
EVP_CIPHER structure.

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Neil Horman <nhorman@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/29446)
This commit is contained in:
Matt Caswell
2025-12-18 16:46:00 +00:00
parent f9bdb61bbf
commit 6215430101
19 changed files with 66 additions and 319 deletions

View File

@@ -31,14 +31,12 @@
#define BLOCK_CIPHER_generic(nid, keylen, blocksize, ivlen, nmode, mode, MODE, flags) \
static const EVP_CIPHER aes_##keylen##_##mode = { \
nid##_##keylen##_##nmode, blocksize, keylen / 8, ivlen, \
nid##_##keylen##_##nmode, \
blocksize, \
keylen / 8, \
ivlen, \
flags | EVP_CIPH_##MODE##_MODE, \
EVP_ORIG_GLOBAL, \
NULL, \
NULL, \
NULL, \
0, \
NULL, NULL, NULL, NULL \
}; \
const EVP_CIPHER *EVP_aes_##keylen##_##mode(void) \
{ \
@@ -47,16 +45,12 @@
#define BLOCK_CIPHER_custom(nid, keylen, blocksize, ivlen, mode, MODE, flags) \
static const EVP_CIPHER aes_##keylen##_##mode = { \
nid##_##keylen##_##mode, blocksize, \
nid##_##keylen##_##mode, \
blocksize, \
(EVP_CIPH_##MODE##_MODE == EVP_CIPH_XTS_MODE || EVP_CIPH_##MODE##_MODE == EVP_CIPH_SIV_MODE ? 2 : 1) * keylen / 8, \
ivlen, \
flags | EVP_CIPH_##MODE##_MODE, \
EVP_ORIG_GLOBAL, \
NULL, \
NULL, \
NULL, \
0, \
NULL, NULL, NULL, NULL \
}; \
const EVP_CIPHER *EVP_aes_##keylen##_##mode(void) \
{ \
@@ -108,11 +102,7 @@ BLOCK_CIPHER_custom(NID_aes, 256, 1, 12, ccm, CCM,
static const EVP_CIPHER aes_128_wrap = {
NID_id_aes128_wrap,
8, 16, 8, WRAP_FLAGS, EVP_ORIG_GLOBAL,
NULL, NULL,
NULL,
0,
NULL, NULL, NULL, NULL
8, 16, 8, WRAP_FLAGS, EVP_ORIG_GLOBAL
};
const EVP_CIPHER *EVP_aes_128_wrap(void)
@@ -122,11 +112,7 @@ const EVP_CIPHER *EVP_aes_128_wrap(void)
static const EVP_CIPHER aes_192_wrap = {
NID_id_aes192_wrap,
8, 24, 8, WRAP_FLAGS, EVP_ORIG_GLOBAL,
NULL, NULL,
NULL,
0,
NULL, NULL, NULL, NULL
8, 24, 8, WRAP_FLAGS, EVP_ORIG_GLOBAL
};
const EVP_CIPHER *EVP_aes_192_wrap(void)
@@ -136,11 +122,7 @@ const EVP_CIPHER *EVP_aes_192_wrap(void)
static const EVP_CIPHER aes_256_wrap = {
NID_id_aes256_wrap,
8, 32, 8, WRAP_FLAGS, EVP_ORIG_GLOBAL,
NULL, NULL,
NULL,
0,
NULL, NULL, NULL, NULL
8, 32, 8, WRAP_FLAGS, EVP_ORIG_GLOBAL
};
const EVP_CIPHER *EVP_aes_256_wrap(void)
@@ -150,11 +132,7 @@ const EVP_CIPHER *EVP_aes_256_wrap(void)
static const EVP_CIPHER aes_128_wrap_pad = {
NID_id_aes128_wrap_pad,
8, 16, 4, WRAP_FLAGS, EVP_ORIG_GLOBAL,
NULL, NULL,
NULL,
0,
NULL, NULL, NULL, NULL
8, 16, 4, WRAP_FLAGS, EVP_ORIG_GLOBAL
};
const EVP_CIPHER *EVP_aes_128_wrap_pad(void)
@@ -164,11 +142,7 @@ const EVP_CIPHER *EVP_aes_128_wrap_pad(void)
static const EVP_CIPHER aes_192_wrap_pad = {
NID_id_aes192_wrap_pad,
8, 24, 4, WRAP_FLAGS, EVP_ORIG_GLOBAL,
NULL, NULL,
NULL,
0,
NULL, NULL, NULL, NULL
8, 24, 4, WRAP_FLAGS, EVP_ORIG_GLOBAL
};
const EVP_CIPHER *EVP_aes_192_wrap_pad(void)
@@ -178,11 +152,7 @@ const EVP_CIPHER *EVP_aes_192_wrap_pad(void)
static const EVP_CIPHER aes_256_wrap_pad = {
NID_id_aes256_wrap_pad,
8, 32, 4, WRAP_FLAGS, EVP_ORIG_GLOBAL,
NULL, NULL,
NULL,
0,
NULL, NULL, NULL, NULL
8, 32, 4, WRAP_FLAGS, EVP_ORIG_GLOBAL
};
const EVP_CIPHER *EVP_aes_256_wrap_pad(void)

View File

@@ -33,15 +33,7 @@ static const EVP_CIPHER aesni_128_cbc_hmac_sha1_cipher = {
#endif
AES_BLOCK_SIZE, 16, AES_BLOCK_SIZE,
EVP_CIPH_CBC_MODE | EVP_CIPH_FLAG_DEFAULT_ASN1 | EVP_CIPH_FLAG_AEAD_CIPHER | EVP_CIPH_FLAG_TLS1_1_MULTIBLOCK,
EVP_ORIG_GLOBAL,
NULL,
NULL,
NULL,
0,
NULL,
NULL,
NULL,
NULL
EVP_ORIG_GLOBAL
};
static const EVP_CIPHER aesni_256_cbc_hmac_sha1_cipher = {
@@ -52,15 +44,7 @@ static const EVP_CIPHER aesni_256_cbc_hmac_sha1_cipher = {
#endif
AES_BLOCK_SIZE, 32, AES_BLOCK_SIZE,
EVP_CIPH_CBC_MODE | EVP_CIPH_FLAG_DEFAULT_ASN1 | EVP_CIPH_FLAG_AEAD_CIPHER | EVP_CIPH_FLAG_TLS1_1_MULTIBLOCK,
EVP_ORIG_GLOBAL,
NULL,
NULL,
NULL,
0,
NULL,
NULL,
NULL,
NULL
EVP_ORIG_GLOBAL
};
const EVP_CIPHER *EVP_aes_128_cbc_hmac_sha1(void)

View File

@@ -44,15 +44,7 @@ static const EVP_CIPHER aesni_128_cbc_hmac_sha256_cipher = {
#endif
AES_BLOCK_SIZE, 16, AES_BLOCK_SIZE,
EVP_CIPH_CBC_MODE | EVP_CIPH_FLAG_DEFAULT_ASN1 | EVP_CIPH_FLAG_AEAD_CIPHER | EVP_CIPH_FLAG_TLS1_1_MULTIBLOCK,
EVP_ORIG_GLOBAL,
NULL,
NULL,
NULL,
0,
NULL,
NULL,
NULL,
NULL
EVP_ORIG_GLOBAL
};
static const EVP_CIPHER aesni_256_cbc_hmac_sha256_cipher = {
@@ -63,15 +55,7 @@ static const EVP_CIPHER aesni_256_cbc_hmac_sha256_cipher = {
#endif
AES_BLOCK_SIZE, 32, AES_BLOCK_SIZE,
EVP_CIPH_CBC_MODE | EVP_CIPH_FLAG_DEFAULT_ASN1 | EVP_CIPH_FLAG_AEAD_CIPHER | EVP_CIPH_FLAG_TLS1_1_MULTIBLOCK,
EVP_ORIG_GLOBAL,
NULL,
NULL,
NULL,
0,
NULL,
NULL,
NULL,
NULL
EVP_ORIG_GLOBAL
};
const EVP_CIPHER *EVP_aes_128_cbc_hmac_sha256(void)

View File

@@ -22,22 +22,13 @@
IMPLEMENT_BLOCK_CIPHER(aria_128, ks, aria, EVP_ARIA_KEY,
NID_aria_128, 16, 16, 16, 128,
0, NULL, NULL,
NULL,
NULL,
NULL)
0)
IMPLEMENT_BLOCK_CIPHER(aria_192, ks, aria, EVP_ARIA_KEY,
NID_aria_192, 16, 24, 16, 128,
0, NULL, NULL,
NULL,
NULL,
NULL)
0)
IMPLEMENT_BLOCK_CIPHER(aria_256, ks, aria, EVP_ARIA_KEY,
NID_aria_256, 16, 32, 16, 128,
0, NULL, NULL,
NULL,
NULL,
NULL)
0)
#define IMPLEMENT_ARIA_CFBR(ksize, cbits) \
IMPLEMENT_CFBR(aria, aria, EVP_ARIA_KEY, ks, ksize, cbits, 16, 0)
@@ -52,12 +43,7 @@ IMPLEMENT_ARIA_CFBR(256, 8)
static const EVP_CIPHER aria_##keylen##_##mode = { \
nid##_##keylen##_##nmode, blocksize, keylen / 8, ivlen, \
flags | EVP_CIPH_##MODE##_MODE, \
EVP_ORIG_GLOBAL, \
NULL, \
NULL, \
NULL, \
0, \
NULL, NULL, NULL, NULL \
EVP_ORIG_GLOBAL \
}; \
const EVP_CIPHER *EVP_aria_##keylen##_##mode(void) \
{ \
@@ -79,12 +65,7 @@ BLOCK_CIPHER_generic(NID_aria, 256, 1, 16, ctr, ctr, CTR, 0)
NID_aria_##keylen##_##mode, \
1, keylen / 8, 12, \
ARIA_AUTH_FLAGS | EVP_CIPH_##MODE##_MODE, \
EVP_ORIG_GLOBAL, \
NULL, \
NULL, \
NULL, \
0, \
NULL, NULL, NULL, NULL \
EVP_ORIG_GLOBAL \
}; \
const EVP_CIPHER *EVP_aria_##keylen##_##mode(void) \
{ \

View File

@@ -17,6 +17,5 @@
#include "evp_local.h"
IMPLEMENT_BLOCK_CIPHER(bf, ks, BF, EVP_BF_KEY, NID_bf, 8, 16, 8, 64,
EVP_CIPH_VARIABLE_LENGTH, NULL, NULL,
NULL, NULL, NULL)
EVP_CIPH_VARIABLE_LENGTH)
#endif

View File

@@ -21,14 +21,12 @@
#define BLOCK_CIPHER_generic(nid, keylen, blocksize, ivlen, nmode, mode, MODE, flags) \
static const EVP_CIPHER camellia_##keylen##_##mode = { \
nid##_##keylen##_##nmode, blocksize, keylen / 8, ivlen, \
nid##_##keylen##_##nmode, \
blocksize, \
keylen / 8, \
ivlen, \
flags | EVP_CIPH_##MODE##_MODE, \
EVP_ORIG_GLOBAL, \
NULL, \
NULL, \
NULL, \
0, \
NULL, NULL, NULL, NULL \
}; \
const EVP_CIPHER *EVP_camellia_##keylen##_##mode(void) \
{ \

View File

@@ -19,7 +19,6 @@
IMPLEMENT_BLOCK_CIPHER(cast5, ks, CAST, EVP_CAST_KEY,
NID_cast5, 8, CAST_KEY_LENGTH, 8, 64,
EVP_CIPH_VARIABLE_LENGTH, NULL, NULL,
NULL, NULL, NULL)
EVP_CIPH_VARIABLE_LENGTH)
#endif

View File

@@ -25,15 +25,7 @@ static const EVP_CIPHER chacha20 = {
CHACHA_KEY_SIZE, /* key_len */
CHACHA_CTR_SIZE, /* iv_len, 128-bit counter in the context */
EVP_CIPH_CUSTOM_IV | EVP_CIPH_ALWAYS_CALL_INIT,
EVP_ORIG_GLOBAL,
NULL,
NULL,
NULL,
0,
NULL,
NULL,
NULL,
NULL
EVP_ORIG_GLOBAL
};
const EVP_CIPHER *EVP_chacha20(void)
@@ -49,15 +41,7 @@ static const EVP_CIPHER chacha20_poly1305 = {
CHACHA_KEY_SIZE, /* key_len */
12, /* iv_len, 96-bit nonce in the context */
EVP_CIPH_FLAG_AEAD_CIPHER | EVP_CIPH_CUSTOM_IV | EVP_CIPH_ALWAYS_CALL_INIT | EVP_CIPH_CTRL_INIT | EVP_CIPH_CUSTOM_COPY | EVP_CIPH_FLAG_CUSTOM_CIPHER | EVP_CIPH_CUSTOM_IV_LENGTH,
EVP_ORIG_GLOBAL,
NULL,
NULL,
NULL,
0,
NULL, /* set_asn1_parameters */
NULL, /* get_asn1_parameters */
NULL,
NULL /* app_data */
EVP_ORIG_GLOBAL
};
const EVP_CIPHER *EVP_chacha20_poly1305(void)

View File

@@ -17,15 +17,12 @@
#include "evp_local.h"
BLOCK_CIPHER_defs(des, EVP_DES_KEY, NID_des, 8, 8, 8, 64,
EVP_CIPH_RAND_KEY, NULL, NULL,
NULL, NULL, NULL)
EVP_CIPH_RAND_KEY)
BLOCK_CIPHER_def_cfb(des, EVP_DES_KEY, NID_des, 8, 8, 1,
EVP_CIPH_RAND_KEY, NULL, NULL,
NULL, NULL, NULL)
EVP_CIPH_RAND_KEY)
BLOCK_CIPHER_def_cfb(des, EVP_DES_KEY, NID_des, 8, 8, 8,
EVP_CIPH_RAND_KEY, NULL, NULL,
NULL, NULL, NULL)
EVP_CIPH_RAND_KEY)
#endif

View File

@@ -17,20 +17,16 @@
#include "evp_local.h"
BLOCK_CIPHER_defs(des_ede, DES_EDE_KEY, NID_des_ede, 8, 16, 8, 64,
EVP_CIPH_RAND_KEY | EVP_CIPH_FLAG_DEFAULT_ASN1,
NULL, NULL, NULL, NULL, NULL)
EVP_CIPH_RAND_KEY | EVP_CIPH_FLAG_DEFAULT_ASN1)
BLOCK_CIPHER_defs(des_ede3, DES_EDE_KEY, NID_des_ede3, 8, 24, 8, 64,
EVP_CIPH_RAND_KEY | EVP_CIPH_FLAG_DEFAULT_ASN1,
NULL, NULL, NULL, NULL, NULL)
EVP_CIPH_RAND_KEY | EVP_CIPH_FLAG_DEFAULT_ASN1)
BLOCK_CIPHER_def_cfb(des_ede3, DES_EDE_KEY, NID_des_ede3, 24, 8, 1,
EVP_CIPH_RAND_KEY | EVP_CIPH_FLAG_DEFAULT_ASN1,
NULL, NULL, NULL, NULL, des3_NULLctrl)
EVP_CIPH_RAND_KEY | EVP_CIPH_FLAG_DEFAULT_ASN1)
BLOCK_CIPHER_def_cfb(des_ede3, DES_EDE_KEY, NID_des_ede3, 24, 8, 8,
EVP_CIPH_RAND_KEY | EVP_CIPH_FLAG_DEFAULT_ASN1,
NULL, NULL, NULL, NULL, NULL)
EVP_CIPH_RAND_KEY | EVP_CIPH_FLAG_DEFAULT_ASN1)
const EVP_CIPHER *EVP_des_ede(void)
{
@@ -47,11 +43,7 @@ static const EVP_CIPHER des3_wrap = {
8, 24, 0,
EVP_CIPH_WRAP_MODE | EVP_CIPH_CUSTOM_IV | EVP_CIPH_FLAG_CUSTOM_CIPHER
| EVP_CIPH_FLAG_DEFAULT_ASN1,
EVP_ORIG_GLOBAL,
NULL, NULL,
NULL,
0,
NULL, NULL, NULL, NULL
EVP_ORIG_GLOBAL
};
const EVP_CIPHER *EVP_des_ede3_wrap(void)

View File

@@ -18,7 +18,6 @@
#include "evp_local.h"
BLOCK_CIPHER_defs(idea, IDEA_KEY_SCHEDULE, NID_idea, 8, 16, 8, 64,
0, NULL, NULL,
NULL, NULL, NULL)
0)
#endif

View File

@@ -16,15 +16,7 @@
static const EVP_CIPHER n_cipher = {
NID_undef,
1, 0, 0, 0,
EVP_ORIG_GLOBAL,
NULL,
NULL,
NULL,
0,
NULL,
NULL,
NULL,
NULL
EVP_ORIG_GLOBAL
};
const EVP_CIPHER *EVP_enc_null(void)

View File

@@ -20,39 +20,20 @@
IMPLEMENT_BLOCK_CIPHER(rc2, ks, RC2, EVP_RC2_KEY, NID_rc2,
8,
RC2_KEY_LENGTH, 8, 64,
EVP_CIPH_VARIABLE_LENGTH | EVP_CIPH_CTRL_INIT,
NULL, NULL,
NULL, NULL,
NULL)
EVP_CIPH_VARIABLE_LENGTH | EVP_CIPH_CTRL_INIT)
static const EVP_CIPHER r2_64_cbc_cipher = {
NID_rc2_64_cbc,
8, 8 /* 64 bit */, 8,
EVP_CIPH_CBC_MODE | EVP_CIPH_VARIABLE_LENGTH | EVP_CIPH_CTRL_INIT,
EVP_ORIG_GLOBAL,
NULL,
NULL,
NULL,
0,
NULL,
NULL,
NULL,
NULL
EVP_ORIG_GLOBAL
};
static const EVP_CIPHER r2_40_cbc_cipher = {
NID_rc2_40_cbc,
8, 5 /* 40 bit */, 8,
EVP_CIPH_CBC_MODE | EVP_CIPH_VARIABLE_LENGTH | EVP_CIPH_CTRL_INIT,
EVP_ORIG_GLOBAL,
NULL,
NULL,
NULL,
0,
NULL,
NULL,
NULL,
NULL
EVP_ORIG_GLOBAL
};
const EVP_CIPHER *EVP_rc2_64_cbc(void)

View File

@@ -7,12 +7,6 @@
* https://www.openssl.org/source/license.html
*/
/*
* RC4 low level APIs are deprecated for public use, but still ok for internal
* use.
*/
#include "internal/deprecated.h"
#include <stdio.h>
#include "internal/cryptlib.h"
@@ -24,44 +18,18 @@
#include "crypto/evp.h"
typedef struct {
RC4_KEY ks; /* working key */
} EVP_RC4_KEY;
#define data(ctx) ((EVP_RC4_KEY *)EVP_CIPHER_CTX_get_cipher_data(ctx))
static int rc4_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
const unsigned char *iv, int enc);
static int rc4_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
const unsigned char *in, size_t inl);
static const EVP_CIPHER r4_cipher = {
NID_rc4,
1, EVP_RC4_KEY_SIZE, 0,
EVP_CIPH_VARIABLE_LENGTH,
EVP_ORIG_GLOBAL,
rc4_init_key,
rc4_cipher,
NULL,
sizeof(EVP_RC4_KEY),
NULL,
NULL,
NULL,
NULL
EVP_ORIG_GLOBAL
};
static const EVP_CIPHER r4_40_cipher = {
NID_rc4_40,
1, 5 /* 40 bit */, 0,
EVP_CIPH_VARIABLE_LENGTH,
EVP_ORIG_GLOBAL,
rc4_init_key,
rc4_cipher,
NULL,
sizeof(EVP_RC4_KEY),
NULL,
NULL,
NULL,
NULL
EVP_ORIG_GLOBAL
};
const EVP_CIPHER *EVP_rc4(void)
@@ -73,22 +41,4 @@ const EVP_CIPHER *EVP_rc4_40(void)
{
return &r4_40_cipher;
}
static int rc4_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
const unsigned char *iv, int enc)
{
int keylen;
if ((keylen = EVP_CIPHER_CTX_get_key_length(ctx)) <= 0)
return 0;
RC4_set_key(&data(ctx)->ks, keylen, key);
return 1;
}
static int rc4_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
const unsigned char *in, size_t inl)
{
RC4(&data(ctx)->ks, inl, in, out);
return 1;
}
#endif

View File

@@ -28,15 +28,7 @@ static const EVP_CIPHER r4_hmac_md5_cipher = {
#endif
1, EVP_RC4_KEY_SIZE, 0,
EVP_CIPH_STREAM_CIPHER | EVP_CIPH_VARIABLE_LENGTH | EVP_CIPH_FLAG_AEAD_CIPHER,
EVP_ORIG_GLOBAL,
NULL,
NULL,
NULL,
0,
NULL,
NULL,
NULL,
NULL
EVP_ORIG_GLOBAL
};
const EVP_CIPHER *EVP_rc4_hmac_md5(void)

View File

@@ -17,5 +17,4 @@
#include "evp_local.h"
IMPLEMENT_BLOCK_CIPHER(seed, ks, SEED, EVP_SEED_KEY, NID_seed,
16, 16, 16, 128, EVP_CIPH_FLAG_DEFAULT_ASN1,
NULL, 0, 0, 0, 0)
16, 16, 16, 128, EVP_CIPH_FLAG_DEFAULT_ASN1)

View File

@@ -24,12 +24,7 @@
static const EVP_CIPHER sm4_##mode = { \
nid##_##nmode, blocksize, 128 / 8, ivlen, \
flags | EVP_CIPH_##MODE##_MODE, \
EVP_ORIG_GLOBAL, \
NULL, \
NULL, \
NULL, \
0, \
NULL, NULL, NULL, NULL \
EVP_ORIG_GLOBAL \
}; \
const EVP_CIPHER *EVP_sm4_##mode(void) \
{ \

View File

@@ -22,15 +22,7 @@ static const EVP_CIPHER d_xcbc_cipher = {
NID_desx_cbc,
8, 24, 8,
EVP_CIPH_CBC_MODE,
EVP_ORIG_GLOBAL,
NULL,
NULL,
NULL,
0,
NULL,
NULL,
NULL,
NULL
EVP_ORIG_GLOBAL
};
const EVP_CIPHER *EVP_desx_cbc(void)

View File

@@ -228,32 +228,11 @@ struct evp_cipher_st {
int key_len;
int iv_len;
/* Legacy structure members */
/* Various flags */
unsigned long flags;
/* How the EVP_CIPHER was created. */
int origin;
/* init key */
int (*init)(EVP_CIPHER_CTX *ctx, const unsigned char *key,
const unsigned char *iv, int enc);
/* encrypt/decrypt data */
int (*do_cipher)(EVP_CIPHER_CTX *ctx, unsigned char *out,
const unsigned char *in, size_t inl);
/* cleanup ctx */
int (*cleanup)(EVP_CIPHER_CTX *);
/* how big ctx->cipher_data needs to be */
int ctx_size;
/* Populate a ASN1_TYPE with parameters */
int (*set_asn1_parameters)(EVP_CIPHER_CTX *, ASN1_TYPE *);
/* Get parameters from a ASN1_TYPE */
int (*get_asn1_parameters)(EVP_CIPHER_CTX *, ASN1_TYPE *);
/* Miscellaneous operations */
int (*ctrl)(EVP_CIPHER_CTX *, int type, int arg, void *ptr);
/* Application data */
void *app_data;
/* New structure members */
/* Above comment to be removed when legacy has gone */
int name_id;
char *type_name;
const char *description;
@@ -284,73 +263,53 @@ struct evp_cipher_st {
#define EVP_MAXCHUNK ((size_t)1 << 30)
#define BLOCK_CIPHER_def1(cname, nmode, mode, MODE, kstruct, nid, block_size, \
key_len, iv_len, flags, init_key, cleanup, \
set_asn1, get_asn1, ctrl) \
key_len, iv_len, flags) \
static const EVP_CIPHER cname##_##mode = { \
nid##_##nmode, block_size, key_len, iv_len, \
flags | EVP_CIPH_##MODE##_MODE, \
EVP_ORIG_GLOBAL, \
NULL, \
NULL, \
NULL, \
0, \
NULL, NULL, \
NULL, \
NULL \
EVP_ORIG_GLOBAL \
}; \
const EVP_CIPHER *EVP_##cname##_##mode(void) { return &cname##_##mode; }
#define BLOCK_CIPHER_def_cbc(cname, kstruct, nid, block_size, key_len, \
iv_len, flags, init_key, cleanup, set_asn1, \
get_asn1, ctrl) \
iv_len, flags) \
BLOCK_CIPHER_def1(cname, cbc, cbc, CBC, kstruct, nid, block_size, key_len, \
iv_len, flags, init_key, cleanup, set_asn1, get_asn1, ctrl)
iv_len, flags)
#define BLOCK_CIPHER_def_cfb(cname, kstruct, nid, key_len, \
iv_len, cbits, flags, init_key, cleanup, \
set_asn1, get_asn1, ctrl) \
iv_len, cbits, flags) \
BLOCK_CIPHER_def1(cname, cfb##cbits, cfb##cbits, CFB, kstruct, nid, 1, \
key_len, iv_len, flags, init_key, cleanup, set_asn1, \
get_asn1, ctrl)
key_len, iv_len, flags)
#define BLOCK_CIPHER_def_ofb(cname, kstruct, nid, key_len, \
iv_len, cbits, flags, init_key, cleanup, \
set_asn1, get_asn1, ctrl) \
iv_len, cbits, flags) \
BLOCK_CIPHER_def1(cname, ofb##cbits, ofb, OFB, kstruct, nid, 1, \
key_len, iv_len, flags, init_key, cleanup, set_asn1, \
get_asn1, ctrl)
key_len, iv_len, flags)
#define BLOCK_CIPHER_def_ecb(cname, kstruct, nid, block_size, key_len, \
flags, init_key, cleanup, set_asn1, \
get_asn1, ctrl) \
flags) \
BLOCK_CIPHER_def1(cname, ecb, ecb, ECB, kstruct, nid, block_size, key_len, \
0, flags, init_key, cleanup, set_asn1, get_asn1, ctrl)
0, flags)
#define BLOCK_CIPHER_defs(cname, kstruct, \
nid, block_size, key_len, iv_len, cbits, flags, \
init_key, cleanup, set_asn1, get_asn1, ctrl) \
BLOCK_CIPHER_def_cbc(cname, kstruct, nid, block_size, key_len, iv_len, flags, \
init_key, cleanup, set_asn1, get_asn1, ctrl) \
nid, block_size, key_len, iv_len, cbits, flags) \
BLOCK_CIPHER_def_cbc(cname, kstruct, nid, block_size, key_len, iv_len, flags) \
BLOCK_CIPHER_def_cfb(cname, kstruct, nid, key_len, iv_len, cbits, \
flags, init_key, cleanup, set_asn1, get_asn1, ctrl) \
flags) \
BLOCK_CIPHER_def_ofb(cname, kstruct, nid, key_len, iv_len, cbits, \
flags, init_key, cleanup, set_asn1, get_asn1, ctrl) \
BLOCK_CIPHER_def_ecb(cname, kstruct, nid, block_size, key_len, flags, \
init_key, cleanup, set_asn1, get_asn1, ctrl)
flags) \
BLOCK_CIPHER_def_ecb(cname, kstruct, nid, block_size, key_len, flags)
#define IMPLEMENT_BLOCK_CIPHER(cname, ksched, cprefix, kstruct, nid, \
block_size, key_len, iv_len, cbits, \
flags, init_key, \
cleanup, set_asn1, get_asn1, ctrl) \
flags) \
BLOCK_CIPHER_defs(cname, kstruct, nid, block_size, key_len, iv_len, \
cbits, flags, init_key, cleanup, set_asn1, \
get_asn1, ctrl)
cbits, flags)
#define IMPLEMENT_CFBR(cipher, cprefix, kstruct, ksched, keysize, cbits, iv_len, fl) \
BLOCK_CIPHER_def_cfb(cipher##_##keysize, kstruct, \
NID_##cipher##_##keysize, keysize / 8, iv_len, cbits, \
(fl) | EVP_CIPH_FLAG_DEFAULT_ASN1, \
cipher##_init_key, NULL, NULL, NULL, NULL)
(fl) | EVP_CIPH_FLAG_DEFAULT_ASN1)
typedef struct {
unsigned char iv[EVP_MAX_IV_LENGTH];