From 627b73cc72d0c42a01c464b8b567ea0f7d907e05 Mon Sep 17 00:00:00 2001 From: Pauli Date: Mon, 16 Nov 2020 11:52:39 +1000 Subject: [PATCH] Rename md5_sha1_* ossl_md5_sha1_* md5_sha1_init(), md5_sha1_update(), md5_sha1_final() and md5_sha1_ctrl(). Reviewed-by: Tim Hudson (Merged from https://github.com/openssl/openssl/pull/13417) --- crypto/evp/legacy_md5_sha1.c | 4 ++-- crypto/md5/md5_sha1.c | 14 +++++++------- providers/implementations/digests/md5_sha1_prov.c | 6 +++--- providers/implementations/include/prov/md5_sha1.h | 8 ++++---- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/crypto/evp/legacy_md5_sha1.c b/crypto/evp/legacy_md5_sha1.c index a332e29941c..7002bc275cd 100644 --- a/crypto/evp/legacy_md5_sha1.c +++ b/crypto/evp/legacy_md5_sha1.c @@ -18,10 +18,10 @@ #include "prov/md5_sha1.h" /* diverse MD5_SHA1 macros */ #include "legacy_meth.h" -IMPLEMENT_LEGACY_EVP_MD_METH_LC(md5_sha1_int, md5_sha1) +IMPLEMENT_LEGACY_EVP_MD_METH_LC(md5_sha1_int, ossl_md5_sha1) static int md5_sha1_int_ctrl(EVP_MD_CTX *ctx, int cmd, int mslen, void *ms) { - return md5_sha1_ctrl(EVP_MD_CTX_md_data(ctx), cmd, mslen, ms); + return ossl_md5_sha1_ctrl(EVP_MD_CTX_md_data(ctx), cmd, mslen, ms); } static const EVP_MD md5_sha1_md = { diff --git a/crypto/md5/md5_sha1.c b/crypto/md5/md5_sha1.c index db359dba2fa..56defab163f 100644 --- a/crypto/md5/md5_sha1.c +++ b/crypto/md5/md5_sha1.c @@ -17,28 +17,28 @@ #include "prov/md5_sha1.h" #include -int md5_sha1_init(MD5_SHA1_CTX *mctx) +int ossl_md5_sha1_init(MD5_SHA1_CTX *mctx) { if (!MD5_Init(&mctx->md5)) return 0; return SHA1_Init(&mctx->sha1); } -int md5_sha1_update(MD5_SHA1_CTX *mctx, const void *data, size_t count) +int ossl_md5_sha1_update(MD5_SHA1_CTX *mctx, const void *data, size_t count) { if (!MD5_Update(&mctx->md5, data, count)) return 0; return SHA1_Update(&mctx->sha1, data, count); } -int md5_sha1_final(unsigned char *md, MD5_SHA1_CTX *mctx) +int ossl_md5_sha1_final(unsigned char *md, MD5_SHA1_CTX *mctx) { if (!MD5_Final(md, &mctx->md5)) return 0; return SHA1_Final(md + MD5_DIGEST_LENGTH, &mctx->sha1); } -int md5_sha1_ctrl(MD5_SHA1_CTX *mctx, int cmd, int mslen, void *ms) +int ossl_md5_sha1_ctrl(MD5_SHA1_CTX *mctx, int cmd, int mslen, void *ms) { unsigned char padtmp[48]; unsigned char md5tmp[MD5_DIGEST_LENGTH]; @@ -58,7 +58,7 @@ int md5_sha1_ctrl(MD5_SHA1_CTX *mctx, int cmd, int mslen, void *ms) * with master secret and pad_1. */ - if (md5_sha1_update(mctx, ms, mslen) <= 0) + if (ossl_md5_sha1_update(mctx, ms, mslen) <= 0) return 0; /* Set padtmp to pad_1 value */ @@ -78,10 +78,10 @@ int md5_sha1_ctrl(MD5_SHA1_CTX *mctx, int cmd, int mslen, void *ms) /* Reinitialise context */ - if (!md5_sha1_init(mctx)) + if (!ossl_md5_sha1_init(mctx)) return 0; - if (md5_sha1_update(mctx, ms, mslen) <= 0) + if (ossl_md5_sha1_update(mctx, ms, mslen) <= 0) return 0; /* Set padtmp to pad_2 value */ diff --git a/providers/implementations/digests/md5_sha1_prov.c b/providers/implementations/digests/md5_sha1_prov.c index 7c127d74a64..d96b72676b6 100644 --- a/providers/implementations/digests/md5_sha1_prov.c +++ b/providers/implementations/digests/md5_sha1_prov.c @@ -44,8 +44,8 @@ static int md5_sha1_set_ctx_params(void *vctx, const OSSL_PARAM params[]) if (ctx != NULL && params != NULL) { p = OSSL_PARAM_locate_const(params, OSSL_DIGEST_PARAM_SSL3_MS); if (p != NULL && p->data_type == OSSL_PARAM_OCTET_STRING) - return md5_sha1_ctrl(ctx, EVP_CTRL_SSL3_MASTER_SECRET, p->data_size, - p->data); + return ossl_md5_sha1_ctrl(ctx, EVP_CTRL_SSL3_MASTER_SECRET, + p->data_size, p->data); } return 0; } @@ -53,5 +53,5 @@ static int md5_sha1_set_ctx_params(void *vctx, const OSSL_PARAM params[]) /* ossl_md5_sha1_functions */ IMPLEMENT_digest_functions_with_settable_ctx( md5_sha1, MD5_SHA1_CTX, MD5_SHA1_CBLOCK, MD5_SHA1_DIGEST_LENGTH, 0, - md5_sha1_init, md5_sha1_update, md5_sha1_final, + ossl_md5_sha1_init, ossl_md5_sha1_update, ossl_md5_sha1_final, md5_sha1_settable_ctx_params, md5_sha1_set_ctx_params) diff --git a/providers/implementations/include/prov/md5_sha1.h b/providers/implementations/include/prov/md5_sha1.h index 3e80fdcf979..9b9dc3d5efc 100644 --- a/providers/implementations/include/prov/md5_sha1.h +++ b/providers/implementations/include/prov/md5_sha1.h @@ -27,10 +27,10 @@ typedef struct md5_sha1_st { SHA_CTX sha1; } MD5_SHA1_CTX; -int md5_sha1_init(MD5_SHA1_CTX *mctx); -int md5_sha1_update(MD5_SHA1_CTX *mctx, const void *data, size_t count); -int md5_sha1_final(unsigned char *md, MD5_SHA1_CTX *mctx); -int md5_sha1_ctrl(MD5_SHA1_CTX *mctx, int cmd, int mslen, void *ms); +int ossl_md5_sha1_init(MD5_SHA1_CTX *mctx); +int ossl_md5_sha1_update(MD5_SHA1_CTX *mctx, const void *data, size_t count); +int ossl_md5_sha1_final(unsigned char *md, MD5_SHA1_CTX *mctx); +int ossl_md5_sha1_ctrl(MD5_SHA1_CTX *mctx, int cmd, int mslen, void *ms); # endif /* OPENSSL_NO_MD5 */ -- 2.47.2