Commit a9bc95f2 authored by Brian Wellington's avatar Brian Wellington
Browse files

dst now stores the key name as a dns_name_t, not a char *.

parent 8a01e235
206. [cleanup] dst now stores the key name as a dns_name_t, not
a char *.
205. [cleanup] On IRIX, turn off the mostly harmless warnings 1692
("prototyped function redeclared without prototype")
and 1552 ("variable ... set but not used") when
......
......@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THE SOFTWARE.
*/
/* $Id: dnssec-keygen.c,v 1.25 2000/05/24 17:13:29 bwelling Exp $ */
/* $Id: dnssec-keygen.c,v 1.26 2000/05/24 23:13:12 bwelling Exp $ */
#include <config.h>
......@@ -28,8 +28,12 @@
#include <isc/string.h>
#include <isc/util.h>
#include <dns/fixedname.h>
#include <dns/keyvalues.h>
#include <dns/name.h>
#include <dns/result.h>
#include <dns/secalg.h>
#include <dst/dst.h>
#include <dst/result.h>
......@@ -114,7 +118,8 @@ main(int argc, char **argv) {
char *algname = NULL, *nametype = NULL, *type = NULL;
char *prog, *endp;
dst_key_t *key = NULL, *oldkey;
char *name = NULL;
dns_fixedname_t fname;
dns_name_t *name;
isc_uint16_t flags = 0;
dns_secalg_t alg;
isc_boolean_t conflict = ISC_FALSE, null_key = ISC_FALSE;
......@@ -138,6 +143,9 @@ main(int argc, char **argv) {
if (argc == 1)
usage();
dns_result_register();
dst_result_register();
while ((ch = isc_commandline_parse(argc, argv,
"a:b:eg:n:t:p:s:hv:")) != -1)
{
......@@ -295,16 +303,15 @@ main(int argc, char **argv) {
fatal("Specified null key with signing authority");
}
name = isc_mem_allocate(mctx, strlen(argv[isc_commandline_index]) + 2);
if (name == NULL)
fatal("out of memory");
strcpy(name, argv[isc_commandline_index]);
if (name[strlen(name) - 1] != '.') {
strcat(name, ".");
fprintf(stderr,
"%s: added a trailing dot to fully qualify the name\n",
PROGRAM);
}
dns_fixedname_init(&fname);
name = dns_fixedname_name(&fname);
isc_buffer_init(&buf, argv[isc_commandline_index],
strlen(argv[isc_commandline_index]));
isc_buffer_add(&buf, strlen(argv[isc_commandline_index]));
ret = dns_name_fromtext(name, &buf, dns_rootname, ISC_FALSE, NULL);
if (ret != ISC_R_SUCCESS)
fatal("Invalid key name %s: %s", argv[isc_commandline_index],
isc_result_totext(ret));
switch(alg) {
case DNS_KEYALG_RSA:
......@@ -323,7 +330,6 @@ main(int argc, char **argv) {
null_key = ISC_TRUE;
isc_buffer_init(&buf, filename, sizeof(filename) - 1);
dst_result_register();
do {
conflict = ISC_FALSE;
......@@ -382,7 +388,6 @@ main(int argc, char **argv) {
ret = dst_key_buildfilename(key, 0, &buf);
filename[isc_buffer_usedlength(&buf)] = 0;
printf("%s\n", filename);
isc_mem_free(mctx, name);
isc_mem_free(mctx, algname);
isc_mem_free(mctx, nametype);
isc_mem_free(mctx, prog);
......
......@@ -178,7 +178,8 @@ main(int argc, char *argv[]) {
isc_log_t *log = NULL;
isc_logconfig_t *logconfig;
keynode_t *keynode;
char *savedname = NULL;
dns_fixedname_t fsavedname;
dns_name_t *savedname = NULL;
dns_result_register();
......@@ -273,25 +274,29 @@ main(int argc, char *argv[]) {
for (i = 0; i < argc; i++) {
isc_uint16_t id;
int alg;
char *namestr = NULL;
dns_fixedname_t fname;
dns_name_t *name;
char namestr[1025];
isc_buffer_init(&b, argv[i], strlen(argv[i]));
isc_buffer_add(&b, strlen(argv[i]));
result = dst_key_parsefilename(&b, mctx, &namestr, &id, &alg,
NULL);
dns_fixedname_init(&fname);
name = dns_fixedname_name(&fname);
result = dst_key_parsefilename(&b, mctx, name, &id, &alg, NULL);
if (result != ISC_R_SUCCESS)
fatal("%s is not a valid key filename", argv[i]);
strncpy(namestr, nametostr(name), sizeof(namestr) - 1);
namestr[sizeof(namestr) - 1] = 0;
if (savedname == NULL) {
savedname = isc_mem_strdup(mctx, namestr);
if (savedname == NULL)
fatal("out of memory");
fsavedname = fname;
savedname = dns_fixedname_name(&fsavedname);
}
else {
if (strcmp(savedname, namestr) != 0)
if (!dns_name_equal(savedname, name) != 0)
fatal("all keys must have the same owner - %s "
"and %s do not match",
savedname, namestr);
nametostr(savedname), namestr);
}
if (output == NULL) {
output = isc_mem_allocate(mctx,
......@@ -314,12 +319,12 @@ main(int argc, char *argv[]) {
namestr, isc_result_totext(result));
}
key = NULL;
result = dst_key_fromfile(namestr, id, alg, DST_TYPE_PUBLIC,
result = dst_key_fromfile(name, id, alg, DST_TYPE_PUBLIC,
mctx, &key);
check_result(result, "dst_key_fromfile");
if (dst_key_iszonekey(key)) {
dst_key_t *zonekey = NULL;
result = dst_key_fromfile(namestr, id, alg,
result = dst_key_fromfile(name, id, alg,
DST_TYPE_PRIVATE, mctx,
&zonekey);
......@@ -351,12 +356,9 @@ main(int argc, char *argv[]) {
dns_rdata_fromregion(rdata, dns_rdataclass_in,
dns_rdatatype_key, &r);
ISC_LIST_APPEND(rdatalist.rdata, rdata, link);
isc_mem_put(mctx, namestr, strlen(namestr) + 1);
dst_key_free(&key);
}
isc_mem_free(mctx, savedname);
dns_rdataset_init(&rdataset);
result = dns_rdatalist_tordataset(&rdatalist, &rdataset);
check_result(result, "dns_rdatalist_tordataset()");
......@@ -387,7 +389,7 @@ main(int argc, char *argv[]) {
rdata);
if (result != ISC_R_SUCCESS)
fatal("failed to sign keyset with key %s/%s/%d: %s",
dst_key_name(keynode->key),
nametostr(dst_key_name(keynode->key)),
algtostr(dst_key_alg(keynode->key)),
dst_key_id(keynode->key),
isc_result_totext(result));
......
......@@ -335,23 +335,24 @@ main(int argc, char *argv[]) {
for (i = 0; i < argc; i++) {
isc_uint16_t id;
int alg;
char *namestr = NULL;
dns_fixedname_t fname;
dns_name_t *name;
isc_buffer_init(&b, argv[i], strlen(argv[i]));
isc_buffer_add(&b, strlen(argv[i]));
result = dst_key_parsefilename(&b, mctx, &namestr, &id, &alg,
NULL);
dns_fixedname_init(&fname);
name = dns_fixedname_name(&fname);
result = dst_key_parsefilename(&b, mctx, name, &id, &alg, NULL);
if (result != ISC_R_SUCCESS)
usage();
key = NULL;
result = dst_key_fromfile(namestr, id, alg, DST_TYPE_PRIVATE,
result = dst_key_fromfile(name, id, alg, DST_TYPE_PRIVATE,
mctx, &key);
if (result != ISC_R_SUCCESS)
fatal("failed to read key %s/%s/%d from disk: %s",
dst_key_name(key), algtostr(dst_key_alg(key)),
dst_key_id(key), isc_result_totext(result));
isc_mem_put(mctx, namestr, strlen(namestr) + 1);
rdata = isc_mem_get(mctx, sizeof(dns_rdata_t));
if (rdata == NULL)
......
......@@ -176,7 +176,7 @@ signwithkey(dns_name_t *name, dns_rdataset_t *rdataset, dns_rdata_t *rdata,
mctx, b, rdata);
if (result != ISC_R_SUCCESS)
fatal("key '%s/%s/%d' failed to sign data: %s",
dst_key_name(key), algtostr(dst_key_alg(key)),
nametostr(dst_key_name(key)), algtostr(dst_key_alg(key)),
dst_key_id(key), isc_result_totext(result));
if (tryverify) {
......@@ -196,17 +196,9 @@ issigningkey(signer_key_t *key) {
static inline isc_boolean_t
iszonekey(signer_key_t *key, dns_db_t *db) {
char origin[1024];
isc_buffer_t b;
isc_result_t result;
isc_buffer_init(&b, origin, sizeof(origin));
result = dns_name_totext(dns_db_origin(db), ISC_FALSE, &b);
check_result(result, "dns_name_totext()");
return (ISC_TF(strcasecmp(dst_key_name(key->key), origin) == 0 &&
return (dns_name_equal(dst_key_name(key->key), dns_db_origin(db)) &&
(dst_key_flags(key->key) & DNS_KEYFLAG_OWNERMASK) ==
DNS_KEYOWNER_ZONE));
DNS_KEYOWNER_ZONE);
}
/*
......@@ -215,23 +207,20 @@ iszonekey(signer_key_t *key, dns_db_t *db) {
*/
static signer_key_t *
keythatsigned(dns_rdata_sig_t *sig) {
char *keyname;
isc_result_t result;
dst_key_t *pubkey = NULL, *privkey = NULL;
signer_key_t *key;
keyname = nametostr(&sig->signer);
key = ISC_LIST_HEAD(keylist);
while (key != NULL) {
if (sig->keyid == dst_key_id(key->key) &&
sig->algorithm == dst_key_alg(key->key) &&
strcasecmp(keyname, dst_key_name(key->key)) == 0)
dns_name_equal(&sig->signer, dst_key_name(key->key)))
return key;
key = ISC_LIST_NEXT(key, link);
}
result = dst_key_fromfile(keyname, sig->keyid, sig->algorithm,
result = dst_key_fromfile(&sig->signer, sig->keyid, sig->algorithm,
DST_TYPE_PUBLIC, mctx, &pubkey);
if (result != ISC_R_SUCCESS)
return (NULL);
......@@ -240,7 +229,7 @@ keythatsigned(dns_rdata_sig_t *sig) {
if (key == NULL)
fatal("out of memory");
result = dst_key_fromfile(keyname, sig->keyid, sig->algorithm,
result = dst_key_fromfile(&sig->signer, sig->keyid, sig->algorithm,
DST_TYPE_PRIVATE, mctx, &privkey);
if (result == ISC_R_SUCCESS) {
key->key = privkey;
......@@ -465,7 +454,7 @@ signset(dns_db_t *db, dns_dbversion_t *version, dns_dbnode_t *node,
else if (resign) {
allocbufferandrdata;
vbprintf(1, "\tresigning with key %s/%s/%d\n",
dst_key_name(key->key),
nametostr(dst_key_name(key->key)),
algtostr(dst_key_alg(key->key)),
dst_key_id(key->key));
signwithkey(name, set, trdata, key->key, &b);
......@@ -496,7 +485,7 @@ signset(dns_db_t *db, dns_dbversion_t *version, dns_dbnode_t *node,
{
allocbufferandrdata;
vbprintf(1, "\tsigning with key %s/%s/%d\n",
dst_key_name(key->key),
nametostr(dst_key_name(key->key)),
algtostr(dst_key_alg(key->key)),
dst_key_id(key->key));
signwithkey(name, set, trdata, key->key, &b);
......@@ -889,7 +878,7 @@ signname(dns_db_t *db, dns_dbversion_t *version, dns_dbnode_t *node,
dns_rdatalist_init(&keyrdatalist);
dstkey = NULL;
result = dst_key_generate("", DNS_KEYALG_DSA,
result = dst_key_generate(name, DNS_KEYALG_DSA,
0, 0,
DNS_KEYTYPE_NOKEY |
DNS_KEYOWNER_ZONE,
......@@ -1489,12 +1478,15 @@ main(int argc, char *argv[]) {
for (i = 0; i < argc; i++) {
isc_uint16_t id;
int alg;
char *namestr = NULL;
dns_fixedname_t fname;
dns_name_t *name;
isc_buffer_t b;
isc_buffer_init(&b, argv[i], strlen(argv[i]));
isc_buffer_add(&b, strlen(argv[i]));
result = dst_key_parsefilename(&b, mctx, &namestr,
dns_fixedname_init(&fname);
name = dns_fixedname_name(&fname);
result = dst_key_parsefilename(&b, mctx, name,
&id, &alg, NULL);
if (result != ISC_R_SUCCESS)
usage();
......@@ -1504,31 +1496,30 @@ main(int argc, char *argv[]) {
dst_key_t *dkey = key->key;
if (dst_key_id(dkey) == id &&
dst_key_alg(dkey) == alg &&
strcasecmp(namestr,
dst_key_name(dkey)) == 0)
dns_name_equal(name, dst_key_name(dkey)))
{
key->isdefault = ISC_TRUE;
if (!dst_key_isprivate(dkey))
fatal("cannot sign zone with "
"non-private key "
"'%s/%s/%d'",
dst_key_name(dkey),
algtostr(dst_key_alg(dkey)),
dst_key_id(dkey));
nametostr(dst_key_name(dkey)),
algtostr(dst_key_alg(dkey)),
dst_key_id(dkey));
break;
}
key = ISC_LIST_NEXT(key, link);
}
if (key == NULL) {
dst_key_t *dkey = NULL;
result = dst_key_fromfile(namestr, id, alg,
result = dst_key_fromfile(name, id, alg,
DST_TYPE_PRIVATE,
mctx, &dkey);
if (result != ISC_R_SUCCESS)
fatal("failed to load key '%s/%s/%d' "
"from disk: %s", namestr,
algtostr(alg), id,
isc_result_totext(result));
"from disk: %s",
nametostr(name), algtostr(alg),
id, isc_result_totext(result));
key = isc_mem_get(mctx, sizeof(signer_key_t));
if (key == NULL)
fatal("out of memory");
......@@ -1536,7 +1527,6 @@ main(int argc, char *argv[]) {
key->isdefault = ISC_TRUE;
ISC_LIST_APPEND(keylist, key, link);
}
isc_mem_put(mctx, namestr, strlen(namestr) + 1);
}
}
......
......@@ -199,6 +199,9 @@ configure_view_dnsseckeys(dns_c_ctx_t *cctx,
unsigned char rrdata[4096];
isc_buffer_t rrdatabuf;
isc_region_t r;
dns_fixedname_t fkeyname;
dns_name_t *keyname;
isc_buffer_t namebuf;
if (cview == NULL)
viewclass = dns_rdataclass_in;
......@@ -241,7 +244,14 @@ configure_view_dnsseckeys(dns_c_ctx_t *cctx,
keystruct.common.rdclass,
keystruct.common.rdtype,
&keystruct, &rrdatabuf));
CHECK(dst_key_fromdns(ckey->domain, &rrdatabuf, mctx,
dns_fixedname_init(&fkeyname);
keyname = dns_fixedname_name(&fkeyname);
isc_buffer_init(&namebuf, ckey->domain,
strlen(ckey->domain));
isc_buffer_add(&namebuf, strlen(ckey->domain));
CHECK(dns_name_fromtext(keyname, &namebuf,
dns_rootname, ISC_FALSE, NULL));
CHECK(dst_key_fromdns(keyname, &rrdatabuf, mctx,
&dstkey));
CHECK(dns_keytable_add(keytable, &dstkey));
......
......@@ -43,7 +43,7 @@ dns_tkeyctx_fromconfig(dns_c_ctx_t *cfg, isc_mem_t *mctx,
int n;
isc_buffer_t b, namebuf;
unsigned char data[1024];
dns_name_t domain;
dns_name_t domain, keyname;
result = dns_tkeyctx_create(mctx, &tctx);
if (result != ISC_R_SUCCESS)
......@@ -55,7 +55,12 @@ dns_tkeyctx_fromconfig(dns_c_ctx_t *cfg, isc_mem_t *mctx,
*tctxp = tctx;
return (ISC_R_SUCCESS);
}
RETERR(dst_key_fromfile(s, n, DNS_KEYALG_DH,
isc_buffer_init(&namebuf, data, sizeof(data));
dns_name_init(&keyname, NULL);
isc_buffer_init(&b, s, strlen(s));
isc_buffer_add(&b, strlen(s));
dns_name_fromtext(&keyname, &b, dns_rootname, ISC_FALSE, &namebuf);
RETERR(dst_key_fromfile(&keyname, n, DNS_KEYALG_DH,
DST_TYPE_PUBLIC|DST_TYPE_PRIVATE,
mctx, &tctx->dhkey));
s = NULL;
......@@ -69,7 +74,6 @@ dns_tkeyctx_fromconfig(dns_c_ctx_t *cfg, isc_mem_t *mctx,
dns_name_init(tctx->domain, NULL);
isc_buffer_init(&b, s, strlen(s));
isc_buffer_add(&b, strlen(s));
isc_buffer_init(&namebuf, data, sizeof(data));
RETERR(dns_name_fromtext(&domain, &b, dns_rootname, ISC_FALSE,
&namebuf));
RETERR(dns_name_dup(&domain, mctx, tctx->domain));
......
......@@ -26,6 +26,8 @@
#include <isc/region.h>
#include <isc/string.h> /* Required for HP/UX (and others?) */
#include <dns/fixedname.h>
#include <dns/name.h>
#include <dns/result.h>
#include <dst/dst.h>
......@@ -97,7 +99,7 @@ dns(dst_key_t *key, isc_mem_t *mctx) {
}
static void
io(char *name, int id, int alg, int type, isc_mem_t *mctx) {
io(dns_name_t *name, int id, int alg, int type, isc_mem_t *mctx) {
dst_key_t *key = NULL;
isc_result_t ret;
......@@ -117,7 +119,7 @@ io(char *name, int id, int alg, int type, isc_mem_t *mctx) {
}
static void
dh(char *name1, int id1, char *name2, int id2, isc_mem_t *mctx) {
dh(dns_name_t *name1, int id1, dns_name_t *name2, int id2, isc_mem_t *mctx) {
dst_key_t *key1 = NULL, *key2 = NULL;
isc_result_t ret;
isc_buffer_t b1, b2;
......@@ -183,7 +185,7 @@ generate(int alg, isc_mem_t *mctx) {
isc_result_t ret;
dst_key_t *key = NULL;
ret = dst_key_generate("test.", alg, 512, 0, 0, 0, mctx, &key);
ret = dst_key_generate(dns_rootname, alg, 512, 0, 0, 0, mctx, &key);
printf("generate(%d) returned: %s\n", alg, isc_result_totext(ret));
if (alg != DST_ALG_DH)
......@@ -210,6 +212,9 @@ get_random(void) {
int
main(void) {
isc_mem_t *mctx = NULL;
isc_buffer_t b;
dns_fixedname_t fname;
dns_name_t *name;
isc_mem_create(0, 0, &mctx);
......@@ -219,14 +224,19 @@ main(void) {
dns_result_register();
dst_result_register();
io("test.", 6204, DST_ALG_DSA, DST_TYPE_PRIVATE|DST_TYPE_PUBLIC, mctx);
io("test.", 54622, DST_ALG_RSA, DST_TYPE_PRIVATE|DST_TYPE_PUBLIC,
mctx);
dns_fixedname_init(&fname);
name = dns_fixedname_name(&fname);
isc_buffer_init(&b, "test.", 5);
dns_name_fromtext(name, &b, NULL, ISC_FALSE, NULL);
io(name, 6204, DST_ALG_DSA, DST_TYPE_PRIVATE|DST_TYPE_PUBLIC, mctx);
io(name, 54622, DST_ALG_RSA, DST_TYPE_PRIVATE|DST_TYPE_PUBLIC, mctx);
io("test.", 0, DST_ALG_DSA, DST_TYPE_PRIVATE|DST_TYPE_PUBLIC, mctx);
io("test.", 0, DST_ALG_RSA, DST_TYPE_PRIVATE|DST_TYPE_PUBLIC, mctx);
io(name, 0, DST_ALG_DSA, DST_TYPE_PRIVATE|DST_TYPE_PUBLIC, mctx);
io(name, 0, DST_ALG_RSA, DST_TYPE_PRIVATE|DST_TYPE_PUBLIC, mctx);
dh("dh.", 18088, "dh.", 48443, mctx);
isc_buffer_init(&b, "dh.", 3);
dns_name_fromtext(name, &b, NULL, ISC_FALSE, NULL);
dh(name, 18088, name, 48443, mctx);
generate(DST_ALG_RSA, mctx);
generate(DST_ALG_DH, mctx);
......
......@@ -34,6 +34,9 @@
#include <isc/string.h>
#include <isc/util.h>
#include <dns/fixedname.h>
#include <dns/name.h>
#include <dst/dst.h>
#include <dst/result.h>
......@@ -109,7 +112,7 @@ use(dst_key_t *key, isc_result_t exp_result, int *nfails) {
}
static void
dh(char *name1, int id1, char *name2, int id2, isc_mem_t *mctx,
dh(dns_name_t *name1, int id1, dns_name_t *name2, int id2, isc_mem_t *mctx,
isc_result_t exp_result, int *nfails, int *nprobs)
{
dst_key_t *key1 = NULL, *key2 = NULL;
......@@ -228,7 +231,7 @@ dh(char *name1, int id1, char *name2, int id2, isc_mem_t *mctx,
}
static void
io(char *name, int id, int alg, int type, isc_mem_t *mctx,
io(dns_name_t *name, int id, int alg, int type, isc_mem_t *mctx,
isc_result_t exp_result, int *nfails, int *nprobs)
{
dst_key_t *key = NULL;
......@@ -302,7 +305,7 @@ generate(int alg, isc_mem_t *mctx, int size, int *nfails) {
isc_result_t ret;
dst_key_t *key = NULL;
ret = dst_key_generate("test.", alg, size, 0, 0, 0, mctx, &key);
ret = dst_key_generate(dns_rootname, alg, size, 0, 0, 0, mctx, &key);
if (ret != ISC_R_SUCCESS) {
t_info("dst_key_generate(%d) returned: %s\n", alg,
dst_result_totext(ret));
......@@ -369,6 +372,9 @@ t1(void) {
int nprobs;
int result;
isc_result_t isc_result;
dns_fixedname_t fname;
dns_name_t *name;
isc_buffer_t b;
t_assert("dst", 1, T_REQUIRED, a1);
......@@ -384,20 +390,28 @@ t1(void) {
}
t_info("testing use of stored keys [1]\n");
io("test.", 6204, DST_ALG_DSA, DST_TYPE_PRIVATE|DST_TYPE_PUBLIC,
dns_fixedname_init(&fname);
name = dns_fixedname_name(&fname);
isc_buffer_init(&b, "test.", 5);
dns_name_fromtext(name, &b, NULL, ISC_FALSE, NULL);
io(name, 6204, DST_ALG_DSA, DST_TYPE_PRIVATE|DST_TYPE_PUBLIC,
mctx, ISC_R_SUCCESS, &nfails, &nprobs);
t_info("testing use of stored keys [2]\n");
io("test.", 54622, DST_ALG_RSA, DST_TYPE_PRIVATE|DST_TYPE_PUBLIC,
io(name, 54622, DST_ALG_RSA, DST_TYPE_PRIVATE|DST_TYPE_PUBLIC,
mctx, ISC_R_SUCCESS, &nfails, &nprobs);
t_info("testing use of stored keys [3]\n");
io("test.", 0, DST_ALG_DSA, DST_TYPE_PRIVATE|DST_TYPE_PUBLIC,
io(name, 0, DST_ALG_DSA, DST_TYPE_PRIVATE|DST_TYPE_PUBLIC,
mctx, DST_R_NULLKEY, &nfails, &nprobs);
t_info("testing use of stored keys [4]\n");
io("test.", 0, DST_ALG_RSA, DST_TYPE_PRIVATE|DST_TYPE_PUBLIC,
io(name, 0, DST_ALG_RSA, DST_TYPE_PRIVATE|DST_TYPE_PUBLIC,
mctx, DST_R_NULLKEY, &nfails, &nprobs);
dh("dh.", 18088, "dh.", 48443, mctx, ISC_R_SUCCESS, &nfails, &nprobs);
isc_buffer_init(&b, "dh.", 3);
dns_name_fromtext(name, &b, NULL, ISC_FALSE, NULL);
dh(name, 18088, name, 48443, mctx, ISC_R_SUCCESS, &nfails, &nprobs);
t_info("testing use of generated keys\n");
generate(DST_ALG_RSA, mctx, 512, &nfails);
......@@ -599,6 +613,9 @@ t2_sigchk(char *datapath, char *sigpath, char *keyname,
isc_buffer_t sigbuf;
isc_region_t datareg;
isc_region_t sigreg;
dns_fixedname_t fname;
dns_name_t *name;
isc_buffer_t b;
/*
* Read data from file in a form usable by dst_verify.
......@@ -639,7 +656,11 @@ t2_sigchk(char *datapath, char *sigpath, char *keyname,
/*
* Read key from file in a form usable by dst_verify.
*/
isc_result = dst_key_fromfile(keyname, id, alg, type, mctx, &key);
dns_fixedname_init(&fname);
name = dns_fixedname_name(&fname);
isc_buffer_init(&b, keyname, strlen(keyname));
dns_name_fromtext(name, &b, dns_rootname, ISC_FALSE, NULL);
isc_result = dst_key_fromfile(name, id, alg, type, mctx, &key);
if (isc_result != ISC_R_SUCCESS) {
t_info("dst_key_fromfile failed %s\n",
isc_result_totext(isc_result));
......
......@@ -16,7 +16,7 @@
*/
/*
* $Id: dnssec.c,v 1.38 2000/05/20 01:27:28 bwelling Exp $
* $Id: dnssec.c,v 1.39 2000/05/24 23:13:19 bwelling Exp $
* Principal Author: Brian Wellington
*/
......@@ -62,9 +62,6 @@ typedef struct digestctx {
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);
static int
rdata_compare_wrapper(const void *rdata1, const void *rdata2);
......@@ -88,30 +85,6 @@ digest_callback(void *arg, isc_region_t *data) {
return (result);
}
/*
* Converts the name of a key into a canonical dns_name_t.