#include <openssl/evp.h>
#include <openssl/err.h>
#include <openssl/core.h>
-#include <openssl/core_numbers.h>
-#include "internal/evp_int.h"
+#include <openssl/core_dispatch.h>
+#include "crypto/evp.h"
#include "internal/provider.h"
-#include "evp_locl.h"
+#include "evp_local.h"
static int evp_mac_up_ref(void *vmac)
{
if (ref > 0)
return;
ossl_provider_free(mac->prov);
- OPENSSL_free(mac->name);
CRYPTO_THREAD_lock_free(mac->lock);
OPENSSL_free(mac);
}
return mac;
}
-static void *evp_mac_from_dispatch(const char *name, const OSSL_DISPATCH *fns,
+static void *evp_mac_from_dispatch(int name_id,
+ const OSSL_DISPATCH *fns,
OSSL_PROVIDER *prov)
{
EVP_MAC *mac = NULL;
int fnmaccnt = 0, fnctxcnt = 0;
- if ((mac = evp_mac_new()) == NULL
- || (mac->name = OPENSSL_strdup(name)) == NULL) {
- EVP_MAC_free(mac);
+ if ((mac = evp_mac_new()) == NULL) {
EVPerr(0, ERR_R_MALLOC_FAILURE);
return NULL;
}
+ mac->name_id = name_id;
for (; fns->function_id != 0; fns++) {
switch (fns->function_id) {
break;
mac->get_params = OSSL_get_OP_mac_get_params(fns);
break;
- case OSSL_FUNC_MAC_CTX_GET_PARAMS:
- if (mac->ctx_get_params != NULL)
+ case OSSL_FUNC_MAC_GET_CTX_PARAMS:
+ if (mac->get_ctx_params != NULL)
break;
- mac->ctx_get_params = OSSL_get_OP_mac_ctx_get_params(fns);
+ mac->get_ctx_params = OSSL_get_OP_mac_get_ctx_params(fns);
break;
- case OSSL_FUNC_MAC_CTX_SET_PARAMS:
- if (mac->ctx_set_params != NULL)
+ case OSSL_FUNC_MAC_SET_CTX_PARAMS:
+ if (mac->set_ctx_params != NULL)
break;
- mac->ctx_set_params = OSSL_get_OP_mac_ctx_set_params(fns);
+ mac->set_ctx_params = OSSL_get_OP_mac_set_ctx_params(fns);
break;
}
}
evp_mac_free(mac);
}
-const char *EVP_MAC_name(const EVP_MAC *mac)
-{
- return mac->name;
-}
-
const OSSL_PROVIDER *EVP_MAC_provider(const EVP_MAC *mac)
{
return mac->prov;
return mac->gettable_params();
}
-const OSSL_PARAM *EVP_MAC_CTX_gettable_params(const EVP_MAC *mac)
+const OSSL_PARAM *EVP_MAC_gettable_ctx_params(const EVP_MAC *mac)
{
if (mac->gettable_ctx_params == NULL)
return NULL;
return mac->gettable_ctx_params();
}
-const OSSL_PARAM *EVP_MAC_CTX_settable_params(const EVP_MAC *mac)
+const OSSL_PARAM *EVP_MAC_settable_ctx_params(const EVP_MAC *mac)
{
if (mac->settable_ctx_params == NULL)
return NULL;
return mac->settable_ctx_params();
}
+
+void EVP_MAC_do_all_provided(OPENSSL_CTX *libctx,
+ void (*fn)(EVP_MAC *mac, void *arg),
+ void *arg)
+{
+ evp_generic_do_all(libctx, OSSL_OP_MAC,
+ (void (*)(void *, void *))fn, arg,
+ evp_mac_from_dispatch, evp_mac_free);
+}