diff options
author | Richard Levitte <levitte@openssl.org> | 2015-12-02 00:26:19 +0100 |
---|---|---|
committer | Richard Levitte <levitte@openssl.org> | 2015-12-07 17:39:23 +0100 |
commit | 959ed5316c84d0e12ad18acfd40cefe15603ddfb (patch) | |
tree | 3856dabccdc4091e6feea61ec831695ce090e57b /crypto/evp/digest.c | |
parent | 67565323589932ef36e84d95b07bcc97325c9961 (diff) | |
download | openssl-959ed5316c84d0e12ad18acfd40cefe15603ddfb.tar.gz |
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>
Diffstat (limited to 'crypto/evp/digest.c')
-rw-r--r-- | crypto/evp/digest.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/crypto/evp/digest.c b/crypto/evp/digest.c index ec05930f86..0b1af6f3c6 100644 --- a/crypto/evp/digest.c +++ b/crypto/evp/digest.c @@ -120,7 +120,7 @@ #include "evp_locl.h" /* 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) return 1; @@ -150,20 +150,20 @@ int EVP_MD_CTX_init(EVP_MD_CTX *ctx) 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)); } -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); } 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); } @@ -262,7 +262,7 @@ int EVP_DigestFinal(EVP_MD_CTX *ctx, unsigned char *md, unsigned int *size) { int ret; ret = EVP_DigestFinal_ex(ctx, md, size); - EVP_MD_CTX_init(ctx); + EVP_MD_CTX_reset(ctx); 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) { - EVP_MD_CTX_init(out); + EVP_MD_CTX_reset(out); 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); } else tmp_buf = NULL; - EVP_MD_CTX_init(out); + EVP_MD_CTX_reset(out); memcpy(out, in, sizeof(*out)); 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) { out->pctx = EVP_PKEY_CTX_dup(in->pctx); if (!out->pctx) { - EVP_MD_CTX_init(out); + EVP_MD_CTX_reset(out); return 0; } } |