summaryrefslogtreecommitdiffstats
path: root/crypto/evp
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/evp')
-rw-r--r--crypto/evp/mac_lib.c20
-rw-r--r--crypto/evp/p_lib.c6
-rw-r--r--crypto/evp/pkey_mac.c37
3 files changed, 31 insertions, 32 deletions
diff --git a/crypto/evp/mac_lib.c b/crypto/evp/mac_lib.c
index 8fe9708797..b7bfe8921f 100644
--- a/crypto/evp/mac_lib.c
+++ b/crypto/evp/mac_lib.c
@@ -19,14 +19,14 @@
#include "internal/provider.h"
#include "evp_local.h"
-EVP_MAC_CTX *EVP_MAC_new_ctx(EVP_MAC *mac)
+EVP_MAC_CTX *EVP_MAC_CTX_new(EVP_MAC *mac)
{
EVP_MAC_CTX *ctx = OPENSSL_zalloc(sizeof(EVP_MAC_CTX));
if (ctx == NULL
|| (ctx->data = mac->newctx(ossl_provider_ctx(mac->prov))) == NULL
|| !EVP_MAC_up_ref(mac)) {
- EVPerr(0, ERR_R_MALLOC_FAILURE);
+ EVPerr(EVP_F_EVP_MAC_CTX_NEW, ERR_R_MALLOC_FAILURE);
if (ctx != NULL)
mac->freectx(ctx->data);
OPENSSL_free(ctx);
@@ -37,7 +37,7 @@ EVP_MAC_CTX *EVP_MAC_new_ctx(EVP_MAC *mac)
return ctx;
}
-void EVP_MAC_free_ctx(EVP_MAC_CTX *ctx)
+void EVP_MAC_CTX_free(EVP_MAC_CTX *ctx)
{
if (ctx != NULL) {
ctx->meth->freectx(ctx->data);
@@ -48,7 +48,7 @@ void EVP_MAC_free_ctx(EVP_MAC_CTX *ctx)
OPENSSL_free(ctx);
}
-EVP_MAC_CTX *EVP_MAC_dup_ctx(const EVP_MAC_CTX *src)
+EVP_MAC_CTX *EVP_MAC_CTX_dup(const EVP_MAC_CTX *src)
{
EVP_MAC_CTX *dst;
@@ -57,27 +57,27 @@ EVP_MAC_CTX *EVP_MAC_dup_ctx(const EVP_MAC_CTX *src)
dst = OPENSSL_malloc(sizeof(*dst));
if (dst == NULL) {
- EVPerr(0, ERR_R_MALLOC_FAILURE);
+ EVPerr(EVP_F_EVP_MAC_CTX_DUP, ERR_R_MALLOC_FAILURE);
return NULL;
}
*dst = *src;
if (!EVP_MAC_up_ref(dst->meth)) {
- EVPerr(0, ERR_R_MALLOC_FAILURE);
+ EVPerr(EVP_F_EVP_MAC_CTX_DUP, ERR_R_MALLOC_FAILURE);
OPENSSL_free(dst);
return NULL;
}
dst->data = src->meth->dupctx(src->data);
if (dst->data == NULL) {
- EVP_MAC_free_ctx(dst);
+ EVP_MAC_CTX_free(dst);
return NULL;
}
return dst;
}
-EVP_MAC *EVP_MAC_get_ctx_mac(EVP_MAC_CTX *ctx)
+EVP_MAC *EVP_MAC_CTX_mac(EVP_MAC_CTX *ctx)
{
return ctx->meth;
}
@@ -144,14 +144,14 @@ int EVP_MAC_get_params(EVP_MAC *mac, OSSL_PARAM params[])
return 1;
}
-int EVP_MAC_get_ctx_params(EVP_MAC_CTX *ctx, OSSL_PARAM params[])
+int EVP_MAC_CTX_get_params(EVP_MAC_CTX *ctx, OSSL_PARAM params[])
{
if (ctx->meth->get_ctx_params != NULL)
return ctx->meth->get_ctx_params(ctx->data, params);
return 1;
}
-int EVP_MAC_set_ctx_params(EVP_MAC_CTX *ctx, const OSSL_PARAM params[])
+int EVP_MAC_CTX_set_params(EVP_MAC_CTX *ctx, const OSSL_PARAM params[])
{
if (ctx->meth->set_ctx_params != NULL)
return ctx->meth->set_ctx_params(ctx->data, params);
diff --git a/crypto/evp/p_lib.c b/crypto/evp/p_lib.c
index 4dc1e0a5b2..aa11608688 100644
--- a/crypto/evp/p_lib.c
+++ b/crypto/evp/p_lib.c
@@ -595,7 +595,7 @@ EVP_PKEY *EVP_PKEY_new_CMAC_key(ENGINE *e, const unsigned char *priv,
prov == NULL ? NULL : ossl_provider_library_context(prov);
EVP_PKEY *ret = EVP_PKEY_new();
EVP_MAC *cmac = EVP_MAC_fetch(libctx, OSSL_MAC_NAME_CMAC, NULL);
- EVP_MAC_CTX *cmctx = cmac != NULL ? EVP_MAC_new_ctx(cmac) : NULL;
+ EVP_MAC_CTX *cmctx = cmac != NULL ? EVP_MAC_CTX_new(cmac) : NULL;
OSSL_PARAM params[4];
size_t paramsn = 0;
@@ -620,7 +620,7 @@ EVP_PKEY *EVP_PKEY_new_CMAC_key(ENGINE *e, const unsigned char *priv,
(char *)priv, len);
params[paramsn] = OSSL_PARAM_construct_end();
- if (!EVP_MAC_set_ctx_params(cmctx, params)) {
+ if (!EVP_MAC_CTX_set_params(cmctx, params)) {
EVPerr(EVP_F_EVP_PKEY_NEW_CMAC_KEY, EVP_R_KEY_SETUP_FAILED);
goto err;
}
@@ -630,7 +630,7 @@ EVP_PKEY *EVP_PKEY_new_CMAC_key(ENGINE *e, const unsigned char *priv,
err:
EVP_PKEY_free(ret);
- EVP_MAC_free_ctx(cmctx);
+ EVP_MAC_CTX_free(cmctx);
EVP_MAC_free(cmac);
return NULL;
# else
diff --git a/crypto/evp/pkey_mac.c b/crypto/evp/pkey_mac.c
index 784fca956d..7e36b3c6bd 100644
--- a/crypto/evp/pkey_mac.c
+++ b/crypto/evp/pkey_mac.c
@@ -74,7 +74,7 @@ static int pkey_mac_init(EVP_PKEY_CTX *ctx)
}
if (mac != NULL) {
- hctx->ctx = EVP_MAC_new_ctx(mac);
+ hctx->ctx = EVP_MAC_CTX_new(mac);
if (hctx->ctx == NULL) {
OPENSSL_free(hctx);
return 0;
@@ -119,7 +119,7 @@ static int pkey_mac_copy(EVP_PKEY_CTX *dst, const EVP_PKEY_CTX *src)
EVP_PKEY_CTX_set_data(dst, dctx);
dst->keygen_info_count = 0;
- dctx->ctx = EVP_MAC_dup_ctx(sctx->ctx);
+ dctx->ctx = EVP_MAC_CTX_dup(sctx->ctx);
if (dctx->ctx == NULL)
goto err;
@@ -131,7 +131,7 @@ static int pkey_mac_copy(EVP_PKEY_CTX *dst, const EVP_PKEY_CTX *src)
* fetches the MAC method anew in this case. Therefore, its reference
* count must be adjusted here.
*/
- if (!EVP_MAC_up_ref(EVP_MAC_get_ctx_mac(dctx->ctx)))
+ if (!EVP_MAC_up_ref(EVP_MAC_CTX_mac(dctx->ctx)))
goto err;
dctx->type = sctx->type;
@@ -166,8 +166,7 @@ static void pkey_mac_cleanup(EVP_PKEY_CTX *ctx)
MAC_PKEY_CTX *hctx = ctx == NULL ? NULL : EVP_PKEY_CTX_get_data(ctx);
if (hctx != NULL) {
- EVP_MAC *mac = hctx->ctx != NULL ? EVP_MAC_get_ctx_mac(hctx->ctx)
- : NULL;
+ EVP_MAC *mac = hctx->ctx != NULL ? EVP_MAC_CTX_mac(hctx->ctx) : NULL;
switch (hctx->type) {
case MAC_TYPE_RAW:
@@ -175,7 +174,7 @@ static void pkey_mac_cleanup(EVP_PKEY_CTX *ctx)
hctx->raw_data.ktmp.length);
break;
}
- EVP_MAC_free_ctx(hctx->ctx);
+ EVP_MAC_CTX_free(hctx->ctx);
EVP_MAC_free(mac);
OPENSSL_free(hctx);
EVP_PKEY_CTX_set_data(ctx, NULL);
@@ -210,10 +209,10 @@ static int pkey_mac_keygen(EVP_PKEY_CTX *ctx, EVP_PKEY *pkey)
return 0;
}
- cmkey = EVP_MAC_dup_ctx(hctx->ctx);
+ cmkey = EVP_MAC_CTX_dup(hctx->ctx);
if (cmkey == NULL)
return 0;
- if (!EVP_MAC_up_ref(EVP_MAC_get_ctx_mac(hctx->ctx)))
+ if (!EVP_MAC_up_ref(EVP_MAC_CTX_mac(hctx->ctx)))
return 0;
EVP_PKEY_assign(pkey, nid, cmkey);
}
@@ -259,7 +258,7 @@ static int pkey_mac_signctx_init(EVP_PKEY_CTX *ctx, EVP_MD_CTX *mctx)
}
if (set_key) {
- if (!EVP_MAC_is_a(EVP_MAC_get_ctx_mac(hctx->ctx),
+ if (!EVP_MAC_is_a(EVP_MAC_CTX_mac(hctx->ctx),
OBJ_nid2sn(EVP_PKEY_id(EVP_PKEY_CTX_get0_pkey(ctx)))))
return 0;
key = EVP_PKEY_get0(EVP_PKEY_CTX_get0_pkey(ctx));
@@ -284,7 +283,7 @@ static int pkey_mac_signctx_init(EVP_PKEY_CTX *ctx, EVP_MD_CTX *mctx)
OSSL_PARAM_construct_octet_string(OSSL_MAC_PARAM_KEY,
key->data, key->length);
params[params_n++] = OSSL_PARAM_construct_end();
- rv = EVP_MAC_set_ctx_params(hctx->ctx, params);
+ rv = EVP_MAC_CTX_set_params(hctx->ctx, params);
}
return rv;
}
@@ -334,7 +333,7 @@ static int pkey_mac_ctrl(EVP_PKEY_CTX *ctx, int type, int p1, void *p2)
return 0;
}
- if (!EVP_MAC_set_ctx_params(hctx->ctx, params)
+ if (!EVP_MAC_CTX_set_params(hctx->ctx, params)
|| !EVP_MAC_init(hctx->ctx))
return 0;
}
@@ -355,10 +354,10 @@ static int pkey_mac_ctrl(EVP_PKEY_CTX *ctx, int type, int p1, void *p2)
if (ctx->pkey == NULL)
return 0;
- new_mac_ctx = EVP_MAC_dup_ctx(ctx->pkey->pkey.ptr);
+ new_mac_ctx = EVP_MAC_CTX_dup(ctx->pkey->pkey.ptr);
if (new_mac_ctx == NULL)
return 0;
- EVP_MAC_free_ctx(hctx->ctx);
+ EVP_MAC_CTX_free(hctx->ctx);
hctx->ctx = new_mac_ctx;
}
break;
@@ -393,13 +392,13 @@ static int pkey_mac_ctrl(EVP_PKEY_CTX *ctx, int type, int p1, void *p2)
return 0;
}
- if (!EVP_MAC_set_ctx_params(hctx->ctx, params))
+ if (!EVP_MAC_CTX_set_params(hctx->ctx, params))
return 0;
params[0] =
OSSL_PARAM_construct_size_t(OSSL_MAC_PARAM_SIZE, &verify);
- if (!EVP_MAC_get_ctx_params(hctx->ctx, params))
+ if (!EVP_MAC_CTX_get_params(hctx->ctx, params))
return 0;
/*
@@ -437,7 +436,7 @@ static int pkey_mac_ctrl(EVP_PKEY_CTX *ctx, int type, int p1, void *p2)
return 0;
}
- return EVP_MAC_set_ctx_params(hctx->ctx, params);
+ return EVP_MAC_CTX_set_params(hctx->ctx, params);
}
break;
default:
@@ -482,7 +481,7 @@ static int pkey_mac_ctrl(EVP_PKEY_CTX *ctx, int type, int p1, void *p2)
key->data, key->length);
params[params_n] = OSSL_PARAM_construct_end();
- return EVP_MAC_set_ctx_params(hctx->ctx, params);
+ return EVP_MAC_CTX_set_params(hctx->ctx, params);
}
break;
case MAC_TYPE_MAC:
@@ -517,7 +516,7 @@ static int pkey_mac_ctrl_str(EVP_PKEY_CTX *ctx,
EVPerr(0, EVP_R_FETCH_FAILED);
return 0;
}
- mac = EVP_MAC_get_ctx_mac(hctx->ctx);
+ mac = EVP_MAC_CTX_mac(hctx->ctx);
/*
* Translation of some control names that are equivalent to a single
@@ -539,7 +538,7 @@ static int pkey_mac_ctrl_str(EVP_PKEY_CTX *ctx,
return 0;
params[1] = OSSL_PARAM_construct_end();
- ok = EVP_MAC_set_ctx_params(hctx->ctx, params);
+ ok = EVP_MAC_CTX_set_params(hctx->ctx, params);
OPENSSL_free(params[0].data);
return ok;
}