]> CyberLeo.Net >> Repos - FreeBSD/releng/8.0.git/blob - contrib/bind9/bin/dnssec/dnssec-keygen.c
Adjust to reflect 8.0-RELEASE.
[FreeBSD/releng/8.0.git] / contrib / bind9 / bin / dnssec / dnssec-keygen.c
1 /*
2  * Portions Copyright (C) 2004-2008  Internet Systems Consortium, Inc. ("ISC")
3  * Portions Copyright (C) 1999-2003  Internet Software Consortium.
4  *
5  * Permission to use, copy, modify, and/or distribute this software for any
6  * purpose with or without fee is hereby granted, provided that the above
7  * copyright notice and this permission notice appear in all copies.
8  *
9  * THE SOFTWARE IS PROVIDED "AS IS" AND ISC AND NETWORK ASSOCIATES DISCLAIMS
10  * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
11  * WARRANTIES OF MERCHANTABILITY AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE
12  * FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
15  * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16  *
17  * Portions Copyright (C) 1995-2000 by Network Associates, Inc.
18  *
19  * Permission to use, copy, modify, and/or distribute this software for any
20  * purpose with or without fee is hereby granted, provided that the above
21  * copyright notice and this permission notice appear in all copies.
22  *
23  * THE SOFTWARE IS PROVIDED "AS IS" AND ISC AND NETWORK ASSOCIATES DISCLAIMS
24  * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
25  * WARRANTIES OF MERCHANTABILITY AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE
26  * FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
27  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
28  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
29  * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
30  */
31
32 /* $Id: dnssec-keygen.c,v 1.81 2008/09/25 04:02:38 tbox Exp $ */
33
34 /*! \file */
35
36 #include <config.h>
37
38 #include <stdlib.h>
39
40 #include <isc/buffer.h>
41 #include <isc/commandline.h>
42 #include <isc/entropy.h>
43 #include <isc/mem.h>
44 #include <isc/region.h>
45 #include <isc/string.h>
46 #include <isc/util.h>
47
48 #include <dns/fixedname.h>
49 #include <dns/keyvalues.h>
50 #include <dns/log.h>
51 #include <dns/name.h>
52 #include <dns/rdataclass.h>
53 #include <dns/result.h>
54 #include <dns/secalg.h>
55
56 #include <dst/dst.h>
57
58 #include "dnssectool.h"
59
60 #define MAX_RSA 4096 /* should be long enough... */
61
62 const char *program = "dnssec-keygen";
63 int verbose;
64
65 static const char *algs = "RSA | RSAMD5 | DH | DSA | RSASHA1 | NSEC3DSA |"
66                           " NSEC3RSASHA1 | HMAC-MD5 |"
67                           " HMAC-SHA1 | HMAC-SHA224 | HMAC-SHA256 |"
68                           " HMAC-SHA384 | HMAC-SHA512";
69
70 static isc_boolean_t
71 dsa_size_ok(int size) {
72         return (ISC_TF(size >= 512 && size <= 1024 && size % 64 == 0));
73 }
74
75 static void
76 usage(void) {
77         fprintf(stderr, "Usage:\n");
78         fprintf(stderr, "    %s -a alg -b bits [-n type] [options] name\n\n",
79                 program);
80         fprintf(stderr, "Version: %s\n", VERSION);
81         fprintf(stderr, "Required options:\n");
82         fprintf(stderr, "    -a algorithm: %s\n", algs);
83         fprintf(stderr, "    -b key size, in bits:\n");
84         fprintf(stderr, "        RSAMD5:\t\t[512..%d]\n", MAX_RSA);
85         fprintf(stderr, "        RSASHA1:\t\t[512..%d]\n", MAX_RSA);
86         fprintf(stderr, "        NSEC3RSASHA1:\t\t[512..%d]\n", MAX_RSA);
87         fprintf(stderr, "        DH:\t\t[128..4096]\n");
88         fprintf(stderr, "        DSA:\t\t[512..1024] and divisible by 64\n");
89         fprintf(stderr, "        NSEC3DSA:\t\t[512..1024] and divisible by 64\n");
90         fprintf(stderr, "        HMAC-MD5:\t[1..512]\n");
91         fprintf(stderr, "        HMAC-SHA1:\t[1..160]\n");
92         fprintf(stderr, "        HMAC-SHA224:\t[1..224]\n");
93         fprintf(stderr, "        HMAC-SHA256:\t[1..256]\n");
94         fprintf(stderr, "        HMAC-SHA384:\t[1..384]\n");
95         fprintf(stderr, "        HMAC-SHA512:\t[1..512]\n");
96         fprintf(stderr, "    -n nametype: ZONE | HOST | ENTITY | USER | OTHER\n");
97         fprintf(stderr, "        (DNSKEY generation defaults to ZONE\n");
98         fprintf(stderr, "    name: owner of the key\n");
99         fprintf(stderr, "Other options:\n");
100         fprintf(stderr, "    -c <class> (default: IN)\n");
101         fprintf(stderr, "    -d <digest bits> (0 => max, default)\n");
102         fprintf(stderr, "    -e use large exponent (RSAMD5/RSASHA1 only)\n");
103         fprintf(stderr, "    -f keyflag: KSK\n");
104         fprintf(stderr, "    -g <generator> use specified generator "
105                 "(DH only)\n");
106         fprintf(stderr, "    -t <type>: "
107                 "AUTHCONF | NOAUTHCONF | NOAUTH | NOCONF "
108                 "(default: AUTHCONF)\n");
109         fprintf(stderr, "    -p <protocol>: "
110                "default: 3 [dnssec]\n");
111         fprintf(stderr, "    -s <strength> strength value this key signs DNS "
112                 "records with (default: 0)\n");
113         fprintf(stderr, "    -r <randomdev>: a file containing random data\n");
114         fprintf(stderr, "    -v <verbose level>\n");
115         fprintf(stderr, "    -k : generate a TYPE=KEY key\n");
116         fprintf(stderr, "Output:\n");
117         fprintf(stderr, "     K<name>+<alg>+<id>.key, "
118                 "K<name>+<alg>+<id>.private\n");
119
120         exit (-1);
121 }
122
123 int
124 main(int argc, char **argv) {
125         char            *algname = NULL, *nametype = NULL, *type = NULL;
126         char            *classname = NULL;
127         char            *endp;
128         dst_key_t       *key = NULL, *oldkey;
129         dns_fixedname_t fname;
130         dns_name_t      *name;
131         isc_uint16_t    flags = 0, ksk = 0;
132         dns_secalg_t    alg;
133         isc_boolean_t   conflict = ISC_FALSE, null_key = ISC_FALSE;
134         isc_mem_t       *mctx = NULL;
135         int             ch, rsa_exp = 0, generator = 0, param = 0;
136         int             protocol = -1, size = -1, signatory = 0;
137         isc_result_t    ret;
138         isc_textregion_t r;
139         char            filename[255];
140         isc_buffer_t    buf;
141         isc_log_t       *log = NULL;
142         isc_entropy_t   *ectx = NULL;
143         dns_rdataclass_t rdclass;
144         int             options = DST_TYPE_PRIVATE | DST_TYPE_PUBLIC;
145         int             dbits = 0;
146
147         if (argc == 1)
148                 usage();
149
150         RUNTIME_CHECK(isc_mem_create(0, 0, &mctx) == ISC_R_SUCCESS);
151
152         dns_result_register();
153
154         isc_commandline_errprint = ISC_FALSE;
155
156         while ((ch = isc_commandline_parse(argc, argv,
157                                          "a:b:c:d:ef:g:kn:t:p:s:r:v:h")) != -1)
158         {
159             switch (ch) {
160                 case 'a':
161                         algname = isc_commandline_argument;
162                         break;
163                 case 'b':
164                         size = strtol(isc_commandline_argument, &endp, 10);
165                         if (*endp != '\0' || size < 0)
166                                 fatal("-b requires a non-negative number");
167                         break;
168                 case 'c':
169                         classname = isc_commandline_argument;
170                         break;
171                 case 'd':
172                         dbits = strtol(isc_commandline_argument, &endp, 10);
173                         if (*endp != '\0' || dbits < 0)
174                                 fatal("-d requires a non-negative number");
175                         break;
176                 case 'e':
177                         rsa_exp = 1;
178                         break;
179                 case 'f':
180                         if (strcasecmp(isc_commandline_argument, "KSK") == 0)
181                                 ksk = DNS_KEYFLAG_KSK;
182                         else
183                                 fatal("unknown flag '%s'",
184                                       isc_commandline_argument);
185                         break;
186                 case 'g':
187                         generator = strtol(isc_commandline_argument,
188                                            &endp, 10);
189                         if (*endp != '\0' || generator <= 0)
190                                 fatal("-g requires a positive number");
191                         break;
192                 case 'k':
193                         options |= DST_TYPE_KEY;
194                         break;
195                 case 'n':
196                         nametype = isc_commandline_argument;
197                         break;
198                 case 't':
199                         type = isc_commandline_argument;
200                         break;
201                 case 'p':
202                         protocol = strtol(isc_commandline_argument, &endp, 10);
203                         if (*endp != '\0' || protocol < 0 || protocol > 255)
204                                 fatal("-p must be followed by a number "
205                                       "[0..255]");
206                         break;
207                 case 's':
208                         signatory = strtol(isc_commandline_argument,
209                                            &endp, 10);
210                         if (*endp != '\0' || signatory < 0 || signatory > 15)
211                                 fatal("-s must be followed by a number "
212                                       "[0..15]");
213                         break;
214                 case 'r':
215                         setup_entropy(mctx, isc_commandline_argument, &ectx);
216                         break;
217                 case 'v':
218                         endp = NULL;
219                         verbose = strtol(isc_commandline_argument, &endp, 0);
220                         if (*endp != '\0')
221                                 fatal("-v must be followed by a number");
222                         break;
223
224                 case '?':
225                         if (isc_commandline_option != '?')
226                                 fprintf(stderr, "%s: invalid argument -%c\n",
227                                         program, isc_commandline_option);
228                 case 'h':
229                         usage();
230
231                 default:
232                         fprintf(stderr, "%s: unhandled option -%c\n",
233                                 program, isc_commandline_option);
234                         exit(1);
235                 }
236         }
237
238         if (ectx == NULL)
239                 setup_entropy(mctx, NULL, &ectx);
240         ret = dst_lib_init(mctx, ectx,
241                            ISC_ENTROPY_BLOCKING | ISC_ENTROPY_GOODONLY);
242         if (ret != ISC_R_SUCCESS)
243                 fatal("could not initialize dst");
244
245         setup_logging(verbose, mctx, &log);
246
247         if (argc < isc_commandline_index + 1)
248                 fatal("the key name was not specified");
249         if (argc > isc_commandline_index + 1)
250                 fatal("extraneous arguments");
251
252         if (algname == NULL)
253                 fatal("no algorithm was specified");
254         if (strcasecmp(algname, "RSA") == 0) {
255                 fprintf(stderr, "The use of RSA (RSAMD5) is not recommended.\n"
256                                 "If you still wish to use RSA (RSAMD5) please "
257                                 "specify \"-a RSAMD5\"\n");
258                 return (1);
259         } else if (strcasecmp(algname, "HMAC-MD5") == 0) {
260                 options |= DST_TYPE_KEY;
261                 alg = DST_ALG_HMACMD5;
262         } else if (strcasecmp(algname, "HMAC-SHA1") == 0) {
263                 options |= DST_TYPE_KEY;
264                 alg = DST_ALG_HMACSHA1;
265         } else if (strcasecmp(algname, "HMAC-SHA224") == 0) {
266                 options |= DST_TYPE_KEY;
267                 alg = DST_ALG_HMACSHA224;
268         } else if (strcasecmp(algname, "HMAC-SHA256") == 0) {
269                 options |= DST_TYPE_KEY;
270                 alg = DST_ALG_HMACSHA256;
271         } else if (strcasecmp(algname, "HMAC-SHA384") == 0) {
272                 options |= DST_TYPE_KEY;
273                 alg = DST_ALG_HMACSHA384;
274         } else if (strcasecmp(algname, "HMAC-SHA512") == 0) {
275                 options |= DST_TYPE_KEY;
276                 alg = DST_ALG_HMACSHA512;
277         } else {
278                 r.base = algname;
279                 r.length = strlen(algname);
280                 ret = dns_secalg_fromtext(&alg, &r);
281                 if (ret != ISC_R_SUCCESS)
282                         fatal("unknown algorithm %s", algname);
283                 if (alg == DST_ALG_DH)
284                         options |= DST_TYPE_KEY;
285         }
286
287         if (type != NULL && (options & DST_TYPE_KEY) != 0) {
288                 if (strcasecmp(type, "NOAUTH") == 0)
289                         flags |= DNS_KEYTYPE_NOAUTH;
290                 else if (strcasecmp(type, "NOCONF") == 0)
291                         flags |= DNS_KEYTYPE_NOCONF;
292                 else if (strcasecmp(type, "NOAUTHCONF") == 0) {
293                         flags |= (DNS_KEYTYPE_NOAUTH | DNS_KEYTYPE_NOCONF);
294                         if (size < 0)
295                                 size = 0;
296                 }
297                 else if (strcasecmp(type, "AUTHCONF") == 0)
298                         /* nothing */;
299                 else
300                         fatal("invalid type %s", type);
301         }
302
303         if (size < 0)
304                 fatal("key size not specified (-b option)");
305
306         switch (alg) {
307         case DNS_KEYALG_RSAMD5:
308         case DNS_KEYALG_RSASHA1:
309         case DNS_KEYALG_NSEC3RSASHA1:
310                 if (size != 0 && (size < 512 || size > MAX_RSA))
311                         fatal("RSA key size %d out of range", size);
312                 break;
313         case DNS_KEYALG_DH:
314                 if (size != 0 && (size < 128 || size > 4096))
315                         fatal("DH key size %d out of range", size);
316                 break;
317         case DNS_KEYALG_DSA:
318         case DNS_KEYALG_NSEC3DSA:
319                 if (size != 0 && !dsa_size_ok(size))
320                         fatal("invalid DSS key size: %d", size);
321                 break;
322         case DST_ALG_HMACMD5:
323                 if (size < 1 || size > 512)
324                         fatal("HMAC-MD5 key size %d out of range", size);
325                 if (dbits != 0 && (dbits < 80 || dbits > 128))
326                         fatal("HMAC-MD5 digest bits %d out of range", dbits);
327                 if ((dbits % 8) != 0)
328                         fatal("HMAC-MD5 digest bits %d not divisible by 8",
329                               dbits);
330                 break;
331         case DST_ALG_HMACSHA1:
332                 if (size < 1 || size > 160)
333                         fatal("HMAC-SHA1 key size %d out of range", size);
334                 if (dbits != 0 && (dbits < 80 || dbits > 160))
335                         fatal("HMAC-SHA1 digest bits %d out of range", dbits);
336                 if ((dbits % 8) != 0)
337                         fatal("HMAC-SHA1 digest bits %d not divisible by 8",
338                               dbits);
339                 break;
340         case DST_ALG_HMACSHA224:
341                 if (size < 1 || size > 224)
342                         fatal("HMAC-SHA224 key size %d out of range", size);
343                 if (dbits != 0 && (dbits < 112 || dbits > 224))
344                         fatal("HMAC-SHA224 digest bits %d out of range", dbits);
345                 if ((dbits % 8) != 0)
346                         fatal("HMAC-SHA224 digest bits %d not divisible by 8",
347                               dbits);
348                 break;
349         case DST_ALG_HMACSHA256:
350                 if (size < 1 || size > 256)
351                         fatal("HMAC-SHA256 key size %d out of range", size);
352                 if (dbits != 0 && (dbits < 128 || dbits > 256))
353                         fatal("HMAC-SHA256 digest bits %d out of range", dbits);
354                 if ((dbits % 8) != 0)
355                         fatal("HMAC-SHA256 digest bits %d not divisible by 8",
356                               dbits);
357                 break;
358         case DST_ALG_HMACSHA384:
359                 if (size < 1 || size > 384)
360                         fatal("HMAC-384 key size %d out of range", size);
361                 if (dbits != 0 && (dbits < 192 || dbits > 384))
362                         fatal("HMAC-SHA384 digest bits %d out of range", dbits);
363                 if ((dbits % 8) != 0)
364                         fatal("HMAC-SHA384 digest bits %d not divisible by 8",
365                               dbits);
366                 break;
367         case DST_ALG_HMACSHA512:
368                 if (size < 1 || size > 512)
369                         fatal("HMAC-SHA512 key size %d out of range", size);
370                 if (dbits != 0 && (dbits < 256 || dbits > 512))
371                         fatal("HMAC-SHA512 digest bits %d out of range", dbits);
372                 if ((dbits % 8) != 0)
373                         fatal("HMAC-SHA512 digest bits %d not divisible by 8",
374                               dbits);
375                 break;
376         }
377
378         if (!(alg == DNS_KEYALG_RSAMD5 || alg == DNS_KEYALG_RSASHA1 ||
379               alg == DNS_KEYALG_NSEC3RSASHA1) && rsa_exp != 0)
380                 fatal("specified RSA exponent for a non-RSA key");
381
382         if (alg != DNS_KEYALG_DH && generator != 0)
383                 fatal("specified DH generator for a non-DH key");
384
385         if (nametype == NULL) {
386                 if ((options & DST_TYPE_KEY) != 0) /* KEY / HMAC */
387                         fatal("no nametype specified");
388                 flags |= DNS_KEYOWNER_ZONE;     /* DNSKEY */
389         } else if (strcasecmp(nametype, "zone") == 0)
390                 flags |= DNS_KEYOWNER_ZONE;
391         else if ((options & DST_TYPE_KEY) != 0) { /* KEY / HMAC */
392                 if (strcasecmp(nametype, "host") == 0 ||
393                          strcasecmp(nametype, "entity") == 0)
394                         flags |= DNS_KEYOWNER_ENTITY;
395                 else if (strcasecmp(nametype, "user") == 0)
396                         flags |= DNS_KEYOWNER_USER;
397                 else
398                         fatal("invalid KEY nametype %s", nametype);
399         } else if (strcasecmp(nametype, "other") != 0) /* DNSKEY */
400                 fatal("invalid DNSKEY nametype %s", nametype);
401
402         rdclass = strtoclass(classname);
403
404         if ((options & DST_TYPE_KEY) != 0)  /* KEY / HMAC */
405                 flags |= signatory;
406         else if ((flags & DNS_KEYOWNER_ZONE) != 0) /* DNSKEY */
407                 flags |= ksk;
408
409         if (protocol == -1)
410                 protocol = DNS_KEYPROTO_DNSSEC;
411         else if ((options & DST_TYPE_KEY) == 0 &&
412                  protocol != DNS_KEYPROTO_DNSSEC)
413                 fatal("invalid DNSKEY protocol: %d", protocol);
414
415         if ((flags & DNS_KEYFLAG_TYPEMASK) == DNS_KEYTYPE_NOKEY) {
416                 if (size > 0)
417                         fatal("specified null key with non-zero size");
418                 if ((flags & DNS_KEYFLAG_SIGNATORYMASK) != 0)
419                         fatal("specified null key with signing authority");
420         }
421
422         if ((flags & DNS_KEYFLAG_OWNERMASK) == DNS_KEYOWNER_ZONE &&
423             (alg == DNS_KEYALG_DH || alg == DST_ALG_HMACMD5 ||
424              alg == DST_ALG_HMACSHA1 || alg == DST_ALG_HMACSHA224 ||
425              alg == DST_ALG_HMACSHA256 || alg == DST_ALG_HMACSHA384 ||
426              alg == DST_ALG_HMACSHA512))
427                 fatal("a key with algorithm '%s' cannot be a zone key",
428                       algname);
429
430         dns_fixedname_init(&fname);
431         name = dns_fixedname_name(&fname);
432         isc_buffer_init(&buf, argv[isc_commandline_index],
433                         strlen(argv[isc_commandline_index]));
434         isc_buffer_add(&buf, strlen(argv[isc_commandline_index]));
435         ret = dns_name_fromtext(name, &buf, dns_rootname, ISC_FALSE, NULL);
436         if (ret != ISC_R_SUCCESS)
437                 fatal("invalid key name %s: %s", argv[isc_commandline_index],
438                       isc_result_totext(ret));
439
440         switch(alg) {
441         case DNS_KEYALG_RSAMD5:
442         case DNS_KEYALG_RSASHA1:
443                 param = rsa_exp;
444                 break;
445         case DNS_KEYALG_DH:
446                 param = generator;
447                 break;
448         case DNS_KEYALG_DSA:
449         case DST_ALG_HMACMD5:
450         case DST_ALG_HMACSHA1:
451         case DST_ALG_HMACSHA224:
452         case DST_ALG_HMACSHA256:
453         case DST_ALG_HMACSHA384:
454         case DST_ALG_HMACSHA512:
455                 param = 0;
456                 break;
457         }
458
459         if ((flags & DNS_KEYFLAG_TYPEMASK) == DNS_KEYTYPE_NOKEY)
460                 null_key = ISC_TRUE;
461
462         isc_buffer_init(&buf, filename, sizeof(filename) - 1);
463
464         do {
465                 conflict = ISC_FALSE;
466                 oldkey = NULL;
467
468                 /* generate the key */
469                 ret = dst_key_generate(name, alg, size, param, flags, protocol,
470                                        rdclass, mctx, &key);
471                 isc_entropy_stopcallbacksources(ectx);
472
473                 if (ret != ISC_R_SUCCESS) {
474                         char namestr[DNS_NAME_FORMATSIZE];
475                         char algstr[ALG_FORMATSIZE];
476                         dns_name_format(name, namestr, sizeof(namestr));
477                         alg_format(alg, algstr, sizeof(algstr));
478                         fatal("failed to generate key %s/%s: %s\n",
479                               namestr, algstr, isc_result_totext(ret));
480                         exit(-1);
481                 }
482
483                 dst_key_setbits(key, dbits);
484
485                 /*
486                  * Try to read a key with the same name, alg and id from disk.
487                  * If there is one we must continue generating a new one
488                  * unless we were asked to generate a null key, in which
489                  * case we return failure.
490                  */
491                 ret = dst_key_fromfile(name, dst_key_id(key), alg,
492                                        DST_TYPE_PRIVATE, NULL, mctx, &oldkey);
493                 /* do not overwrite an existing key  */
494                 if (ret == ISC_R_SUCCESS) {
495                         dst_key_free(&oldkey);
496                         conflict = ISC_TRUE;
497                         if (null_key)
498                                 break;
499                 }
500                 if (conflict == ISC_TRUE) {
501                         if (verbose > 0) {
502                                 isc_buffer_clear(&buf);
503                                 ret = dst_key_buildfilename(key, 0, NULL, &buf);
504                                 fprintf(stderr,
505                                         "%s: %s already exists, "
506                                         "generating a new key\n",
507                                         program, filename);
508                         }
509                         dst_key_free(&key);
510                 }
511
512         } while (conflict == ISC_TRUE);
513
514         if (conflict)
515                 fatal("cannot generate a null key when a key with id 0 "
516                       "already exists");
517
518         ret = dst_key_tofile(key, options, NULL);
519         if (ret != ISC_R_SUCCESS) {
520                 char keystr[KEY_FORMATSIZE];
521                 key_format(key, keystr, sizeof(keystr));
522                 fatal("failed to write key %s: %s\n", keystr,
523                       isc_result_totext(ret));
524         }
525
526         isc_buffer_clear(&buf);
527         ret = dst_key_buildfilename(key, 0, NULL, &buf);
528         printf("%s\n", filename);
529         dst_key_free(&key);
530
531         cleanup_logging(&log);
532         cleanup_entropy(&ectx);
533         dst_lib_destroy();
534         dns_name_destroy();
535         if (verbose > 10)
536                 isc_mem_stats(mctx, stdout);
537         isc_mem_destroy(&mctx);
538
539         return (0);
540 }