summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorFlorian Obser <florian@cvs.openbsd.org>2020-02-23 08:53:20 +0000
committerFlorian Obser <florian@cvs.openbsd.org>2020-02-23 08:53:20 +0000
commit7213f54139cecf5e85f0df8b8f4ede86ece85dd1 (patch)
treefead393126bee8de03a12f39ab1814f1aa20652c /usr.bin
parent67be56c2eb5348710ab4b63f9ce2cda25089ea91 (diff)
hmacs do not support NULL keys
OK millert, jung
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/dig/lib/dns/dst_api.c16
-rw-r--r--usr.bin/dig/lib/dns/dst_internal.h11
2 files changed, 3 insertions, 24 deletions
diff --git a/usr.bin/dig/lib/dns/dst_api.c b/usr.bin/dig/lib/dns/dst_api.c
index 0fc5bba7c37..c5917579c94 100644
--- a/usr.bin/dig/lib/dns/dst_api.c
+++ b/usr.bin/dig/lib/dns/dst_api.c
@@ -33,7 +33,7 @@
/*
* Principal Author: Brian Wellington
- * $Id: dst_api.c,v 1.9 2020/02/23 08:52:50 florian Exp $
+ * $Id: dst_api.c,v 1.10 2020/02/23 08:53:19 florian Exp $
*/
/*! \file */
@@ -150,9 +150,6 @@ dst_context_create3(dst_key_t *key,
REQUIRE(dst_initialized == ISC_TRUE);
REQUIRE(dctxp != NULL && *dctxp == NULL);
- if (key->keydata.generic == NULL)
- return (DST_R_NULLKEY);
-
dctx = malloc(sizeof(dst_context_t));
if (dctx == NULL)
return (ISC_R_NOMEMORY);
@@ -202,8 +199,6 @@ dst_context_sign(dst_context_t *dctx, isc_buffer_t *sig) {
key = dctx->key;
CHECKALG(key->key_alg);
- if (key->keydata.generic == NULL)
- return (DST_R_NULLKEY);
return (key->func->sign(dctx, sig));
}
@@ -213,8 +208,6 @@ dst_context_verify(dst_context_t *dctx, isc_region_t *sig) {
REQUIRE(sig != NULL);
CHECKALG(dctx->key->key_alg);
- if (dctx->key->keydata.generic == NULL)
- return (DST_R_NULLKEY);
return (dctx->key->func->verify(dctx, sig));
}
@@ -240,9 +233,6 @@ dst_key_todns(const dst_key_t *key, isc_buffer_t *target) {
& 0xffff));
}
- if (key->keydata.generic == NULL) /*%< NULL KEY */
- return (ISC_R_SUCCESS);
-
return (key->func->todns(key, target));
}
@@ -297,8 +287,7 @@ dst_key_free(dst_key_t **keyp) {
return;
isc_refcount_destroy(&key->refs);
- if (key->keydata.generic != NULL)
- key->func->destroy(key);
+ key->func->destroy(key);
if (key->engine != NULL)
free(key->engine);
if (key->label != NULL)
@@ -388,7 +377,6 @@ get_key_struct(dns_name_t *name, unsigned int alg,
key->key_alg = alg;
key->key_flags = flags;
key->key_proto = protocol;
- key->keydata.generic = NULL;
key->key_size = bits;
key->key_class = rdclass;
key->key_ttl = ttl;
diff --git a/usr.bin/dig/lib/dns/dst_internal.h b/usr.bin/dig/lib/dns/dst_internal.h
index d76ebd8d6de..35a7f746c6c 100644
--- a/usr.bin/dig/lib/dns/dst_internal.h
+++ b/usr.bin/dig/lib/dns/dst_internal.h
@@ -31,7 +31,7 @@
* IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: dst_internal.h,v 1.9 2020/02/23 08:52:50 florian Exp $ */
+/* $Id: dst_internal.h,v 1.10 2020/02/23 08:53:19 florian Exp $ */
#ifndef DST_DST_INTERNAL_H
#define DST_DST_INTERNAL_H 1
@@ -48,9 +48,7 @@
#include <dst/dst.h>
#include <openssl/err.h>
-#include <openssl/evp.h>
#include <openssl/objects.h>
-#include <openssl/rsa.h>
/***
*** Types
@@ -87,8 +85,6 @@ struct dst_key {
char *engine; /*%< engine name (HSM) */
char *label; /*%< engine label (HSM) */
union {
- void *generic;
- EVP_PKEY *pkey;
dst_hmacsha1_key_t *hmacsha1;
dst_hmacsha224_key_t *hmacsha224;
dst_hmacsha256_key_t *hmacsha256;
@@ -117,16 +113,11 @@ struct dst_context {
dst_key_t *key;
isc_logcategory_t *category;
union {
- void *generic;
- isc_sha1_t *sha1ctx;
- isc_sha256_t *sha256ctx;
- isc_sha512_t *sha512ctx;
isc_hmacsha1_t *hmacsha1ctx;
isc_hmacsha224_t *hmacsha224ctx;
isc_hmacsha256_t *hmacsha256ctx;
isc_hmacsha384_t *hmacsha384ctx;
isc_hmacsha512_t *hmacsha512ctx;
- EVP_MD_CTX *evp_md_ctx;
} ctxdata;
};