nsec3hash.c revision b454c0319685041db3f3e8fd7671e1b364fd20c5
/*
* Copyright (C) 2006, 2008, 2009, 2011 Internet Systems Consortium, Inc. ("ISC")
*
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
* REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
* INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
* LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
* OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: nsec3hash.c,v 1.8 2011/11/02 23:46:24 tbox Exp $ */
#include <config.h>
#include <stdlib.h>
#include <stdarg.h>
#include <isc/iterated_hash.h>
#include <dns/fixedname.h>
const char *program = "nsec3hash";
ISC_PLATFORM_NORETURN_PRE static void
static void
exit(1);
}
static void
if (result != ISC_R_SUCCESS)
}
static void
usage(void) {
program);
exit(1);
}
int
unsigned char hash[NSEC3_MAX_HASH_LENGTH];
unsigned char salt[DNS_NSEC3_SALTSIZE];
unsigned char text[1024];
unsigned int hash_alg;
unsigned int length;
unsigned int iterations;
unsigned int salt_length;
if (argc != 5)
usage();
salt_length = 0;
salt[0] = 0;
} else {
if (salt_length > DNS_NSEC3_SALTSIZE)
fatal("salt too long");
}
if (hash_alg > 255U)
fatal("hash algorithm too large");
if (iterations > 0xffffU)
fatal("iterations to large");
if (length == 0)
fatal("isc_iterated_hash failed");
return(0);
}