nsec3hash.c revision 0c27b3fe77ac1d5094ba3521e8142d9e7973133f
/*
* Copyright (C) 2006, 2008, 2009, 2011, 2014, 2016 Internet Systems Consortium, Inc. ("ISC")
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
/* $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);
}