nsec3.c revision c3c8823fed039b3a2b8e5ca8bc2f3301d1dd840e
938440694b33cd752e9e4b71a526368b4811c177Tinderbox User * Copyright (C) 2006, 2008-2013 Internet Systems Consortium, Inc. ("ISC")
ddccd5811feff696ba460dabfb666ce61040f545Andreas Gustafsson * Permission to use, copy, modify, and/or distribute this software for any
ec5347e2c775f027573ce5648b910361aa926c01Automatic Updater * purpose with or without fee is hereby granted, provided that the above
ddccd5811feff696ba460dabfb666ce61040f545Andreas Gustafsson * copyright notice and this permission notice appear in all copies.
ddccd5811feff696ba460dabfb666ce61040f545Andreas Gustafsson * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * PERFORMANCE OF THIS SOFTWARE.
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein#define CHECK(x) do { \
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein#define OPTOUT(x) (((x) & DNS_NSEC3FLAG_OPTOUT) != 0)
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein#define CREATE(x) (((x) & DNS_NSEC3FLAG_CREATE) != 0)
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein#define INITIAL(x) (((x) & DNS_NSEC3FLAG_INITIAL) != 0)
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein#define REMOVE(x) (((x) & DNS_NSEC3FLAG_REMOVE) != 0)
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austeindns_nsec3_buildrdata(dns_db_t *db, dns_dbversion_t *version,
ddccd5811feff696ba460dabfb666ce61040f545Andreas Gustafsson unsigned int flags, unsigned int iterations,
ddccd5811feff696ba460dabfb666ce61040f545Andreas Gustafsson const unsigned char *salt, size_t salt_length,
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein const unsigned char *nexthash, size_t hash_length,
ddccd5811feff696ba460dabfb666ce61040f545Andreas Gustafsson unsigned char *buffer, dns_rdata_t *rdata)
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein unsigned int i;
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein unsigned int max_type;
ddccd5811feff696ba460dabfb666ce61040f545Andreas Gustafsson unsigned char *p;
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein *p++ = (unsigned char)salt_length;
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein *p++ = (unsigned char)hash_length;
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein * Use the end of the space for a raw bitmap leaving enough
ddccd5811feff696ba460dabfb666ce61040f545Andreas Gustafsson * space for the window identifiers and length octets.
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein result = dns_db_allrdatasets(db, node, version, 0, &rdsiter);
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein * Work out if we need to set the RRSIG bit for
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein * this node. We set the RRSIG bit if either of
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein * the following conditions are met:
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein * 1) We have a SOA or DS then we need to set
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein * the RRSIG bit as both always will be signed.
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein * 2) We set the RRSIG bit if we don't have
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein * a NS record but do have other data.
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein * At zone cuts, deny the existence of glue in the parent zone.
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein for (i = 0; i <= max_type; i++) {
14a656f94b1fd0ababd84a772228dfa52276ba15Evan Hunt ! dns_rdatatype_iszonecutauth((dns_rdatatype_t)i))
return (result);
return (ISC_R_SUCCESS);
return (present);
if (len == 0U)
return (DNS_R_BADALG);
switch (hash) {
switch (hash) {
return (ISC_FALSE);
static isc_result_t
return (result);
return (ISC_R_SUCCESS);
static isc_result_t
return (ISC_R_SUCCESS);
return (result);
goto cleanup_node;
return (result);
static isc_boolean_t
return (ISC_TRUE);
return (ISC_FALSE);
static isc_result_t
return (ISC_R_SUCCESS);
return (result);
goto cleanup_node;
goto cleanup_node;
goto failure;
goto failure;
goto failure;
return (result);
static isc_boolean_t
return (ISC_TRUE);
return (ISC_TRUE);
return (ISC_FALSE);
static isc_result_t
return (result);
int pass;
unsigned char *old_next;
unsigned char *salt;
unsigned int iterations;
unsigned int labels;
unsigned int old_length;
unsigned int salt_length;
if (!unsecure)
goto addnsec3;
goto failure;
goto failure;
pass = 0;
pass++;
NULL);
goto failure;
if (maybe_remove_unsecure) {
goto failure;
goto addnsec3;
goto failure;
&buffer));
if (exists)
NULL);
goto failure;
pass = 0;
pass++;
(isc_stdtime_t) 0,
goto failure;
sizeof(nsec3buf));
&buffer));
&tuple));
&rdata));
return (result);
return (result);
dns_rdatatype_nsec3param, 0, 0,
return (ISC_R_SUCCESS);
return (result);
return (result);
return (ISC_FALSE);
buf[0] = 0;
static isc_result_t
goto failure;
return (result);
return (result);
goto try_private;
goto failure;
if (nonsec)
if (!flag) {
&tuple));
goto failure;
if (privatetype == 0)
goto success;
goto success;
goto failure;
if (nonsec)
if (!flag) {
goto failure;
return (result);
return (result);
goto failure;
dns_rdatatype_nsec3param, 0, 0,
goto try_private;
goto failure;
goto failure;
goto success;
return (result);
static isc_result_t
return (ISC_R_SUCCESS);
return (ISC_R_SUCCESS);
return (result);
int pass;
unsigned char *salt;
unsigned int iterations;
unsigned int labels;
unsigned int salt_length;
goto success;
goto failure;
goto success;
goto failure;
goto success;
goto failure;
pass = 0;
pass++;
NULL);
goto failure;
&buffer));
if (!yesno)
goto success;
goto failure;
NULL);
goto success;
goto failure;
goto success;
goto failure;
pass = 0;
pass++;
(isc_stdtime_t) 0,
goto failure;
sizeof(nsec3buf));
&buffer));
&tuple));
return (result);
return (result);
dns_rdatatype_nsec3param, 0, 0,
goto try_private;
goto failure;
if (privatetype == 0)
goto success;
goto success;
goto failure;
return (result);
return (result);
dns_rdatatype_nsec3param, 0, 0,
goto try_private;
return (result);
return (ISC_R_SUCCESS);
return (ISC_R_SUCCESS);
return (ISC_R_SUCCESS);
return (result);
return (result);
return (result);
*iterationsp = 0;
return (ISC_R_SUCCESS);
goto failure;
goto failure;
return (result);
int order;
int scope;
unsigned int length;
unsigned int qlabels;
unsigned int zlabels;
return (result);
return (result);
return (ISC_R_IGNORE);
zlabels--;
return (ISC_R_IGNORE);
return (ISC_R_IGNORE);
return (ISC_R_SUCCESS);
return (ISC_R_IGNORE);
return (result);
return (ISC_R_IGNORE);
return (ISC_R_IGNORE);
if (!atparent) {
return (ISC_R_IGNORE);
return (ISC_R_IGNORE);
return (ISC_R_SUCCESS);
return (ISC_R_IGNORE);
if (order == 0 &&
return (ISC_R_IGNORE);
if (order == 0) {
sizeof(namebuf));
return (answer);
*optout =
qlabels--;
if (qlabels > 0)
return (answer);