mirror of
https://github.com/openssl/openssl.git
synced 2025-01-18 13:44:20 +08:00
Cleanup: rename EVP_MD_CTX_(create|init|destroy) to EVP_MD_CTX_(new|reset|free)
Looking over names, it seems like we usually use names ending with _new and _free as object constructors and destructors. Also, since EVP_MD_CTX_init is now used to reset a EVP_MD_CTX, it might as well be named accordingly. Reviewed-by: Rich Salz <rsalz@openssl.org>
This commit is contained in:
parent
6756532358
commit
959ed5316c
@ -120,7 +120,7 @@
|
|||||||
#include "evp_locl.h"
|
#include "evp_locl.h"
|
||||||
|
|
||||||
/* This call frees resources associated with the context */
|
/* This call frees resources associated with the context */
|
||||||
int EVP_MD_CTX_init(EVP_MD_CTX *ctx)
|
int EVP_MD_CTX_reset(EVP_MD_CTX *ctx)
|
||||||
{
|
{
|
||||||
if (ctx == NULL)
|
if (ctx == NULL)
|
||||||
return 1;
|
return 1;
|
||||||
@ -150,20 +150,20 @@ int EVP_MD_CTX_init(EVP_MD_CTX *ctx)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
EVP_MD_CTX *EVP_MD_CTX_create(void)
|
EVP_MD_CTX *EVP_MD_CTX_new(void)
|
||||||
{
|
{
|
||||||
return OPENSSL_zalloc(sizeof(EVP_MD_CTX));
|
return OPENSSL_zalloc(sizeof(EVP_MD_CTX));
|
||||||
}
|
}
|
||||||
|
|
||||||
void EVP_MD_CTX_destroy(EVP_MD_CTX *ctx)
|
void EVP_MD_CTX_free(EVP_MD_CTX *ctx)
|
||||||
{
|
{
|
||||||
EVP_MD_CTX_init(ctx);
|
EVP_MD_CTX_reset(ctx);
|
||||||
OPENSSL_free(ctx);
|
OPENSSL_free(ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
int EVP_DigestInit(EVP_MD_CTX *ctx, const EVP_MD *type)
|
int EVP_DigestInit(EVP_MD_CTX *ctx, const EVP_MD *type)
|
||||||
{
|
{
|
||||||
EVP_MD_CTX_init(ctx);
|
EVP_MD_CTX_reset(ctx);
|
||||||
return EVP_DigestInit_ex(ctx, type, NULL);
|
return EVP_DigestInit_ex(ctx, type, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -262,7 +262,7 @@ int EVP_DigestFinal(EVP_MD_CTX *ctx, unsigned char *md, unsigned int *size)
|
|||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
ret = EVP_DigestFinal_ex(ctx, md, size);
|
ret = EVP_DigestFinal_ex(ctx, md, size);
|
||||||
EVP_MD_CTX_init(ctx);
|
EVP_MD_CTX_reset(ctx);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -285,7 +285,7 @@ int EVP_DigestFinal_ex(EVP_MD_CTX *ctx, unsigned char *md, unsigned int *size)
|
|||||||
|
|
||||||
int EVP_MD_CTX_copy(EVP_MD_CTX *out, const EVP_MD_CTX *in)
|
int EVP_MD_CTX_copy(EVP_MD_CTX *out, const EVP_MD_CTX *in)
|
||||||
{
|
{
|
||||||
EVP_MD_CTX_init(out);
|
EVP_MD_CTX_reset(out);
|
||||||
return EVP_MD_CTX_copy_ex(out, in);
|
return EVP_MD_CTX_copy_ex(out, in);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -309,7 +309,7 @@ int EVP_MD_CTX_copy_ex(EVP_MD_CTX *out, const EVP_MD_CTX *in)
|
|||||||
EVP_MD_CTX_set_flags(out, EVP_MD_CTX_FLAG_REUSE);
|
EVP_MD_CTX_set_flags(out, EVP_MD_CTX_FLAG_REUSE);
|
||||||
} else
|
} else
|
||||||
tmp_buf = NULL;
|
tmp_buf = NULL;
|
||||||
EVP_MD_CTX_init(out);
|
EVP_MD_CTX_reset(out);
|
||||||
memcpy(out, in, sizeof(*out));
|
memcpy(out, in, sizeof(*out));
|
||||||
|
|
||||||
if (in->md_data && out->digest->ctx_size) {
|
if (in->md_data && out->digest->ctx_size) {
|
||||||
@ -330,7 +330,7 @@ int EVP_MD_CTX_copy_ex(EVP_MD_CTX *out, const EVP_MD_CTX *in)
|
|||||||
if (in->pctx) {
|
if (in->pctx) {
|
||||||
out->pctx = EVP_PKEY_CTX_dup(in->pctx);
|
out->pctx = EVP_PKEY_CTX_dup(in->pctx);
|
||||||
if (!out->pctx) {
|
if (!out->pctx) {
|
||||||
EVP_MD_CTX_init(out);
|
EVP_MD_CTX_reset(out);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -571,10 +571,10 @@ void BIO_set_md(BIO *, const EVP_MD *md);
|
|||||||
# define EVP_delete_digest_alias(alias) \
|
# define EVP_delete_digest_alias(alias) \
|
||||||
OBJ_NAME_remove(alias,OBJ_NAME_TYPE_MD_METH|OBJ_NAME_ALIAS);
|
OBJ_NAME_remove(alias,OBJ_NAME_TYPE_MD_METH|OBJ_NAME_ALIAS);
|
||||||
|
|
||||||
int EVP_MD_CTX_init(EVP_MD_CTX *ctx);
|
|
||||||
int EVP_MD_CTX_ctrl(EVP_MD_CTX *ctx, int cmd, int p1, void *p2);
|
int EVP_MD_CTX_ctrl(EVP_MD_CTX *ctx, int cmd, int p1, void *p2);
|
||||||
EVP_MD_CTX *EVP_MD_CTX_create(void);
|
EVP_MD_CTX *EVP_MD_CTX_new(void);
|
||||||
void EVP_MD_CTX_destroy(EVP_MD_CTX *ctx);
|
int EVP_MD_CTX_reset(EVP_MD_CTX *ctx);
|
||||||
|
void EVP_MD_CTX_free(EVP_MD_CTX *ctx);
|
||||||
/*__owur*/ int EVP_MD_CTX_copy_ex(EVP_MD_CTX *out, const EVP_MD_CTX *in);
|
/*__owur*/ int EVP_MD_CTX_copy_ex(EVP_MD_CTX *out, const EVP_MD_CTX *in);
|
||||||
void EVP_MD_CTX_set_flags(EVP_MD_CTX *ctx, int flags);
|
void EVP_MD_CTX_set_flags(EVP_MD_CTX *ctx, int flags);
|
||||||
void EVP_MD_CTX_clear_flags(EVP_MD_CTX *ctx, int flags);
|
void EVP_MD_CTX_clear_flags(EVP_MD_CTX *ctx, int flags);
|
||||||
|
@ -2066,7 +2066,7 @@ KRB5_APREQBODY_new 2626 NOEXIST::FUNCTION:
|
|||||||
X509V3_EXT_REQ_add_nconf 2627 EXIST::FUNCTION:
|
X509V3_EXT_REQ_add_nconf 2627 EXIST::FUNCTION:
|
||||||
ENGINE_ctrl_cmd_string 2628 EXIST::FUNCTION:ENGINE
|
ENGINE_ctrl_cmd_string 2628 EXIST::FUNCTION:ENGINE
|
||||||
i2d_OCSP_RESPDATA 2629 EXIST::FUNCTION:
|
i2d_OCSP_RESPDATA 2629 EXIST::FUNCTION:
|
||||||
EVP_MD_CTX_init 2630 EXIST::FUNCTION:
|
EVP_MD_CTX_reset 2630 EXIST::FUNCTION:
|
||||||
EXTENDED_KEY_USAGE_free 2631 EXIST::FUNCTION:
|
EXTENDED_KEY_USAGE_free 2631 EXIST::FUNCTION:
|
||||||
PKCS7_ATTR_SIGN_it 2632 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:
|
PKCS7_ATTR_SIGN_it 2632 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:
|
||||||
PKCS7_ATTR_SIGN_it 2632 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:
|
PKCS7_ATTR_SIGN_it 2632 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:
|
||||||
@ -2162,7 +2162,7 @@ ENGINE_load_builtin_engines 2708 EXIST::FUNCTION:ENGINE
|
|||||||
i2d_OCSP_ONEREQ 2709 EXIST::FUNCTION:
|
i2d_OCSP_ONEREQ 2709 EXIST::FUNCTION:
|
||||||
OCSP_REQUEST_add_ext 2710 EXIST::FUNCTION:
|
OCSP_REQUEST_add_ext 2710 EXIST::FUNCTION:
|
||||||
OCSP_RESPBYTES_new 2711 EXIST::FUNCTION:
|
OCSP_RESPBYTES_new 2711 EXIST::FUNCTION:
|
||||||
EVP_MD_CTX_create 2712 EXIST::FUNCTION:
|
EVP_MD_CTX_new 2712 EXIST::FUNCTION:
|
||||||
OCSP_resp_find_status 2713 EXIST::FUNCTION:
|
OCSP_resp_find_status 2713 EXIST::FUNCTION:
|
||||||
X509_ALGOR_it 2714 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:
|
X509_ALGOR_it 2714 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:
|
||||||
X509_ALGOR_it 2714 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:
|
X509_ALGOR_it 2714 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:
|
||||||
@ -2427,7 +2427,7 @@ BASIC_CONSTRAINTS_it 2922 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIA
|
|||||||
BASIC_CONSTRAINTS_it 2922 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:
|
BASIC_CONSTRAINTS_it 2922 EXIST:EXPORT_VAR_AS_FUNCTION:FUNCTION:
|
||||||
BN_mod_add_quick 2923 EXIST::FUNCTION:
|
BN_mod_add_quick 2923 EXIST::FUNCTION:
|
||||||
EC_POINT_new 2924 EXIST::FUNCTION:EC
|
EC_POINT_new 2924 EXIST::FUNCTION:EC
|
||||||
EVP_MD_CTX_destroy 2925 EXIST::FUNCTION:
|
EVP_MD_CTX_free 2925 EXIST::FUNCTION:
|
||||||
OCSP_RESPBYTES_free 2926 EXIST::FUNCTION:
|
OCSP_RESPBYTES_free 2926 EXIST::FUNCTION:
|
||||||
EVP_aes_128_cbc 2927 EXIST::FUNCTION:AES
|
EVP_aes_128_cbc 2927 EXIST::FUNCTION:AES
|
||||||
OCSP_SINGLERESP_get1_ext_d2i 2928 EXIST::FUNCTION:
|
OCSP_SINGLERESP_get1_ext_d2i 2928 EXIST::FUNCTION:
|
||||||
|
Loading…
Reference in New Issue
Block a user