From: Matt Caswell Date: Mon, 24 Jun 2019 16:38:01 +0000 (+0100) Subject: Rename EVP_MD_upref/EVP_CIPHER_upref to EVP_MD_up_ref/EVP_CIPHER_up_ref X-Git-Tag: openssl-3.0.0-alpha1~1853 X-Git-Url: https://git.openssl.org/?p=openssl.git;a=commitdiff_plain;h=70c35fd1f6467da5563c6cab3ea373e6359cf080;hp=42738cdeaa1103c0bd1e7500cf64ac62a015b3a2 Rename EVP_MD_upref/EVP_CIPHER_upref to EVP_MD_up_ref/EVP_CIPHER_up_ref All the other upref functions are spelled as "up_ref". These new functions should be consistent. Reviewed-by: Shane Lontis (Merged from https://github.com/openssl/openssl/pull/9233) --- diff --git a/crypto/evp/cmeth_lib.c b/crypto/evp/cmeth_lib.c index 0520157cd8..40aca34e07 100644 --- a/crypto/evp/cmeth_lib.c +++ b/crypto/evp/cmeth_lib.c @@ -60,7 +60,7 @@ void EVP_CIPHER_meth_free(EVP_CIPHER *cipher) } } -int EVP_CIPHER_upref(EVP_CIPHER *cipher) +int EVP_CIPHER_up_ref(EVP_CIPHER *cipher) { int ref = 0; diff --git a/crypto/evp/digest.c b/crypto/evp/digest.c index 9f19744606..f26caedd5b 100644 --- a/crypto/evp/digest.c +++ b/crypto/evp/digest.c @@ -422,7 +422,7 @@ int EVP_MD_CTX_copy_ex(EVP_MD_CTX *out, const EVP_MD_CTX *in) out->provctx = NULL; if (in->fetched_digest != NULL) - EVP_MD_upref(in->fetched_digest); + EVP_MD_up_ref(in->fetched_digest); out->provctx = in->digest->dupctx(in->provctx); if (out->provctx == NULL) { @@ -665,9 +665,9 @@ static void *evp_md_from_dispatch(const OSSL_DISPATCH *fns, return md; } -static int evp_md_upref(void *md) +static int evp_md_up_ref(void *md) { - return EVP_MD_upref(md); + return EVP_MD_up_ref(md); } static void evp_md_free(void *md) @@ -680,7 +680,7 @@ EVP_MD *EVP_MD_fetch(OPENSSL_CTX *ctx, const char *algorithm, { EVP_MD *md = evp_generic_fetch(ctx, OSSL_OP_DIGEST, algorithm, properties, - evp_md_from_dispatch, evp_md_upref, + evp_md_from_dispatch, evp_md_up_ref, evp_md_free); #ifndef FIPS_MODE diff --git a/crypto/evp/evp_enc.c b/crypto/evp/evp_enc.c index 02f0e00563..e7bebdcc1d 100644 --- a/crypto/evp/evp_enc.c +++ b/crypto/evp/evp_enc.c @@ -1016,7 +1016,7 @@ int EVP_CIPHER_CTX_copy(EVP_CIPHER_CTX *out, const EVP_CIPHER_CTX *in) *out = *in; out->provctx = NULL; - if (in->fetched_cipher != NULL && !EVP_CIPHER_upref(in->fetched_cipher)) { + if (in->fetched_cipher != NULL && !EVP_CIPHER_up_ref(in->fetched_cipher)) { out->fetched_cipher = NULL; return 0; } @@ -1179,9 +1179,9 @@ static void *evp_cipher_from_dispatch(const OSSL_DISPATCH *fns, return cipher; } -static int evp_cipher_upref(void *cipher) +static int evp_cipher_up_ref(void *cipher) { - return EVP_CIPHER_upref(cipher); + return EVP_CIPHER_up_ref(cipher); } static void evp_cipher_free(void *cipher) @@ -1194,7 +1194,7 @@ EVP_CIPHER *EVP_CIPHER_fetch(OPENSSL_CTX *ctx, const char *algorithm, { EVP_CIPHER *cipher = evp_generic_fetch(ctx, OSSL_OP_CIPHER, algorithm, properties, - evp_cipher_from_dispatch, evp_cipher_upref, + evp_cipher_from_dispatch, evp_cipher_up_ref, evp_cipher_free); #ifndef FIPS_MODE diff --git a/crypto/evp/evp_lib.c b/crypto/evp/evp_lib.c index faaa69d338..8ed39cb53e 100644 --- a/crypto/evp/evp_lib.c +++ b/crypto/evp/evp_lib.c @@ -469,7 +469,7 @@ EVP_MD *EVP_MD_meth_dup(const EVP_MD *md) return to; } -int EVP_MD_upref(EVP_MD *md) +int EVP_MD_up_ref(EVP_MD *md) { int ref = 0; diff --git a/doc/man3/EVP_MD_meth_new.pod b/doc/man3/EVP_MD_meth_new.pod index 6269a05c34..5e35539efe 100644 --- a/doc/man3/EVP_MD_meth_new.pod +++ b/doc/man3/EVP_MD_meth_new.pod @@ -11,7 +11,7 @@ EVP_MD_meth_set_ctrl, EVP_MD_meth_get_input_blocksize, EVP_MD_meth_get_result_size, EVP_MD_meth_get_app_datasize, EVP_MD_meth_get_flags, EVP_MD_meth_get_init, EVP_MD_meth_get_update, EVP_MD_meth_get_final, EVP_MD_meth_get_copy, EVP_MD_meth_get_cleanup, -EVP_MD_meth_get_ctrl, EVP_MD_upref +EVP_MD_meth_get_ctrl, EVP_MD_up_ref - Routines to build up EVP_MD methods =head1 SYNOPSIS @@ -54,7 +54,7 @@ EVP_MD_meth_get_ctrl, EVP_MD_upref int (*EVP_MD_meth_get_ctrl(const EVP_MD *md))(EVP_MD_CTX *ctx, int cmd, int p1, void *p2); - int EVP_MD_upref(EVP_MD *md); + int EVP_MD_up_ref(EVP_MD *md); =head1 DESCRIPTION @@ -162,7 +162,7 @@ EVP_MD_meth_get_cleanup() and EVP_MD_meth_get_ctrl() are all used to retrieve the method data given with the EVP_MD_meth_set_*() functions above. -EVP_MD_upref() increments the reference count for an EVP_MD structure. +EVP_MD_up_ref() increments the reference count for an EVP_MD structure. =head1 RETURN VALUES @@ -175,7 +175,7 @@ indicated sizes or flags. All other EVP_CIPHER_meth_get_*() functions return pointers to their respective B function. -EVP_MD_upref() returns 1 for success or 0 otherwise. +EVP_MD_up_ref() returns 1 for success or 0 otherwise. =head1 SEE ALSO @@ -184,7 +184,7 @@ L, L, L =head1 HISTORY The B structure was openly available in OpenSSL before version -1.1. EVP_MD_upref() was added in OpenSSL 3.0. All other functions described +1.1. EVP_MD_up_ref() was added in OpenSSL 3.0. All other functions described here were added in OpenSSL 1.1. =head1 COPYRIGHT diff --git a/include/openssl/evp.h b/include/openssl/evp.h index 8195d11250..2fb5fe2763 100644 --- a/include/openssl/evp.h +++ b/include/openssl/evp.h @@ -80,7 +80,7 @@ int EVP_set_default_properties(OPENSSL_CTX *libctx, const char *propq); # ifndef EVP_MD EVP_MD *EVP_MD_meth_new(int md_type, int pkey_type); EVP_MD *EVP_MD_meth_dup(const EVP_MD *md); -int EVP_MD_upref(EVP_MD *md); +int EVP_MD_up_ref(EVP_MD *md); void EVP_MD_meth_free(EVP_MD *md); int EVP_MD_meth_set_input_blocksize(EVP_MD *md, int blocksize); @@ -191,7 +191,7 @@ int (*EVP_MD_meth_get_ctrl(const EVP_MD *md))(EVP_MD_CTX *ctx, int cmd, EVP_CIPHER *EVP_CIPHER_meth_new(int cipher_type, int block_size, int key_len); EVP_CIPHER *EVP_CIPHER_meth_dup(const EVP_CIPHER *cipher); void EVP_CIPHER_meth_free(EVP_CIPHER *cipher); -int EVP_CIPHER_upref(EVP_CIPHER *cipher); +int EVP_CIPHER_up_ref(EVP_CIPHER *cipher); int EVP_CIPHER_meth_set_iv_length(EVP_CIPHER *cipher, int iv_len); int EVP_CIPHER_meth_set_flags(EVP_CIPHER *cipher, unsigned long flags); diff --git a/test/evp_extra_test.c b/test/evp_extra_test.c index 48376a7951..27ce98a409 100644 --- a/test/evp_extra_test.c +++ b/test/evp_extra_test.c @@ -1150,8 +1150,8 @@ static int test_EVP_MD_fetch(int tst) || !TEST_int_eq(EVP_MD_block_size(md), SHA256_CBLOCK)) goto err; - /* Also test EVP_MD_upref() while we're doing this */ - if (!TEST_true(EVP_MD_upref(md))) + /* Also test EVP_MD_up_ref() while we're doing this */ + if (!TEST_true(EVP_MD_up_ref(md))) goto err; /* Ref count should now be 2. Release both */ EVP_MD_meth_free(md); diff --git a/util/libcrypto.num b/util/libcrypto.num index 40e80ffd55..69a1d50bb0 100644 --- a/util/libcrypto.num +++ b/util/libcrypto.num @@ -4783,12 +4783,12 @@ OSSL_PARAM_set_octet_ptr 4730 3_0_0 EXIST::FUNCTION: X509_set0_sm2_id 4731 3_0_0 EXIST::FUNCTION:SM2 X509_get0_sm2_id 4732 3_0_0 EXIST::FUNCTION:SM2 EVP_PKEY_get0_engine 4733 3_0_0 EXIST::FUNCTION:ENGINE -EVP_MD_upref 4734 3_0_0 EXIST::FUNCTION: +EVP_MD_up_ref 4734 3_0_0 EXIST::FUNCTION: EVP_MD_fetch 4735 3_0_0 EXIST::FUNCTION: EVP_set_default_properties 4736 3_0_0 EXIST::FUNCTION: OSSL_PARAM_construct_end 4737 3_0_0 EXIST::FUNCTION: EC_GROUP_check_named_curve 4738 3_0_0 EXIST::FUNCTION:EC -EVP_CIPHER_upref 4739 3_0_0 EXIST::FUNCTION: +EVP_CIPHER_up_ref 4739 3_0_0 EXIST::FUNCTION: EVP_CIPHER_fetch 4740 3_0_0 EXIST::FUNCTION: EVP_CIPHER_mode 4741 3_0_0 EXIST::FUNCTION: OPENSSL_info 4742 3_0_0 EXIST::FUNCTION: diff --git a/util/missingcrypto.txt b/util/missingcrypto.txt index 1162a2e11c..1509a29b95 100644 --- a/util/missingcrypto.txt +++ b/util/missingcrypto.txt @@ -499,7 +499,7 @@ EVP_CIPHER_do_all_sorted EVP_CIPHER_get_asn1_iv EVP_CIPHER_impl_ctx_size EVP_CIPHER_set_asn1_iv -EVP_CIPHER_upref +EVP_CIPHER_up_ref EVP_Cipher EVP_MAC_do_all EVP_MAC_do_all_sorted