diff --git a/lib/dns/dnssec.c b/lib/dns/dnssec.c index e0ef7c4747..971aa6f803 100644 --- a/lib/dns/dnssec.c +++ b/lib/dns/dnssec.c @@ -16,7 +16,7 @@ */ /* - * $Id: dnssec.c,v 1.19 2000/02/10 23:00:48 bwelling Exp $ + * $Id: dnssec.c,v 1.20 2000/02/23 23:30:28 halley Exp $ * Principal Author: Brian Wellington */ @@ -32,7 +32,6 @@ #include #include #include -#include #include #include @@ -50,9 +49,6 @@ #include #include -#define TRUSTED_KEY_MAGIC 0x54525354 /* TRST */ -#define VALID_TRUSTED_KEY(x) ((x) != NULL && (x)->magic == TRUSTED_KEY_MAGIC) - #define is_response(msg) (msg->flags & DNS_MESSAGEFLAG_QR) #define RETERR(x) do { \ @@ -62,16 +58,6 @@ } while (0) -typedef struct dns_trusted_key dns_trusted_key_t; - -struct dns_trusted_key { - unsigned int magic; /* Magic number. */ - isc_mem_t *mctx; - dst_key_t *key; /* Key */ - dns_name_t name; /* Key name */ - ISC_LINK(dns_trusted_key_t) link; -}; - #define TYPE_SIGN 0 #define TYPE_VERIFY 1 @@ -81,11 +67,6 @@ typedef struct digestctx { isc_uint8_t type; } digestctx_t; -/* XXXBEW If an unsorted list isn't good enough, this can be updated */ -static ISC_LIST(dns_trusted_key_t) trusted_keys; -static isc_rwlock_t trusted_key_lock; - - static isc_result_t digest_callback(void *arg, isc_region_t *data); static isc_result_t keyname_to_name(char *keyname, isc_mem_t *mctx, dns_name_t *name); @@ -173,37 +154,6 @@ rdataset_to_sortedarray(dns_rdataset_t *set, isc_mem_t *mctx, return (ISC_R_SUCCESS); } -isc_result_t -dns_dnssec_add_trusted_key(dst_key_t *key, isc_mem_t *mctx) { - dns_trusted_key_t *tkey; - isc_result_t ret; - - REQUIRE(key != NULL); - REQUIRE(mctx != NULL); - - tkey = isc_mem_get(mctx, sizeof(dns_trusted_key_t)); - if (tkey == NULL) - return (ISC_R_NOMEMORY); - - ret = keyname_to_name(dst_key_name(key), mctx, &tkey->name); - if (ret != ISC_R_SUCCESS) - goto cleanup; - - tkey->mctx = mctx; - ISC_LINK_INIT(tkey, link); - isc_rwlock_lock(&trusted_key_lock, isc_rwlocktype_write); - ISC_LIST_APPEND(trusted_keys, tkey, link); - isc_rwlock_unlock(&trusted_key_lock, isc_rwlocktype_write); - - tkey->mctx = mctx; - tkey->magic = TRUSTED_KEY_MAGIC; - return (ISC_R_SUCCESS); - -cleanup: - isc_mem_put(mctx, tkey, sizeof(dns_trusted_key_t)); - return (ret); -} - isc_result_t dns_dnssec_keyfromrdata(dns_name_t *name, dns_rdata_t *rdata, isc_mem_t *mctx, dst_key_t **key) @@ -502,33 +452,6 @@ cleanup_struct: return (ret); } -isc_result_t -dns_dnssec_init() { - isc_result_t ret; - - ret = isc_rwlock_init(&trusted_key_lock, 0, 0); - if (ret != ISC_R_SUCCESS) { - UNEXPECTED_ERROR(__FILE__, __LINE__, - "isc_rwlock_init() failed: %s", - isc_result_totext(ret)); - return (DNS_R_UNEXPECTED); - } - - ISC_LIST_INIT(trusted_keys); - - return (ISC_R_SUCCESS); -} - -void -dns_dnssec_destroy() { - while (!ISC_LIST_EMPTY(trusted_keys)) { - dns_trusted_key_t *key = ISC_LIST_HEAD(trusted_keys); - isc_mem_t *mctx = key->mctx; - dns_name_free(&key->name, mctx); - isc_mem_put(mctx, key, sizeof(dns_trusted_key_t)); - } -} - #define is_zone_key(key) ((dst_key_flags(key) & DNS_KEYFLAG_OWNERMASK) \ == DNS_KEYOWNER_ZONE) diff --git a/lib/dns/include/dns/dnssec.h b/lib/dns/include/dns/dnssec.h index ea438fa921..3a800b59da 100644 --- a/lib/dns/include/dns/dnssec.h +++ b/lib/dns/include/dns/dnssec.h @@ -28,20 +28,6 @@ ISC_LANG_BEGINDECLS -isc_result_t -dns_dnssec_add_trusted_key(dst_key_t *key, isc_mem_t *mctx); -/* - * Adds a key to the set of trusted keys. - * - * Requires: - * 'key' must be a valid DST_KEY * - * 'mctx' must be a valid isc_mem_t - * - * Returns: - * ISC_R_SUCCESS - * ISC_R_NOMEMORY - */ - isc_result_t dns_dnssec_keyfromrdata(dns_name_t *name, dns_rdata_t *rdata, isc_mem_t *mctx, dst_key_t **key); @@ -119,22 +105,6 @@ dns_dnssec_verify(dns_name_t *name, dns_rdataset_t *set, dst_key_t *key, * DST_R_* */ -isc_result_t -dns_dnssec_init(void); -/* - * Initializes the DNSSEC subsystem - * - * Returns: - * ISC_R_SUCCESS - * ISC_R_UNEXPECTED - */ - -void -dns_dnssec_destroy(void); -/* - * Frees all data associated with the DNSSEC subsystem - */ - isc_result_t dns_dnssec_findzonekeys(dns_db_t *db, dns_dbversion_t *ver, dns_dbnode_t *node, dns_name_t *name, isc_mem_t *mctx, unsigned int maxkeys,