openssl/crypto
Rich Salz f6c95e46c0 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)
2021-04-18 10:03:07 +02:00
..
aes remove unused initialisations 2020-12-03 11:22:06 +10:00
aria Update copyright year 2021-04-08 13:04:41 +01:00
asn1 Add "origin" field to EVP_CIPHER, EVP_MD 2021-04-18 10:03:07 +02:00
async Update copyright year 2021-04-08 13:04:41 +01:00
bf Update copyright year 2020-04-23 13:55:52 +01:00
bio Add more negative checks for integers passed to OPENSSL_malloc(). 2021-04-16 12:10:08 +10:00
bn crypto: raise error on malloc failure 2021-04-14 09:31:49 +10:00
buffer Update copyright year 2020-11-26 14:18:57 +00:00
camellia Update copyright year 2020-04-23 13:55:52 +01:00
cast Fix logic error for building x86 CAST assembly 2020-06-14 12:35:34 -07:00
chacha Fix aarch64 static linking into shared libraries (see issue #10842 and pull request #11464) 2020-10-22 12:16:49 +10:00
cmac Add "origin" field to EVP_CIPHER, EVP_MD 2021-04-18 10:03:07 +02:00
cmp OSSL_CMP_CTX_new(): Fix distinction of out-of-memory and other errors 2021-04-17 11:39:12 +02:00
cms Add "origin" field to EVP_CIPHER, EVP_MD 2021-04-18 10:03:07 +02:00
comp Update copyright year 2021-04-08 13:04:41 +01:00
conf Update copyright year 2021-04-08 13:04:41 +01:00
crmf Update copyright year 2021-03-11 13:27:36 +00:00
ct Update copyright year 2021-04-08 13:04:41 +01:00
des Update copyright year 2021-01-28 13:54:57 +01:00
dh Do not allow creating empty RSA keys by duplication 2021-04-15 09:23:18 +02:00
dsa Do not allow creating empty RSA keys by duplication 2021-04-15 09:23:18 +02:00
dso Update copyright year 2020-11-26 14:18:57 +00:00
ec Do not allow creating empty RSA keys by duplication 2021-04-15 09:23:18 +02:00
encode_decode Rename EVP_PKEY_get0_first_alg_name to EVP_PKEY_get0_type_name 2021-04-15 17:38:19 +02:00
engine Update copyright year 2021-04-08 13:04:41 +01:00
err Add domain parameter match check for DH and ECDH key exchange. 2021-04-14 16:01:13 +10:00
ess Add more negative checks for integers passed to OPENSSL_malloc(). 2021-04-16 12:10:08 +10:00
evp Add "origin" field to EVP_CIPHER, EVP_MD 2021-04-18 10:03:07 +02:00
ffc Update copyright year 2021-04-08 13:04:41 +01:00
hmac Delete unused PKEY MAC files 2020-08-29 17:40:11 +10:00
http OSSL_HTTP_REQ_CTX_transfer(): improve distinction of send error vs. receive error 2021-03-31 19:53:05 +02:00
idea Update copyright year 2021-04-08 13:04:41 +01:00
kdf Deprecate ERR_load_KDF_strings() 2019-11-12 13:30:35 +01:00
lhash Update copyright year 2021-04-08 13:04:41 +01:00
md2 Update copyright year 2020-04-23 13:55:52 +01:00
md4 Update copyright year 2020-04-23 13:55:52 +01:00
md5 Update copyright year 2020-11-26 14:18:57 +00:00
mdc2 Update copyright year 2020-04-23 13:55:52 +01:00
modes Update copyright year 2021-04-08 13:04:41 +01:00
objects Update copyright year 2021-04-08 13:04:41 +01:00
ocsp Add some additional NULL checks to prevent segfaults. 2021-04-14 16:05:00 +10:00
pem PEM_X509_INFO_read_bio_ex(): Generalize to allow parsing any type of private key 2021-04-08 15:18:58 +02:00
perlasm Fix many MarkDown issues in {NOTES*,README*,HACKING,LICENSE}.md files 2020-07-05 11:29:43 +02:00
pkcs7 Add "origin" field to EVP_CIPHER, EVP_MD 2021-04-18 10:03:07 +02:00
pkcs12 Add "origin" field to EVP_CIPHER, EVP_MD 2021-04-18 10:03:07 +02:00
poly1305 Update copyright year 2021-04-08 13:04:41 +01:00
property Update copyright year 2021-04-08 13:04:41 +01:00
rand Update copyright year 2021-04-08 13:04:41 +01:00
rc2 Update copyright year 2020-04-23 13:55:52 +01:00
rc4 rename md5_block_asm_data_order to ossl_md5_block_asm_data_order 2020-11-19 07:38:58 +10:00
rc5 Update copyright year 2020-04-23 13:55:52 +01:00
ripemd Diverse build.info: Adjust paths 2020-09-10 09:50:56 +02:00
rsa Add selection support to the provider keymgmt_dup function 2021-04-15 09:19:39 +02:00
seed Update copyright year 2020-04-23 13:55:52 +01:00
sha Update copyright year 2020-11-26 14:18:57 +00:00
siphash Fix a TODO(3.0) in the siphash code 2021-03-17 10:16:21 +10:00
sm2 Fix up issues found when running evp_extra_test with a non-default library context 2021-03-17 17:51:16 +10:00
sm3 Add "origin" field to EVP_CIPHER, EVP_MD 2021-04-18 10:03:07 +02:00
sm4 Update copyright year 2021-04-08 13:04:41 +01:00
srp Add ossl_bn_group symbols 2021-03-18 17:52:37 +10:00
stack Update copyright year 2021-02-18 15:05:17 +00:00
store Replace OSSL_PARAM_BLD_free_params() with OSSL_PARAM_free(). 2021-04-12 16:55:30 +10:00
ts Update copyright year 2021-04-08 13:04:41 +01:00
txt_db Following the license change, modify the boilerplates in crypto/ 2018-12-06 15:32:17 +01:00
ui Update copyright year 2021-04-08 13:04:41 +01:00
whrlpool Update copyright year 2021-03-11 13:27:36 +00:00
x509 Add more negative checks for integers passed to OPENSSL_malloc(). 2021-04-16 12:10:08 +10:00
alphacpuid.pl Update copyright year 2020-04-23 13:55:52 +01:00
arm64cpuid.pl Read MIDR_EL1 system register on aarch64 2020-12-09 16:17:17 +01:00
arm_arch.h Read MIDR_EL1 system register on aarch64 2020-12-09 16:17:17 +01:00
armcap.c Update copyright year 2021-01-28 13:54:57 +01:00
armv4cpuid.pl Update copyright year 2020-04-23 13:55:52 +01:00
asn1_dsa.c Update copyright year 2021-04-08 13:04:41 +01:00
bsearch.c ossl_bsearch(): New generic internal binary search utility function 2019-05-08 16:17:16 +02:00
build.info Add OSSL_PARAM_dup() and OSSL_PARAM_merge(). 2021-04-12 16:55:29 +10:00
c64xpluscpuid.pl Update copyright year 2020-04-23 13:55:52 +01:00
context.c property: lock the lib ctx when updating the property definition cache 2021-04-08 17:46:35 +10:00
core_algorithm.c rename ossl_provider_forall_loaded to ossl_provider_doall_activated 2021-03-12 09:14:00 +10:00
core_fetch.c Update copyright year 2021-01-28 13:54:57 +01:00
core_namemap.c Add ossl_lhash symbols 2021-03-18 17:52:38 +10:00
cpt_err.c openssl_hexstr2buf_sep(): Prevent misleading 'malloc failure' errors on short input 2020-12-10 15:19:55 +01:00
cpuid.c Refactor CPUID code 2021-04-02 16:39:13 +02:00
cryptlib.c Refactor CPUID code 2021-04-02 16:39:13 +02:00
ctype.c Update copyright year 2021-04-08 13:04:41 +01:00
cversion.c Cleanup include/openssl/opensslv.h.in 2019-11-08 16:12:57 +01:00
der_writer.c der: _ossl prefix DER functions 2020-10-01 11:25:12 +10:00
dllmain.c Reorganize private crypto header files 2019-09-28 20:26:34 +02:00
ebcdic.c Following the license change, modify the boilerplates in crypto/ 2018-12-06 15:32:17 +01:00
ex_data.c Fix external symbols for crypto_* 2021-03-18 17:35:10 +10:00
getenv.c Update copyright year 2020-10-15 14:10:06 +01:00
ia64cpuid.S Following the license change, modify the boilerplates in crypto/ 2018-12-06 15:32:17 +01:00
info.c Print CPUINFO also for s390 processors 2020-06-22 02:35:01 +02:00
init.c Update copyright year 2021-04-08 13:04:41 +01:00
initthread.c Convert a TODO(3.0) in OPENSSL_thread_stop_ex to a comment 2021-03-14 15:40:25 +10:00
LPdir_nyi.c Following the license change, modify the boilerplates in crypto/ 2018-12-06 15:32:17 +01:00
LPdir_unix.c Fix a -Warray-bounds gcc warning in OPENSSL_DIR_read 2019-11-09 10:49:34 +01:00
LPdir_vms.c Following the license change, modify the boilerplates in crypto/ 2018-12-06 15:32:17 +01:00
LPdir_win32.c Following the license change, modify the boilerplates in crypto/ 2018-12-06 15:32:17 +01:00
LPdir_win.c Following the license change, modify the boilerplates in crypto/ 2018-12-06 15:32:17 +01:00
LPdir_wince.c Following the license change, modify the boilerplates in crypto/ 2018-12-06 15:32:17 +01:00
mem_clr.c Following the license change, modify the boilerplates in crypto/ 2018-12-06 15:32:17 +01:00
mem_sec.c Update copyright year 2021-04-08 13:04:41 +01:00
mem.c Rename FIPS_MODE to FIPS_MODULE 2020-04-28 15:37:37 +02:00
mips_arch.h Fix header file include guard names 2019-09-28 20:26:36 +02:00
o_dir.c Following the license change, modify the boilerplates in crypto/ 2018-12-06 15:32:17 +01:00
o_fopen.c Update copyright year 2020-11-26 14:18:57 +00:00
o_init.c Following the license change, modify the boilerplates in crypto/ 2018-12-06 15:32:17 +01:00
o_str.c Update copyright year 2021-04-08 13:04:41 +01:00
o_time.c Update copyright year 2021-03-11 13:27:36 +00:00
packet.c Convert all {NAME}err() in crypto/ to their corresponding ERR_raise() call 2020-11-13 09:35:02 +01:00
param_build_set.c Update copyright year 2021-03-11 13:27:36 +00:00
param_build.c Replace OSSL_PARAM_BLD_free_params() with OSSL_PARAM_free(). 2021-04-12 16:55:30 +10:00
params_dup.c Add OSSL_PARAM_dup() and OSSL_PARAM_merge(). 2021-04-12 16:55:29 +10:00
params_from_text.c params: fix coverity 1473069: unchecked return values 2021-03-26 08:46:02 +10:00
params.c Add OSSL_PARAM_dup() and OSSL_PARAM_merge(). 2021-04-12 16:55:29 +10:00
pariscid.pl Update copyright year 2020-04-23 13:55:52 +01:00
passphrase.c CORE: Fix small bug in passphrase caching 2020-09-03 17:48:32 +02:00
ppc_arch.h Fix header file include guard names 2019-09-28 20:26:36 +02:00
ppccap.c crypto/ppccap.c: Remove useless TODO 3.0 2021-03-04 14:15:01 +01:00
ppccpuid.pl Update copyright year 2020-04-23 13:55:52 +01:00
provider_conf.c Update copyright year 2021-03-11 13:27:36 +00:00
provider_core.c property: check return values from the property locking calls. 2021-04-08 17:46:35 +10:00
provider_local.h Update copyright year 2021-04-08 13:04:41 +01:00
provider_predefined.c Update copyright year 2021-04-08 13:04:41 +01:00
provider.c rename ossl_provider_forall_loaded to ossl_provider_doall_activated 2021-03-12 09:14:00 +10:00
punycode.c Update copyright year 2020-10-15 14:10:06 +01:00
README-sparse_array.md Fix many MarkDown issues in {NOTES*,README*,HACKING,LICENSE}.md files 2020-07-05 11:29:43 +02:00
s390x_arch.h Update copyright year 2020-04-23 13:55:52 +01:00
s390xcap.c crypto/s390xcap.c: Add guards around the GETAUXVAL checks 2019-10-21 15:14:09 +02:00
s390xcpuid.pl Update copyright year 2020-04-23 13:55:52 +01:00
self_test_core.c Rename OPENSSL_CTX prefix to OSSL_LIB_CTX 2020-10-15 11:59:53 +01:00
sparc_arch.h Fix header file include guard names 2019-09-28 20:26:36 +02:00
sparccpuid.S Following the license change, modify the boilerplates in crypto/ 2018-12-06 15:32:17 +01:00
sparcv9cap.c Update copyright year 2020-04-23 13:55:52 +01:00
sparse_array.c Update copyright year 2021-04-08 13:04:41 +01:00
threads_lib.c Fix no-threads 2020-12-14 10:45:27 +10:00
threads_none.c Update copyright year 2021-04-08 13:04:41 +01:00
threads_pthread.c Always check CRYPTO_LOCK_{read,write}_lock 2021-03-14 15:33:34 +10:00
threads_win.c Always check CRYPTO_LOCK_{read,write}_lock 2021-03-14 15:33:34 +10:00
trace.c Update copyright year 2021-04-08 13:04:41 +01:00
uid.c Remove NextStep support 2019-07-01 13:32:46 -04:00
vms_rms.h Following the license change, modify the boilerplates in crypto/ 2018-12-06 15:32:17 +01:00
x86_64cpuid.pl Update copyright year 2021-04-08 13:04:41 +01:00
x86cpuid.pl Update copyright year 2020-04-23 13:55:52 +01:00