/*
* Copyright (C) 2012, 2014-2017 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$ */
/*! \file */
#include <config.h>
#include <atf-c.h>
#include <unistd.h>
#include "dnstest.h"
#if defined(OPENSSL) || defined(PKCS11CRYPTO)
/*
* Helper functions
*/
static void
unsigned int iterations;
dns_db_detach(&db);
}
/*%
* Structure containing parameters for nsec3param_salttotext_test().
*/
typedef struct {
/*%
* Check whether dns_nsec3param_salttotext() handles supplied text form
* NSEC3PARAM RDATA correctly: test whether the result of calling the former is
* as expected and whether it properly checks available buffer space.
*
* Assumes supplied text form NSEC3PARAM RDATA is valid as testing handling of
* invalid NSEC3PARAM RDATA is out of scope of this unit test.
*/
static void
/*
* Prepare a dns_rdata_nsec3param_t structure for testing.
*/
sizeof(buf),
/*
* Check typical use.
*/
"\"%s\": expected success, got %s\n",
"\"%s\": expected salt \"%s\", got \"%s\"",
/*
* Ensure available space in the buffer is checked before the salt is
* printed to it and that the amount of space checked for includes the
* terminating NULL byte.
*/
"\"%s\": expected a %lu-byte target buffer to be "
"rejected, got %s\n",
"\"%s\": expected a %lu-byte target buffer to be "
"rejected, got %s\n",
"\"%s\": expected a %lu-byte target buffer to be "
"accepted, got %s\n",
}
/*
* Individual unit tests
*/
" is returned for different key size mixes");
}
dns_test_end();
}
}
size_t i;
/*
* Tests with non-empty salts.
*/
{ "0 0 10 0123456789abcdef", "0123456789ABCDEF" },
{ "0 1 11 0123456789abcdef", "0123456789ABCDEF" },
{ "1 0 12 42", "42" },
{ "1 1 13 42", "42" },
/*
* Test with empty salt.
*/
{ "0 0 0 -", "-" },
};
}
dns_test_end();
}
#else
}
atf_tc_skip("DNSSEC not available");
}
#endif
/*
* Main
*/
#if defined(OPENSSL) || defined(PKCS11CRYPTO)
#else
#endif
return (atf_no_error());
}