summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRich Salz <rsalz@akamai.com>2021-02-16 17:51:56 -0500
committerRichard Levitte <levitte@openssl.org>2021-04-18 10:03:07 +0200
commitf6c95e46c03025b2694241e1ad785d8bd3ac083b (patch)
tree5dcfc46ad06713bc6b581f6bed3ce3e26b0c5970
parent543e740b95e303790f8fe6ec59458b4ecdcfb56c (diff)
Add "origin" field to EVP_CIPHER, EVP_MD
Add a "where did this EVP_{CIPHER,MD} come from" flag: global, via fetch, or via EVP_{CIPHER,MD}_meth_new. Update EVP_{CIPHER,MD}_free to handle all three origins. The flag is deliberately right before some function pointers, so that compile-time failures (int/pointer) will occur, as opposed to taking a bit in the existing "flags" field. The "global variable" flag is non-zero, so the default case of using OPENSSL_zalloc (for provider ciphers), will do the right thing. Ref-counting is a no-op for Make up_ref no-op for global MD and CIPHER objects Deprecate EVP_MD_CTX_md(). Added EVP_MD_CTX_get0_md() (same semantics as the deprecated function) and EVP_MD_CTX_get1_md(). Likewise, deprecate EVP_CIPHER_CTX_cipher() in favor of EVP_CIPHER_CTX_get0_cipher(), and add EVP_CIPHER_CTX_get1_CIPHER(). Refactor EVP_MD_free() and EVP_MD_meth_free() to call new common evp_md_free_int() function. Refactor EVP_CIPHER_free() and EVP_CIPHER_meth_free() to call new common evp_cipher_free_int() function. Also change some flags tests to explicit test == or != zero. E.g., if (flags & x) --> if ((flags & x) != 0) if (!(flags & x)) --> if ((flags & x) == 0) Only done for those lines where "get0_cipher" calls were made. Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/14193)
-rw-r--r--apps/dgst.c2
-rw-r--r--crypto/asn1/a_sign.c2
-rw-r--r--crypto/asn1/p5_scrypt.c2
-rw-r--r--crypto/cmac/cmac.c2
-rw-r--r--crypto/cms/cms_env.c7
-rw-r--r--crypto/cms/cms_kari.c2
-rw-r--r--crypto/cms/cms_lib.c2
-rw-r--r--crypto/cms/cms_sd.c2
-rw-r--r--crypto/evp/bio_md.c4
-rw-r--r--crypto/evp/bio_ok.c10
-rw-r--r--crypto/evp/cmeth_lib.c6
-rw-r--r--crypto/evp/digest.c9
-rw-r--r--crypto/evp/e_aes.c32
-rw-r--r--crypto/evp/e_aes_cbc_hmac_sha1.c2
-rw-r--r--crypto/evp/e_aes_cbc_hmac_sha256.c2
-rw-r--r--crypto/evp/e_aria.c2
-rw-r--r--crypto/evp/e_camellia.c3
-rw-r--r--crypto/evp/e_chacha20_poly1305.c2
-rw-r--r--crypto/evp/e_des3.c1
-rw-r--r--crypto/evp/e_null.c1
-rw-r--r--crypto/evp/e_rc2.c2
-rw-r--r--crypto/evp/e_rc4.c2
-rw-r--r--crypto/evp/e_rc4_hmac_md5.c1
-rw-r--r--crypto/evp/e_sm4.c1
-rw-r--r--crypto/evp/e_xcbc_d.c1
-rw-r--r--crypto/evp/evp_enc.c19
-rw-r--r--crypto/evp/evp_lib.c58
-rw-r--r--crypto/evp/evp_local.h2
-rw-r--r--crypto/evp/legacy_blake2.c2
-rw-r--r--crypto/evp/legacy_md2.c1
-rw-r--r--crypto/evp/legacy_md4.c1
-rw-r--r--crypto/evp/legacy_md5.c1
-rw-r--r--crypto/evp/legacy_md5_sha1.c1
-rw-r--r--crypto/evp/legacy_mdc2.c1
-rw-r--r--crypto/evp/legacy_ripemd.c1
-rw-r--r--crypto/evp/legacy_sha.c9
-rw-r--r--crypto/evp/legacy_wp.c1
-rw-r--r--crypto/evp/m_null.c1
-rw-r--r--crypto/evp/m_sigver.c2
-rw-r--r--crypto/evp/p5_crpt2.c2
-rw-r--r--crypto/evp/p_sign.c2
-rw-r--r--crypto/evp/p_verify.c2
-rw-r--r--crypto/pkcs12/p12_decr.c6
-rw-r--r--crypto/pkcs7/pk7_doit.c2
-rw-r--r--crypto/sm3/legacy_sm3.c1
-rw-r--r--doc/man3/EVP_DigestInit.pod19
-rw-r--r--doc/man3/EVP_EncryptInit.pod19
-rw-r--r--engines/e_afalg.c2
-rw-r--r--include/crypto/evp.h14
-rw-r--r--include/openssl/evp.h25
-rw-r--r--ssl/record/rec_layer_d1.c5
-rw-r--r--ssl/record/rec_layer_s3.c30
-rw-r--r--ssl/record/ssl3_record.c49
-rw-r--r--ssl/statem/statem_dtls.c2
-rw-r--r--test/evp_extra_test.c6
-rw-r--r--test/evp_fetch_prov_test.c2
-rw-r--r--util/libcrypto.num8
57 files changed, 286 insertions, 112 deletions
diff --git a/apps/dgst.c b/apps/dgst.c
index 1e09e90c84..5ddbef8bcc 100644
--- a/apps/dgst.c
+++ b/apps/dgst.c
@@ -405,7 +405,7 @@ int dgst_main(int argc, char **argv)
if (md == NULL) {
EVP_MD_CTX *tctx;
BIO_get_md_ctx(bmd, &tctx);
- md = EVP_MD_CTX_md(tctx);
+ md = EVP_MD_CTX_get0_md(tctx);
}
if (md != NULL)
md_name = EVP_MD_name(md);
diff --git a/crypto/asn1/a_sign.c b/crypto/asn1/a_sign.c
index a3459e32c9..6ead2e2aca 100644
--- a/crypto/asn1/a_sign.c
+++ b/crypto/asn1/a_sign.c
@@ -159,7 +159,7 @@ int ASN1_item_sign_ctx(const ASN1_ITEM *it, X509_ALGOR *algor1,
int signid, paramtype, buf_len = 0;
int rv, pkey_id;
- md = EVP_MD_CTX_md(ctx);
+ md = EVP_MD_CTX_get0_md(ctx);
pkey = EVP_PKEY_CTX_get0_pkey(EVP_MD_CTX_pkey_ctx(ctx));
if (pkey == NULL) {
diff --git a/crypto/asn1/p5_scrypt.c b/crypto/asn1/p5_scrypt.c
index 901813a3d1..01e32b6ee1 100644
--- a/crypto/asn1/p5_scrypt.c
+++ b/crypto/asn1/p5_scrypt.c
@@ -217,7 +217,7 @@ int PKCS5_v2_scrypt_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass,
int t, rv = 0;
SCRYPT_PARAMS *sparam = NULL;
- if (EVP_CIPHER_CTX_cipher(ctx) == NULL) {
+ if (EVP_CIPHER_CTX_get0_cipher(ctx) == NULL) {
ERR_raise(ERR_LIB_EVP, EVP_R_NO_CIPHER_SET);
goto err;
}
diff --git a/crypto/cmac/cmac.c b/crypto/cmac/cmac.c
index 12445c4a24..f666f34d44 100644
--- a/crypto/cmac/cmac.c
+++ b/crypto/cmac/cmac.c
@@ -137,7 +137,7 @@ int CMAC_Init(CMAC_CTX *ctx, const void *key, size_t keylen,
/* If anything fails then ensure we can't use this ctx */
ctx->nlast_block = -1;
- if (!EVP_CIPHER_CTX_cipher(ctx->cctx))
+ if (!EVP_CIPHER_CTX_get0_cipher(ctx->cctx))
return 0;
if (!EVP_CIPHER_CTX_set_key_length(ctx->cctx, keylen))
return 0;
diff --git a/crypto/cms/cms_env.c b/crypto/cms/cms_env.c
index aa020cedfd..79efd67ba3 100644
--- a/crypto/cms/cms_env.c
+++ b/crypto/cms/cms_env.c
@@ -1105,8 +1105,8 @@ static BIO *cms_EnvelopedData_Decryption_init_bio(CMS_ContentInfo *cms)
* If the selected cipher supports unprotected attributes,
* deal with it using special ctrl function
*/
- if ((EVP_CIPHER_flags(EVP_CIPHER_CTX_cipher(ctx))
- & EVP_CIPH_FLAG_CIPHER_WITH_MAC)
+ if ((EVP_CIPHER_flags(EVP_CIPHER_CTX_get0_cipher(ctx))
+ & EVP_CIPH_FLAG_CIPHER_WITH_MAC) != 0
&& EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_PROCESS_UNPROTECTED, 0,
cms->d.envelopedData->unprotectedAttrs) <= 0) {
BIO_free(contentBio);
@@ -1225,7 +1225,8 @@ int ossl_cms_EnvelopedData_final(CMS_ContentInfo *cms, BIO *chain)
* If the selected cipher supports unprotected attributes,
* deal with it using special ctrl function
*/
- if (EVP_CIPHER_flags(EVP_CIPHER_CTX_cipher(ctx)) & EVP_CIPH_FLAG_CIPHER_WITH_MAC) {
+ if ((EVP_CIPHER_flags(EVP_CIPHER_CTX_get0_cipher(ctx))
+ & EVP_CIPH_FLAG_CIPHER_WITH_MAC) != 0) {
if (env->unprotectedAttrs == NULL)
env->unprotectedAttrs = sk_X509_ATTRIBUTE_new_null();
diff --git a/crypto/cms/cms_kari.c b/crypto/cms/cms_kari.c
index 1422f350b0..2fee4784da 100644
--- a/crypto/cms/cms_kari.c
+++ b/crypto/cms/cms_kari.c
@@ -422,7 +422,7 @@ static int cms_wrap_init(CMS_KeyAgreeRecipientInfo *kari,
int ret;
/* If a suitable wrap algorithm is already set nothing to do */
- kekcipher = EVP_CIPHER_CTX_cipher(ctx);
+ kekcipher = EVP_CIPHER_CTX_get0_cipher(ctx);
if (kekcipher != NULL) {
if (EVP_CIPHER_CTX_mode(ctx) != EVP_CIPH_WRAP_MODE)
return 0;
diff --git a/crypto/cms/cms_lib.c b/crypto/cms/cms_lib.c
index 0c9a372832..33127cc88c 100644
--- a/crypto/cms/cms_lib.c
+++ b/crypto/cms/cms_lib.c
@@ -459,7 +459,7 @@ int ossl_cms_DigestAlgorithm_find_ctx(EVP_MD_CTX *mctx, BIO *chain,
* Workaround for broken implementations that use signature
* algorithm OID instead of digest.
*/
- || EVP_MD_pkey_type(EVP_MD_CTX_md(mtmp)) == nid)
+ || EVP_MD_pkey_type(EVP_MD_CTX_get0_md(mtmp)) == nid)
return EVP_MD_CTX_copy_ex(mctx, mtmp);
chain = BIO_next(chain);
}
diff --git a/crypto/cms/cms_sd.c b/crypto/cms/cms_sd.c
index 287021fc21..2b232aa700 100644
--- a/crypto/cms/cms_sd.c
+++ b/crypto/cms/cms_sd.c
@@ -923,7 +923,7 @@ int CMS_SignerInfo_verify_content(CMS_SignerInfo *si, BIO *chain)
} else
r = 1;
} else {
- const EVP_MD *md = EVP_MD_CTX_md(mctx);
+ const EVP_MD *md = EVP_MD_CTX_get0_md(mctx);
const CMS_CTX *ctx = si->cms_ctx;
pkctx = EVP_PKEY_CTX_new_from_pkey(ossl_cms_ctx_get0_libctx(ctx),
diff --git a/crypto/evp/bio_md.c b/crypto/evp/bio_md.c
index f7970a91f3..bf1e8902a5 100644
--- a/crypto/evp/bio_md.c
+++ b/crypto/evp/bio_md.c
@@ -145,7 +145,7 @@ static long md_ctrl(BIO *b, int cmd, long num, void *ptr)
switch (cmd) {
case BIO_CTRL_RESET:
if (BIO_get_init(b))
- ret = EVP_DigestInit_ex(ctx, EVP_MD_CTX_md(ctx), NULL);
+ ret = EVP_DigestInit_ex(ctx, EVP_MD_CTX_get0_md(ctx), NULL);
else
ret = 0;
if (ret > 0)
@@ -154,7 +154,7 @@ static long md_ctrl(BIO *b, int cmd, long num, void *ptr)
case BIO_C_GET_MD:
if (BIO_get_init(b)) {
ppmd = ptr;
- *ppmd = EVP_MD_CTX_md(ctx);
+ *ppmd = EVP_MD_CTX_get0_md(ctx);
} else
ret = 0;
break;
diff --git a/crypto/evp/bio_ok.c b/crypto/evp/bio_ok.c
index 3d31f19829..ce40082977 100644
--- a/crypto/evp/bio_ok.c
+++ b/crypto/evp/bio_ok.c
@@ -394,7 +394,7 @@ static long ok_ctrl(BIO *b, int cmd, long num, void *ptr)
case BIO_C_GET_MD:
if (BIO_get_init(b)) {
ppmd = ptr;
- *ppmd = EVP_MD_CTX_md(ctx->md);
+ *ppmd = EVP_MD_CTX_get0_md(ctx->md);
} else
ret = 0;
break;
@@ -442,7 +442,7 @@ static int sig_out(BIO *b)
ctx = BIO_get_data(b);
md = ctx->md;
- digest = EVP_MD_CTX_md(md);
+ digest = EVP_MD_CTX_get0_md(md);
md_size = EVP_MD_size(digest);
md_data = EVP_MD_CTX_md_data(md);
@@ -486,7 +486,7 @@ static int sig_in(BIO *b)
ctx = BIO_get_data(b);
md = ctx->md;
- digest = EVP_MD_CTX_md(md);
+ digest = EVP_MD_CTX_get0_md(md);
md_size = EVP_MD_size(digest);
md_data = EVP_MD_CTX_md_data(md);
@@ -532,7 +532,7 @@ static int block_out(BIO *b)
ctx = BIO_get_data(b);
md = ctx->md;
- digest = EVP_MD_CTX_md(md);
+ digest = EVP_MD_CTX_get0_md(md);
md_size = EVP_MD_size(digest);
tl = ctx->buf_len - OK_BLOCK_BLOCK;
@@ -563,7 +563,7 @@ static int block_in(BIO *b)
ctx = BIO_get_data(b);
md = ctx->md;
- md_size = EVP_MD_size(EVP_MD_CTX_md(md));
+ md_size = EVP_MD_size(EVP_MD_CTX_get0_md(md));
assert(sizeof(tl) >= OK_BLOCK_BLOCK); /* always true */
tl = ctx->buf[0];
diff --git a/crypto/evp/cmeth_lib.c b/crypto/evp/cmeth_lib.c
index 7734295214..2541e5952b 100644
--- a/crypto/evp/cmeth_lib.c
+++ b/crypto/evp/cmeth_lib.c
@@ -28,6 +28,7 @@ EVP_CIPHER *EVP_CIPHER_meth_new(int cipher_type, int block_size, int key_len)
cipher->nid = cipher_type;
cipher->block_size = block_size;
cipher->key_len = key_len;
+ cipher->origin = EVP_ORIG_METH;
}
return cipher;
}
@@ -55,7 +56,10 @@ EVP_CIPHER *EVP_CIPHER_meth_dup(const EVP_CIPHER *cipher)
void EVP_CIPHER_meth_free(EVP_CIPHER *cipher)
{
- EVP_CIPHER_free(cipher);
+ if (cipher == NULL || cipher->origin != EVP_ORIG_METH)
+ return;
+
+ evp_cipher_free_int(cipher);
}
int EVP_CIPHER_meth_set_iv_length(EVP_CIPHER *cipher, int iv_len)
diff --git a/crypto/evp/digest.c b/crypto/evp/digest.c
index 82e43f2eb1..ef60fc1505 100644
--- a/crypto/evp/digest.c
+++ b/crypto/evp/digest.c
@@ -1026,7 +1026,8 @@ int EVP_MD_up_ref(EVP_MD *md)
{
int ref = 0;
- CRYPTO_UP_REF(&md->refcnt, &ref, md->lock);
+ if (md->origin == EVP_ORIG_DYNAMIC)
+ CRYPTO_UP_REF(&md->refcnt, &ref, md->lock);
return 1;
}
@@ -1034,15 +1035,13 @@ void EVP_MD_free(EVP_MD *md)
{
int i;
- if (md == NULL)
+ if (md == NULL || md->origin != EVP_ORIG_DYNAMIC)
return;
CRYPTO_DOWN_REF(&md->refcnt, &i, md->lock);
if (i > 0)
return;
- ossl_provider_free(md->prov);
- CRYPTO_THREAD_lock_free(md->lock);
- OPENSSL_free(md);
+ evp_md_free_int(md);
}
void EVP_MD_do_all_provided(OSSL_LIB_CTX *libctx,
diff --git a/crypto/evp/e_aes.c b/crypto/evp/e_aes.c
index df74aca45d..ffafdbcc22 100644
--- a/crypto/evp/e_aes.c
+++ b/crypto/evp/e_aes.c
@@ -395,6 +395,7 @@ static int aesni_ocb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
static const EVP_CIPHER aesni_##keylen##_##mode = { \
nid##_##keylen##_##nmode,blocksize,keylen/8,ivlen, \
flags|EVP_CIPH_##MODE##_MODE, \
+ EVP_ORIG_GLOBAL, \
aesni_init_key, \
aesni_##mode##_cipher, \
NULL, \
@@ -402,8 +403,9 @@ static const EVP_CIPHER aesni_##keylen##_##mode = { \
NULL,NULL,NULL,NULL }; \
static const EVP_CIPHER aes_##keylen##_##mode = { \
nid##_##keylen##_##nmode,blocksize, \
- keylen/8,ivlen, \
+ keylen/8,ivlen, \
flags|EVP_CIPH_##MODE##_MODE, \
+ EVP_ORIG_GLOBAL, \
aes_init_key, \
aes_##mode##_cipher, \
NULL, \
@@ -418,6 +420,7 @@ static const EVP_CIPHER aesni_##keylen##_##mode = { \
(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, \
aesni_##mode##_init_key, \
aesni_##mode##_cipher, \
aes_##mode##_cleanup, \
@@ -428,6 +431,7 @@ static const EVP_CIPHER aes_##keylen##_##mode = { \
(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, \
aes_##mode##_init_key, \
aes_##mode##_cipher, \
aes_##mode##_cleanup, \
@@ -749,6 +753,7 @@ static int aes_t4_ocb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
static const EVP_CIPHER aes_t4_##keylen##_##mode = { \
nid##_##keylen##_##nmode,blocksize,keylen/8,ivlen, \
flags|EVP_CIPH_##MODE##_MODE, \
+ EVP_ORIG_GLOBAL, \
aes_t4_init_key, \
aes_t4_##mode##_cipher, \
NULL, \
@@ -758,6 +763,7 @@ static const EVP_CIPHER aes_##keylen##_##mode = { \
nid##_##keylen##_##nmode,blocksize, \
keylen/8,ivlen, \
flags|EVP_CIPH_##MODE##_MODE, \
+ EVP_ORIG_GLOBAL, \
aes_init_key, \
aes_##mode##_cipher, \
NULL, \
@@ -772,6 +778,7 @@ static const EVP_CIPHER aes_t4_##keylen##_##mode = { \
(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, \
aes_t4_##mode##_init_key, \
aes_t4_##mode##_cipher, \
aes_##mode##_cleanup, \
@@ -782,6 +789,7 @@ static const EVP_CIPHER aes_##keylen##_##mode = { \
(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, \
aes_##mode##_init_key, \
aes_##mode##_cipher, \
aes_##mode##_cleanup, \
@@ -2249,6 +2257,7 @@ const EVP_CIPHER *EVP_aes_##keylen##_##mode(void) \
static const EVP_CIPHER aes_##keylen##_##mode = { \
nid##_##keylen##_##nmode,blocksize,keylen/8,ivlen, \
flags|EVP_CIPH_##MODE##_MODE, \
+ EVP_ORIG_GLOBAL, \
aes_init_key, \
aes_##mode##_cipher, \
NULL, \
@@ -2263,6 +2272,7 @@ static const EVP_CIPHER aes_##keylen##_##mode = { \
(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, \
aes_##mode##_init_key, \
aes_##mode##_cipher, \
aes_##mode##_cleanup, \
@@ -3511,10 +3521,10 @@ static int aes_ccm_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
BLOCK_CIPHER_custom(NID_aes, 128, 1, 12, ccm, CCM,
EVP_CIPH_FLAG_AEAD_CIPHER | CUSTOM_FLAGS)
- BLOCK_CIPHER_custom(NID_aes, 192, 1, 12, ccm, CCM,
- EVP_CIPH_FLAG_AEAD_CIPHER | CUSTOM_FLAGS)
- BLOCK_CIPHER_custom(NID_aes, 256, 1, 12, ccm, CCM,
- EVP_CIPH_FLAG_AEAD_CIPHER | CUSTOM_FLAGS)
+BLOCK_CIPHER_custom(NID_aes, 192, 1, 12, ccm, CCM,
+ EVP_CIPH_FLAG_AEAD_CIPHER | CUSTOM_FLAGS)
+BLOCK_CIPHER_custom(NID_aes, 256, 1, 12, ccm, CCM,
+ EVP_CIPH_FLAG_AEAD_CIPHER | CUSTOM_FLAGS)
typedef struct {
union {
@@ -3613,7 +3623,7 @@ static int aes_wrap_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
static const EVP_CIPHER aes_128_wrap = {
NID_id_aes128_wrap,
- 8, 16, 8, WRAP_FLAGS,
+ 8, 16, 8, WRAP_FLAGS, EVP_ORIG_GLOBAL,
aes_wrap_init_key, aes_wrap_cipher,
NULL,
sizeof(EVP_AES_WRAP_CTX),
@@ -3627,7 +3637,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,
+ 8, 24, 8, WRAP_FLAGS, EVP_ORIG_GLOBAL,
aes_wrap_init_key, aes_wrap_cipher,
NULL,
sizeof(EVP_AES_WRAP_CTX),
@@ -3641,7 +3651,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,
+ 8, 32, 8, WRAP_FLAGS, EVP_ORIG_GLOBAL,
aes_wrap_init_key, aes_wrap_cipher,
NULL,
sizeof(EVP_AES_WRAP_CTX),
@@ -3655,7 +3665,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,
+ 8, 16, 4, WRAP_FLAGS, EVP_ORIG_GLOBAL,
aes_wrap_init_key, aes_wrap_cipher,
NULL,
sizeof(EVP_AES_WRAP_CTX),
@@ -3669,7 +3679,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,
+ 8, 24, 4, WRAP_FLAGS, EVP_ORIG_GLOBAL,
aes_wrap_init_key, aes_wrap_cipher,
NULL,
sizeof(EVP_AES_WRAP_CTX),
@@ -3683,7 +3693,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,
+ 8, 32, 4, WRAP_FLAGS, EVP_ORIG_GLOBAL,
aes_wrap_init_key, aes_wrap_cipher,
NULL,
sizeof(EVP_AES_WRAP_CTX),
diff --git a/crypto/evp/e_aes_cbc_hmac_sha1.c b/crypto/evp/e_aes_cbc_hmac_sha1.c
index cdf5985e8b..766f248718 100644
--- a/crypto/evp/e_aes_cbc_hmac_sha1.c
+++ b/crypto/evp/e_aes_cbc_hmac_sha1.c
@@ -914,6 +914,7 @@ static EVP_CIPHER aesni_128_cbc_hmac_sha1_cipher = {
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,
aesni_cbc_hmac_sha1_init_key,
aesni_cbc_hmac_sha1_cipher,
NULL,
@@ -933,6 +934,7 @@ static EVP_CIPHER aesni_256_cbc_hmac_sha1_cipher = {
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,
aesni_cbc_hmac_sha1_init_key,
aesni_cbc_hmac_sha1_cipher,
NULL,
diff --git a/crypto/evp/e_aes_cbc_hmac_sha256.c b/crypto/evp/e_aes_cbc_hmac_sha256.c
index 906ec9f7fc..0413f66806 100644
--- a/crypto/evp/e_aes_cbc_hmac_sha256.c
+++ b/crypto/evp/e_aes_cbc_hmac_sha256.c
@@ -898,6 +898,7 @@ static EVP_CIPHER aesni_128_cbc_hmac_sha256_cipher = {
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,
aesni_cbc_hmac_sha256_init_key,
aesni_cbc_hmac_sha256_cipher,
NULL,
@@ -917,6 +918,7 @@ static EVP_CIPHER aesni_256_cbc_hmac_sha256_cipher = {
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,
aesni_cbc_hmac_sha256_init_key,
aesni_cbc_hmac_sha256_cipher,
NULL,
diff --git a/crypto/evp/e_aria.c b/crypto/evp/e_aria.c
index e56c4fd006..e7ba2df78f 100644
--- a/crypto/evp/e_aria.c
+++ b/crypto/evp/e_aria.c
@@ -159,6 +159,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, \
aria_init_key, \
aria_##mode##_cipher, \
NULL, \
@@ -757,6 +758,7 @@ static const EVP_CIPHER aria_##keylen##_##mode = { \
nid##_##keylen##_##nmode, \
blocksize, keylen/8, ivlen, \
ARIA_AUTH_FLAGS|EVP_CIPH_##MODE##_MODE, \
+ EVP_ORIG_GLOBAL, \
aria_##mode##_init_key, \
aria_##mode##_cipher, \
aria_##mode##_cleanup, \
diff --git a/crypto/evp/e_camellia.c b/crypto/evp/e_camellia.c
index 52c33d472e..db2057a660 100644
--- a/crypto/evp/e_camellia.c
+++ b/crypto/evp/e_camellia.c
@@ -144,6 +144,7 @@ static int cmll_t4_ctr_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
static const EVP_CIPHER cmll_t4_##keylen##_##mode = { \