aboutsummaryrefslogtreecommitdiff
path: root/crypto/evp/mac_meth.c
diff options
context:
space:
mode:
authorTomas Mraz <tomas@openssl.org>2021-04-16 16:22:03 +0200
committerTomas Mraz <tomas@openssl.org>2021-04-26 12:05:05 +0200
commit6c9bc258d2e9e7b500236a1c696da1f384f0b907 (patch)
tree28928eb5dc1acc246c1b3309328aea2031056ce3 /crypto/evp/mac_meth.c
parentd21224f1adcd948699e536eaf570f42ef9a051f7 (diff)
downloadopenssl-6c9bc258d2e9e7b500236a1c696da1f384f0b907.zip
openssl-6c9bc258d2e9e7b500236a1c696da1f384f0b907.tar.gz
openssl-6c9bc258d2e9e7b500236a1c696da1f384f0b907.tar.bz2
Add type_name member to provided methods and use it
Fixes #14701 Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/14898)
Diffstat (limited to 'crypto/evp/mac_meth.c')
-rw-r--r--crypto/evp/mac_meth.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/crypto/evp/mac_meth.c b/crypto/evp/mac_meth.c
index bd43e88..342aadc 100644
--- a/crypto/evp/mac_meth.c
+++ b/crypto/evp/mac_meth.c
@@ -2,8 +2,9 @@
#include <openssl/err.h>
#include <openssl/core.h>
#include <openssl/core_dispatch.h>
-#include "crypto/evp.h"
#include "internal/provider.h"
+#include "internal/core.h"
+#include "crypto/evp.h"
#include "evp_local.h"
static int evp_mac_up_ref(void *vmac)
@@ -26,6 +27,7 @@ static void evp_mac_free(void *vmac)
CRYPTO_DOWN_REF(&mac->refcnt, &ref, mac->lock);
if (ref > 0)
return;
+ OPENSSL_free(mac->type_name);
ossl_provider_free(mac->prov);
CRYPTO_THREAD_lock_free(mac->lock);
OPENSSL_free(mac);
@@ -59,6 +61,10 @@ static void *evp_mac_from_algorithm(int name_id,
return NULL;
}
mac->name_id = name_id;
+ if ((mac->type_name = ossl_algorithm_get1_first_name(algodef)) == NULL) {
+ evp_mac_free(mac);
+ return NULL;
+ }
mac->description = algodef->algorithm_description;
for (; fns->function_id != 0; fns++) {