nsec3hash.c revision 6098d364b690cb9dabf96e9664c4689c8559bd2e
/*
* Copyright (C) 2006 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.2 2008/09/24 02:46:21 marka Exp $ */
#include <config.h>
#include <stdlib.h>
#include <stdarg.h>
#include <isc/iterated_hash.h>
#include <dns/fixedname.h>
const char *program = "nsec3hash";
static void
exit(1);
}
static void
if (result != ISC_R_SUCCESS)
}
static void
usage() {
fatal("salt hash iterations domain");
}
int
unsigned char hash[NSEC3_MAX_HASH_LENGTH];
unsigned char salt[255];
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 > 255U)
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");
exit(0);
}