sdig
*_test
gsstest
-t_dst
conf.sh
dlopen
keycreate
LIBS = @LIBS@
-SUBDIR = dst system @PKCS11_TOOLS@ optional
+SUBDIR = system @PKCS11_TOOLS@ optional
TESTDIRS = system
+++ /dev/null
-randomfile
-Kdh.+002+18602.key
-Kdh.+002+18602.private
-Kdh.+002+48957.key
-Kdh.+002+48957.private
-Ktest.+001+00002.key
-Ktest.+001+54622.key
-Ktest.+001+54622.private
-Ktest.+003+23616.key
-Ktest.+003+23616.private
-Ktest.+003+49667.key
-dst_2_data
-t2_data_1
-t2_data_2
-t2_dsasig
-t2_rsasig
+++ /dev/null
-dh. IN KEY 0 2 2 AAEBAAAAYIHI/wjtOagNga9GILSoS02IVelgLilPE/TfhtvShsiDAXqb IfxQcj2JkuOnNLs5ttb2WZXWl5/jsSjIxHMwMF2XY4gwt/lwHBf/vgYH r7aIxnKXov1jk9rymTLHGKIOtg==
+++ /dev/null
-Private-key-format: v1.2
-Algorithm: 2 (DH)
-Prime(p): ///////////JD9qiIWjCNMTGYouA3BzRKQJOCIpnzHQCC76mOxObIlFKCHmONATd75UZs806QxswKwpt8l8UN0/hNW1tUcJF5IW1dmJefsb0TELppjo2IP//////////
-Generator(g): Ag==
-Private_value(x): bpdsGQ1jbV3f2CGN/0Pk5KM1MlkFmMryPO1J1zoGn585fRmc9Ygw6l/HKmi2ViiDNorvd9/eV9uyYO6lYZC82R3D7rST1mAqCwbg/8gNE5dXBRbRIIq3qIl6GUYYs8mK
-Public_value(y): gcj/CO05qA2Br0YgtKhLTYhV6WAuKU8T9N+G29KGyIMBepsh/FByPYmS46c0uzm21vZZldaXn+OxKMjEczAwXZdjiDC3+XAcF/++BgevtojGcpei/WOT2vKZMscYog62
+++ /dev/null
-dh. IN KEY 0 2 2 AAEBAAAAYOuaKjyMXYame2F6/ZFdEmXv0a2edB+69PEZgrExA6SJlivn 4KqAsfBHr/+0BCb+7nfWeMDSh2BXnSzWkXF1wMaCHMuz9EleG1gKFKeV Q9gKli88Cb8/jbovWChrGBNp2w==
+++ /dev/null
-Private-key-format: v1.2
-Algorithm: 2 (DH)
-Prime(p): ///////////JD9qiIWjCNMTGYouA3BzRKQJOCIpnzHQCC76mOxObIlFKCHmONATd75UZs806QxswKwpt8l8UN0/hNW1tUcJF5IW1dmJefsb0TELppjo2IP//////////
-Generator(g): Ag==
-Private_value(x): WJG0moh+QoZV+DYhqW7Z6O6TYpYGtSlN0Ym6JV6VRnzeH69OqMUFivqZorj3a3ofR/4zogNVyy5KLLj2NFTaLGP4Hcvt7uETJik6HrjLMhGf40QPXYgVK57Im0rv88Ca
-Public_value(y): 65oqPIxdhqZ7YXr9kV0SZe/RrZ50H7r08RmCsTEDpImWK+fgqoCx8Eev/7QEJv7ud9Z4wNKHYFedLNaRcXXAxoIcy7P0SV4bWAoUp5VD2AqWLzwJvz+Nui9YKGsYE2nb
+++ /dev/null
-# Copyright (C) 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/.
-#
-# See the COPYRIGHT file distributed with this work for additional
-# information regarding copyright ownership.
-
-srcdir = @srcdir@
-VPATH = @srcdir@
-top_srcdir = @top_srcdir@
-
-@BIND9_MAKE_INCLUDES@
-
-CINCLUDES = ${TEST_INCLUDES} ${DNS_INCLUDES} \
- ${ISC_INCLUDES} @DST_OPENSSL_INC@
-
-CDEFINES = @CRYPTO@
-CWARNINGS =
-
-DNSLIBS = ../../../lib/dns/libdns.@A@ @DNS_CRYPTO_LIBS@
-ISCLIBS = ../../../lib/isc/libisc.@A@ @ISC_OPENSSL_LIBS@
-
-DNSDEPLIBS = ../../../lib/dns/libdns.@A@
-ISCDEPLIBS = ../../../lib/isc/libisc.@A@
-
-DEPLIBS = ${DNSDEPLIBS} ${ISCDEPLIBS}
-
-LIBS = ${DNSLIBS} ${ISCLIBS} @LIBS@
-
-TLIB = ../../../lib/tests/libt_api.@A@
-
-TARGETS = t_dst@EXEEXT@
-
-SRCS = t_dst.c
-
-@BIND9_MAKE_RULES@
-
-t_dst@EXEEXT@: t_dst.@O@ ${DEPLIBS} ${TLIB}
- ${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} ${LDFLAGS} -o $@ \
- t_dst.@O@ ${TLIB} ${LIBS}
-
-test: t_dst@EXEEXT@ randomfile
- ../../tools/genrandom@EXEEXT@ 100 randomfile
- -@ ./t_dst@EXEEXT@ -q 1800 -a
-
-randomfile:
- ../../tools/genrandom@EXEEXT@ 100 randomfile
-
-clean distclean::
- rm -f ${TARGETS} randomfile
-
-distclean::
- rm -f Kdh.+002+18602.key
- rm -f Kdh.+002+18602.private
- rm -f Kdh.+002+48957.key
- rm -f Kdh.+002+48957.private
- rm -f Ktest.+001+00002.key
- rm -f Ktest.+001+54622.key
- rm -f Ktest.+001+54622.private
- rm -f Ktest.+003+23616.key
- rm -f Ktest.+003+23616.private
- rm -f Ktest.+003+49667.key
- rm -f dst_2_data
- rm -f t2_data_1
- rm -f t2_data_2
- rm -f t2_dsasig
- rm -f t2_rsasig
+++ /dev/null
-#
-# data for signature verification test
-#
-# format:
-# datafile, sigpath, keyname, keyid, alg, exp_result
-#
-t2_data_1 t2_dsasig test. 23616 DST_ALG_DSA ISC_R_SUCCESS
-t2_data_1 t2_rsasig test. 54622 DST_ALG_RSAMD5 ISC_R_SUCCESS
-# wrong sig
-t2_data_1 t2_dsasig test. 54622 DST_ALG_RSAMD5 !ISC_R_SUCCESS
-# wrong key
-#t2_data_1 t2_dsasig test. 54622 DST_ALG_DSA !ISC_R_SUCCESS
-# wrong alg
-#t2_data_1 t2_dsasig test. 23616 DST_ALG_RSAMD5 !ISC_R_SUCCESS
-# wrong data
-t2_data_2 t2_dsasig test. 23616 DST_ALG_DSA !ISC_R_SUCCESS
+++ /dev/null
-/*
- * Copyright (C) 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/.
- *
- * See the COPYRIGHT file distributed with this work for additional
- * information regarding copyright ownership.
- */
-
-/* $Id: t_dst.c,v 1.60 2011/03/17 23:47:29 tbox Exp $ */
-
-#include <config.h>
-
-#include <errno.h>
-#include <fcntl.h>
-#include <limits.h>
-#include <stdlib.h>
-
-#ifndef WIN32
-#include <unistd.h> /* XXX */
-#else
-#include <direct.h>
-#endif
-
-#include <isc/buffer.h>
-#include <isc/dir.h>
-#include <isc/entropy.h>
-#include <isc/file.h>
-#include <isc/mem.h>
-#include <isc/print.h>
-#include <isc/region.h>
-#include <isc/stdio.h>
-#include <isc/string.h>
-#include <isc/util.h>
-
-#include <dns/fixedname.h>
-#include <dns/name.h>
-
-#include <dst/dst.h>
-#include <dst/result.h>
-
-#include <tests/t_api.h>
-
-#ifndef PATH_MAX
-#define PATH_MAX 256
-#endif
-
-/*
- * Adapted from the original dst_test.c program.
- */
-
-static void
-cleandir(char *path) {
- isc_dir_t dir;
- char fullname[PATH_MAX + 1];
- size_t l;
- isc_result_t ret;
-
- isc_dir_init(&dir);
- ret = isc_dir_open(&dir, path);
- if (ret != ISC_R_SUCCESS) {
- t_info("isc_dir_open(%s) failed %s\n",
- path, isc_result_totext(ret));
- return;
- }
-
- while (isc_dir_read(&dir) == ISC_R_SUCCESS) {
- if (!strcmp(dir.entry.name, "."))
- continue;
- if (!strcmp(dir.entry.name, ".."))
- continue;
- (void)strlcpy(fullname, path, sizeof(fullname));
- (void)strlcat(fullname, "/", sizeof(fullname));
- l = strlcat(fullname, dir.entry.name, sizeof(fullname));
- if (l < sizeof(fullname)) {
- if (remove(fullname))
- t_info("remove(%s) failed %d\n", fullname,
- errno);
- } else
- t_info("unable to remove '%s/%s': path too long\n",
- path, dir.entry.name);
-
- }
- isc_dir_close(&dir);
- if (rmdir(path))
- t_info("rmdir(%s) failed %d\n", path, errno);
-
- return;
-}
-
-static void
-use(dst_key_t *key, isc_mem_t *mctx, isc_result_t exp_result, int *nfails) {
-
- isc_result_t ret;
- const char *data = "This is some data";
- unsigned char sig[512];
- isc_buffer_t databuf, sigbuf;
- isc_region_t datareg, sigreg;
- dst_context_t *ctx = NULL;
-
- isc_buffer_init(&sigbuf, sig, sizeof(sig));
- isc_buffer_constinit(&databuf, data, strlen(data));
- isc_buffer_add(&databuf, strlen(data));
- isc_buffer_usedregion(&databuf, &datareg);
-
- ret = dst_context_create3(key, mctx,
- DNS_LOGCATEGORY_GENERAL, ISC_TRUE, &ctx);
- if (ret != exp_result) {
- t_info("dst_context_create(%d) returned (%s) expected (%s)\n",
- dst_key_alg(key), dst_result_totext(ret),
- dst_result_totext(exp_result));
- ++*nfails;
- return;
- }
- if (exp_result != ISC_R_SUCCESS)
- return;
- ret = dst_context_adddata(ctx, &datareg);
- if (ret != ISC_R_SUCCESS) {
- t_info("dst_context_adddata(%d) returned (%s)\n",
- dst_key_alg(key), dst_result_totext(ret));
- ++*nfails;
- dst_context_destroy(&ctx);
- return;
- }
- ret = dst_context_sign(ctx, &sigbuf);
- if (ret != ISC_R_SUCCESS) {
- t_info("dst_context_sign(%d) returned (%s)\n",
- dst_key_alg(key), dst_result_totext(ret));
- ++*nfails;
- dst_context_destroy(&ctx);
- return;
- }
- dst_context_destroy(&ctx);
-
- isc_buffer_remainingregion(&sigbuf, &sigreg);
- ret = dst_context_create3(key, mctx,
- DNS_LOGCATEGORY_GENERAL, ISC_FALSE, &ctx);
- if (ret != ISC_R_SUCCESS) {
- t_info("dst_context_create(%d) returned (%s)\n",
- dst_key_alg(key), dst_result_totext(ret));
- ++*nfails;
- return;
- }
- ret = dst_context_adddata(ctx, &datareg);
- if (ret != ISC_R_SUCCESS) {
- t_info("dst_context_adddata(%d) returned (%s)\n",
- dst_key_alg(key), dst_result_totext(ret));
- ++*nfails;
- dst_context_destroy(&ctx);
- return;
- }
- ret = dst_context_verify(ctx, &sigreg);
- if (ret != exp_result) {
- t_info("dst_context_verify(%d) returned (%s) expected (%s)\n",
- dst_key_alg(key), dst_result_totext(ret),
- dst_result_totext(exp_result));
- ++*nfails;
- dst_context_destroy(&ctx);
- return;
- }
- dst_context_destroy(&ctx);
-}
-
-static void
-dh(dns_name_t *name1, int id1, dns_name_t *name2, int id2, isc_mem_t *mctx,
- isc_result_t exp_result, int *nfails, int *nprobs)
-{
- dst_key_t *key1 = NULL, *key2 = NULL;
- isc_result_t ret;
- char current[PATH_MAX + 1];
- char tmp[PATH_MAX + 1];
- char *p;
- int alg = DST_ALG_DH;
- int type = DST_TYPE_PUBLIC|DST_TYPE_PRIVATE|DST_TYPE_KEY;
- unsigned char array1[1024], array2[1024];
- isc_buffer_t b1, b2;
- isc_region_t r1, r2;
-
- UNUSED(exp_result);
-
- p = getcwd(current, PATH_MAX);;
- if (p == NULL) {
- t_info("getcwd failed %d\n", errno);
- ++*nprobs;
- goto cleanup;
- }
-
- ret = dst_key_fromfile(name1, id1, alg, type, current, mctx, &key1);
- if (ret != ISC_R_SUCCESS) {
- t_info("dst_key_fromfile(%d) returned: %s\n",
- alg, dst_result_totext(ret));
- ++*nfails;
- goto cleanup;
- }
-
- ret = dst_key_fromfile(name2, id2, alg, type, current, mctx, &key2);
- if (ret != ISC_R_SUCCESS) {
- t_info("dst_key_fromfile(%d) returned: %s\n",
- alg, dst_result_totext(ret));
- ++*nfails;
- goto cleanup;
- }
-
-#ifndef WIN32
- ret = isc_file_mktemplate("/tmp/", tmp, sizeof(tmp));
-#else
- ret = isc_file_mktemplate(getenv("TEMP"), tmp, sizeof(tmp));
-#endif
- if (ret != ISC_R_SUCCESS) {
- t_info("isc_file_mktemplate failed %s\n",
- isc_result_totext(ret));
- ++*nprobs;
- goto cleanup;
- }
-
- ret = isc_dir_createunique(tmp);
- if (ret != ISC_R_SUCCESS) {
- t_info("isc_dir_createunique failed %s\n",
- isc_result_totext(ret));
- ++*nprobs;
- goto cleanup;
- }
-
- ret = dst_key_tofile(key1, type, tmp);
- if (ret != 0) {
- t_info("dst_key_tofile(%d) returned: %s\n",
- alg, dst_result_totext(ret));
- ++*nfails;
- goto cleanup;
- }
-
- ret = dst_key_tofile(key2, type, tmp);
- if (ret != 0) {
- t_info("dst_key_tofile(%d) returned: %s\n",
- alg, dst_result_totext(ret));
- ++*nfails;
- goto cleanup;
- }
-
- cleandir(tmp);
-
- isc_buffer_init(&b1, array1, sizeof(array1));
- ret = dst_key_computesecret(key1, key2, &b1);
- if (ret != 0) {
- t_info("dst_computesecret() returned: %s\n",
- dst_result_totext(ret));
- ++*nfails;
- goto cleanup;
- }
-
- isc_buffer_init(&b2, array2, sizeof(array2));
- ret = dst_key_computesecret(key2, key1, &b2);
- if (ret != 0) {
- t_info("dst_computesecret() returned: %s\n",
- dst_result_totext(ret));
- ++*nfails;
- goto cleanup;
- }
-
- isc_buffer_usedregion(&b1, &r1);
- isc_buffer_usedregion(&b2, &r2);
- if (r1.length != r2.length || memcmp(r1.base, r2.base, r1.length) != 0)
- {
- t_info("computed secrets don't match\n");
- ++*nfails;
- goto cleanup;
- }
-
- cleanup:
- if (key1 != NULL)
- dst_key_free(&key1);
- if (key2 != NULL)
- dst_key_free(&key2);
-}
-
-static void
-io(dns_name_t *name, isc_uint16_t id, isc_uint16_t alg, int type,
- isc_mem_t *mctx, isc_result_t exp_result, int *nfails, int *nprobs)
-{
- dst_key_t *key = NULL;
- isc_result_t ret;
- char current[PATH_MAX + 1];
- char tmp[PATH_MAX + 1];
- char *p;
-
- p = getcwd(current, PATH_MAX);;
- if (p == NULL) {
- t_info("getcwd failed %d\n", errno);
- ++*nprobs;
- goto failure;
- }
-
- ret = dst_key_fromfile(name, id, alg, type, current, mctx, &key);
- if (ret != ISC_R_SUCCESS) {
- t_info("dst_key_fromfile(%d) returned: %s\n",
- alg, dst_result_totext(ret));
- ++*nfails;
- goto failure;
- }
-
- if (dst_key_id(key) != id) {
- t_info("key ID incorrect\n");
- ++*nfails;
- goto failure;
- }
-
- if (dst_key_alg(key) != alg) {
- t_info("key algorithm incorrect\n");
- ++*nfails;
- goto failure;
- }
-
- if (dst_key_getttl(key) != 0) {
- t_info("initial key TTL incorrect\n");
- ++*nfails;
- goto failure;
- }
-
-#ifndef WIN32
- ret = isc_file_mktemplate("/tmp/", tmp, sizeof(tmp));
-#else
- ret = isc_file_mktemplate(getenv("TEMP"), tmp, sizeof(tmp));
-#endif
- if (ret != ISC_R_SUCCESS) {
- t_info("isc_file_mktemplate failed %s\n",
- isc_result_totext(ret));
- ++*nprobs;
- goto failure;
- }
-
- ret = isc_dir_createunique(tmp);
- if (ret != ISC_R_SUCCESS) {
- t_info("mkdir failed %d\n", errno);
- ++*nprobs;
- goto failure;
- }
-
- ret = dst_key_tofile(key, type, tmp);
- if (ret != 0) {
- t_info("dst_key_tofile(%d) returned: %s\n",
- alg, dst_result_totext(ret));
- ++*nfails;
- goto failure;
- }
-
- if (dst_key_alg(key) != DST_ALG_DH)
- use(key, mctx, exp_result, nfails);
-
- /*
- * Skip the rest of this test if we weren't expecting
- * the read to be successful.
- */
- if (exp_result != ISC_R_SUCCESS)
- goto cleanup;
-
- dst_key_setttl(key, 3600);
- ret = dst_key_tofile(key, type, tmp);
- if (ret != 0) {
- t_info("dst_key_tofile(%d) returned: %s\n",
- alg, dst_result_totext(ret));
- ++*nfails;
- goto failure;
- }
-
- /* Reread key to confirm TTL was changed */
- dst_key_free(&key);
- ret = dst_key_fromfile(name, id, alg, type, tmp, mctx, &key);
- if (ret != ISC_R_SUCCESS) {
- t_info("dst_key_fromfile(%d) returned: %s\n",
- alg, dst_result_totext(ret));
- ++*nfails;
- goto failure;
- }
-
- if (dst_key_getttl(key) != 3600) {
- t_info("modified key TTL incorrect\n");
- ++*nfails;
- goto failure;
- }
-
- cleanup:
- cleandir(tmp);
-
- failure:
- if (key != NULL)
- dst_key_free(&key);
-}
-
-static void
-generate(int alg, isc_mem_t *mctx, int size, int *nfails) {
- isc_result_t ret;
- dst_key_t *key = NULL;
-
- ret = dst_key_generate(dns_rootname, alg, size, 0, 0, 0,
- dns_rdataclass_in, mctx, &key);
- if (ret != ISC_R_SUCCESS) {
- t_info("dst_key_generate(%d) returned: %s\n", alg,
- dst_result_totext(ret));
- ++*nfails;
- goto cleanup;
- }
-
- if (alg != DST_ALG_DH)
- use(key, mctx, ISC_R_SUCCESS, nfails);
- cleanup:
- if (key != NULL)
- dst_key_free(&key);
-}
-
-#define DBUFSIZ 25
-
-static const char *a1 =
- "the dst module provides the capability to "
- "generate, store and retrieve public and private keys, "
- "sign and verify data using the RSA, DSA and MD5 algorithms, "
- "and compute Diffie-Hellman shared secrets.";
-static void
-t1(void) {
- isc_mem_t *mctx;
- isc_entropy_t *ectx;
- int nfails;
- int nprobs;
- int result;
- isc_result_t isc_result;
- dns_fixedname_t fname;
- dns_name_t *name;
- isc_buffer_t b;
-
- t_assert("dst", 1, T_REQUIRED, "%s", a1);
-
- nfails = 0;
- nprobs = 0;
- mctx = NULL;
- isc_result = isc_mem_create(0, 0, &mctx);
- if (isc_result != ISC_R_SUCCESS) {
- t_info("isc_mem_create failed %s\n",
- isc_result_totext(isc_result));
- t_result(T_UNRESOLVED);
- return;
- }
- ectx = NULL;
- isc_result = isc_entropy_create(mctx, &ectx);
- if (isc_result != ISC_R_SUCCESS) {
- t_info("isc_entropy_create failed %s\n",
- isc_result_totext(isc_result));
- t_result(T_UNRESOLVED);
- return;
- }
- isc_result = isc_entropy_createfilesource(ectx, "randomfile");
- if (isc_result != ISC_R_SUCCESS) {
- t_info("isc_entropy_create failed %s\n",
- isc_result_totext(isc_result));
- t_result(T_UNRESOLVED);
- return;
- }
- isc_result = dst_lib_init(mctx, ectx, ISC_ENTROPY_BLOCKING);
- if (isc_result != ISC_R_SUCCESS) {
- t_info("dst_lib_init failed %s\n",
- isc_result_totext(isc_result));
- t_result(T_UNRESOLVED);
- return;
- }
-
- if (!dst_algorithm_supported(DST_ALG_RSAMD5)) {
- dst_lib_destroy();
- t_info("library built without crypto support\n");
- t_result(T_SKIPPED);
- return;
- }
-
- t_info("testing use of stored keys [1]\n");
-
- dns_fixedname_init(&fname);
- name = dns_fixedname_name(&fname);
- isc_buffer_constinit(&b, "test.", 5);
- isc_buffer_add(&b, 5);
- isc_result = dns_name_fromtext(name, &b, NULL, 0, NULL);
- if (isc_result != ISC_R_SUCCESS) {
- t_info("dns_name_fromtext failed %s\n",
- isc_result_totext(isc_result));
- t_result(T_UNRESOLVED);
- return;
- }
- io(name, 23616, DST_ALG_DSA, DST_TYPE_PRIVATE|DST_TYPE_PUBLIC,
- mctx, ISC_R_SUCCESS, &nfails, &nprobs);
- t_info("testing use of stored keys [2]\n");
- io(name, 54622, DST_ALG_RSAMD5, DST_TYPE_PRIVATE|DST_TYPE_PUBLIC,
- mctx, ISC_R_SUCCESS, &nfails, &nprobs);
-
- t_info("testing use of stored keys [3]\n");
- io(name, 49667, DST_ALG_DSA, DST_TYPE_PRIVATE|DST_TYPE_PUBLIC,
- mctx, DST_R_NULLKEY, &nfails, &nprobs);
- t_info("testing use of stored keys [4]\n");
- io(name, 2, DST_ALG_RSAMD5, DST_TYPE_PRIVATE|DST_TYPE_PUBLIC,
- mctx, DST_R_NULLKEY, &nfails, &nprobs);
-
- isc_buffer_constinit(&b, "dh.", 3);
- isc_buffer_add(&b, 3);
- isc_result = dns_name_fromtext(name, &b, NULL, 0, NULL);
- if (isc_result != ISC_R_SUCCESS) {
- t_info("dns_name_fromtext failed %s\n",
- isc_result_totext(isc_result));
- t_result(T_UNRESOLVED);
- return;
- }
-
- dh(name, 18602, name, 48957, mctx, ISC_R_SUCCESS, &nfails, &nprobs);
-
- t_info("testing use of generated keys\n");
- generate(DST_ALG_RSAMD5, mctx, 512, &nfails);
- generate(DST_ALG_DSA, mctx, 512, &nfails);
- generate(DST_ALG_DH, mctx, 512, &nfails);
- /*
- * This one uses a constant.
- */
- generate(DST_ALG_DH, mctx, 768, &nfails);
- generate(DST_ALG_HMACMD5, mctx, 512, &nfails);
-
- dst_lib_destroy();
-
- isc_entropy_detach(&ectx);
-
- isc_mem_destroy(&mctx);
-
- result = T_UNRESOLVED;
- if ((nfails == 0) && (nprobs == 0))
- result = T_PASS;
- else if (nfails)
- result = T_FAIL;
- t_result(result);
-
-}
-
-#define T_SIGMAX 512
-
-#undef NEWSIG /* Define NEWSIG to generate the original signature file. */
-
-#ifdef NEWSIG
-
-/*
- * Write a sig in buf to file at path.
- */
-static int
-sig_tofile(char *path, isc_buffer_t *buf) {
- int rval;
- int fd;
- int len;
- int nprobs;
- int cnt;
- unsigned char c;
- unsigned char val;
-
- cnt = 0;
- nprobs = 0;
- len = buf->used - buf->current;
-
- t_info("buf: current %d used %d len %d\n",
- buf->current, buf->used, len);
-
- fd = open(path, O_CREAT|O_TRUNC|O_WRONLY, S_IRWXU|S_IRWXO|S_IRWXG);
- if (fd < 0) {
- t_info("open %s failed %d\n", path, errno);
- return(1);
- }
-
- while (len) {
- c = (unsigned char) isc_buffer_getuint8(buf);
- val = ((c >> 4 ) & 0x0f);
- if ((0 <= val) && (val <= 9))
- val = '0' + val;
- else
- val = 'A' + val - 10;
- rval = write(fd, &val, 1);
- if (rval != 1) {
- ++nprobs;
- t_info("write failed %d %d\n", rval, errno);
- break;
- }
- val = (c & 0x0f);
- if ((0 <= val) && (val <= 9))
- val = '0' + val;
- else
- val = 'A' + val - 10;
- rval = write(fd, &val, 1);
- if (rval != 1) {
- ++nprobs;
- t_info("write failed %d %d\n", rval, errno);
- break;
- }
- --len;
- ++cnt;
- if ((cnt % 16) == 0) {
- val = '\n';
- rval = write(fd, &val, 1);
- if (rval != 1) {
- ++nprobs;
- t_info("write failed %d %d\n", rval, errno);
- break;
- }
- }
- }
- val = '\n';
- rval = write(fd, &val, 1);
- if (rval != 1) {
- ++nprobs;
- t_info("write failed %d %d\n", rval, errno);
- }
- (void) close(fd);
- return(nprobs);
-}
-
-#endif /* NEWSIG */
-
-/*
- * Read sig in file at path to buf.
- */
-static int
-sig_fromfile(char *path, isc_buffer_t *iscbuf) {
- size_t rval;
- size_t len;
- FILE *fp;
- unsigned char val;
- char *p;
- char *buf;
- isc_result_t isc_result;
- off_t size;
-
- isc_result = isc_stdio_open(path, "rb", &fp);
- if (isc_result != ISC_R_SUCCESS) {
- t_info("open failed, result: %s\n",
- isc_result_totext(isc_result));
- return(1);
- }
-
- isc_result = isc_file_getsizefd(fileno(fp), &size);
- if (isc_result != ISC_R_SUCCESS) {
- t_info("stat %s failed, result: %s\n",
- path, isc_result_totext(isc_result));
- isc_stdio_close(fp);
- return(1);
- }
-
- buf = (char *) malloc((size + 1) * sizeof(char));
- if (buf == NULL) {
- t_info("malloc failed, errno == %d\n", errno);
- isc_stdio_close(fp);
- return(1);
- }
-
- len = (size_t)size;
- p = buf;
- while (len != 0U) {
- isc_result = isc_stdio_read(p, 1, len, fp, &rval);
- if (isc_result == ISC_R_SUCCESS) {
- len -= rval;
- p += rval;
- } else {
- t_info("read failed %d, result: %s\n",
- (int)rval, isc_result_totext(isc_result));
- (void) free(buf);
- (void) isc_stdio_close(fp);
- return(1);
- }
- }
- isc_stdio_close(fp);
-
- p = buf;
- len = size;
- while (len > 0U) {
- if ((*p == '\r') || (*p == '\n')) {
- ++p;
- --len;
- continue;
- } else if (len < 2U)
- goto err;
- if (('0' <= *p) && (*p <= '9'))
- val = *p - '0';
- else if (('A' <= *p) && (*p <= 'F'))
- val = *p - 'A' + 10;
- else
- goto err;
- ++p;
- val <<= 4;
- --len;
- if (('0' <= *p) && (*p <= '9'))
- val |= (*p - '0');
- else if (('A' <= *p) && (*p <= 'F'))
- val |= (*p - 'A' + 10);
- else
- goto err;
- ++p;
- --len;
- isc_buffer_putuint8(iscbuf, val);
- }
- (void) free(buf);
- return(0);
-
- err:
- (void) free(buf);
- return (1);
-}
-
-static void
-t2_sigchk(char *datapath, char *sigpath, char *keyname,
- int id, int alg, int type,
- isc_mem_t *mctx, char *expected_result,
- int *nfails, int *nprobs)
-{
- size_t rval;
- size_t len;
- FILE *fp;
- int exp_res;
- dst_key_t *key = NULL;
- unsigned char sig[T_SIGMAX];
- unsigned char *p;
- unsigned char *data;
- off_t size;
- isc_result_t isc_result;
- isc_buffer_t databuf;
- isc_buffer_t sigbuf;
- isc_region_t datareg;
- isc_region_t sigreg;
- dns_fixedname_t fname;
- dns_name_t *name;
- isc_buffer_t b;
- dst_context_t *ctx = NULL;
-
- /*
- * Read data from file in a form usable by dst_verify.
- */
- isc_result = isc_stdio_open(datapath, "rb", &fp);
- if (isc_result != ISC_R_SUCCESS) {
- t_info("t2_sigchk: open failed %s\n",
- isc_result_totext(isc_result));
- ++*nprobs;
- return;
- }
-
- isc_result = isc_file_getsizefd(fileno(fp), &size);
- if (isc_result != ISC_R_SUCCESS) {
- t_info("t2_sigchk: stat (%s) failed %s\n",
- datapath, isc_result_totext(isc_result));
- ++*nprobs;
- isc_stdio_close(fp);
- return;
- }
-
- data = (unsigned char *) malloc(size * sizeof(unsigned char));
- if (data == NULL) {
- t_info("t2_sigchk: malloc failed %d\n", errno);
- ++*nprobs;
- isc_stdio_close(fp);
- return;
- }
-
- p = data;
- len = (size_t)size;
- do {
- isc_result = isc_stdio_read(p, 1, len, fp, &rval);
- if (isc_result == ISC_R_SUCCESS) {
- len -= rval;
- p += rval;
- }
- } while (len);
- (void) isc_stdio_close(fp);
-
- /*
- * Read key from file in a form usable by dst_verify.
- */
- dns_fixedname_init(&fname);
- name = dns_fixedname_name(&fname);
- isc_buffer_constinit(&b, keyname, strlen(keyname));
- isc_buffer_add(&b, strlen(keyname));
- isc_result = dns_name_fromtext(name, &b, dns_rootname, 0, NULL);
- if (isc_result != ISC_R_SUCCESS) {
- t_info("dns_name_fromtext failed %s\n",
- isc_result_totext(isc_result));
- (void) free(data);
- ++*nprobs;
- return;
- }
- isc_result = dst_key_fromfile(name, id, alg, type, NULL, mctx, &key);
- if (isc_result != ISC_R_SUCCESS) {
- t_info("dst_key_fromfile failed %s\n",
- isc_result_totext(isc_result));
- (void) free(data);
- ++*nprobs;
- return;
- }
-
- isc_buffer_init(&databuf, data, (unsigned int)size);
- isc_buffer_add(&databuf, (unsigned int)size);
- isc_buffer_usedregion(&databuf, &datareg);
-
-#ifdef NEWSIG
-
- /*
- * If we're generating a signature for the first time,
- * sign the data and save the signature to a file
- */
-
- memset(sig, 0, sizeof(sig));
- isc_buffer_init(&sigbuf, sig, sizeof(sig));
-
- isc_result = dst_context_create3(key, mctx,
- DNS_LOGCATEGORY_GENERAL,
- ISC_TRUE, &ctx);
- if (isc_result != ISC_R_SUCCESS) {
- t_info("dst_context_create(%d) failed %s\n",
- dst_result_totext(isc_result));
- (void) free(data);
- dst_key_free(&key);
- ++*nprobs;
- return;
- }
- isc_result = dst_context_adddata(ctx, &datareg);
- if (isc_result != ISC_R_SUCCESS) {
- t_info("dst_context_adddata(%d) failed %s\n",
- dst_result_totext(isc_result));
- (void) free(data);
- dst_key_free(&key);
- dst_context_destroy(&ctx);
- ++*nprobs;
- return;
- }
- isc_result = dst_context_sign(ctx, &sigbuf);
- if (isc_result != ISC_R_SUCCESS) {
- t_info("dst_sign(%d) failed %s\n",
- dst_result_totext(isc_result));
- (void) free(data);
- dst_key_free(&key);
- dst_context_destroy(&ctx);
- ++*nprobs;
- return;
- }
- dst_context_destroy(&ctx);
-
- rval = sig_tofile(sigpath, &sigbuf);
- if (rval != 0) {
- t_info("sig_tofile failed\n");
- ++*nprobs;
- (void) free(data);
- dst_key_free(&key);
- return;
- }
-
-#endif /* NEWSIG */
-
- memset(sig, 0, sizeof(sig));
- isc_buffer_init(&sigbuf, sig, sizeof(sig));
-
- /*
- * Read precomputed signature from file in a form usable by dst_verify.
- */
- rval = sig_fromfile(sigpath, &sigbuf);
- if (rval != 0U) {
- t_info("sig_fromfile failed\n");
- (void) free(data);
- dst_key_free(&key);
- ++*nprobs;
- return;
- }
-
- /*
- * Verify that the key signed the data.
- */
- isc_buffer_remainingregion(&sigbuf, &sigreg);
-
- exp_res = 0;
- if (strstr(expected_result, "!"))
- exp_res = 1;
-
- isc_result = dst_context_create3(key, mctx,
- DNS_LOGCATEGORY_GENERAL,
- ISC_FALSE, &ctx);
- if (isc_result != ISC_R_SUCCESS) {
- t_info("dst_context_create returned %s\n",
- isc_result_totext(isc_result));
- (void) free(data);
- dst_key_free(&key);
- ++*nfails;
- return;
- }
- isc_result = dst_context_adddata(ctx, &datareg);
- if (isc_result != ISC_R_SUCCESS) {
- t_info("dst_context_adddata returned %s\n",
- isc_result_totext(isc_result));
- (void) free(data);
- dst_context_destroy(&ctx);
- dst_key_free(&key);
- ++*nfails;
- return;
- }
- isc_result = dst_context_verify(ctx, &sigreg);
- if ( ((exp_res == 0) && (isc_result != ISC_R_SUCCESS)) ||
- ((exp_res != 0) && (isc_result == ISC_R_SUCCESS))) {
-
- t_info("dst_context_verify returned %s, expected %s\n",
- isc_result_totext(isc_result),
- expected_result);
- ++*nfails;
- }
-
- (void) free(data);
- dst_context_destroy(&ctx);
- dst_key_free(&key);
- return;
-}
-
-/*
- * The astute observer will note that t1() signs then verifies data
- * during the test but that t2() verifies data that has been
- * signed at some earlier time, possibly with an entire different
- * version or implementation of the DSA and RSA algorithms
- */
-
-isc_mem_t *t2_mctx = NULL;
-isc_entropy_t *t2_ectx = NULL;
-
-static int
-t2_vfy_init(void) {
- isc_result_t isc_result;
-
- t2_mctx = NULL;
- isc_result = isc_mem_create(0, 0, &t2_mctx);
- if (isc_result != ISC_R_SUCCESS) {
- t_info("isc_mem_create failed %s\n",
- isc_result_totext(isc_result));
- return(0);
- }
- t2_ectx = NULL;
- isc_result = isc_entropy_create(t2_mctx, &t2_ectx);
- if (isc_result != ISC_R_SUCCESS) {
- t_info("isc_entropy_create failed %s\n",
- isc_result_totext(isc_result));
- return(0);
- }
- isc_result = isc_entropy_createfilesource(t2_ectx, "randomfile");
- if (isc_result != ISC_R_SUCCESS) {
- t_info("isc_entropy_create failed %s\n",
- isc_result_totext(isc_result));
- return(0);
- }
- isc_result = dst_lib_init(t2_mctx, t2_ectx, ISC_ENTROPY_BLOCKING);
- if (isc_result != ISC_R_SUCCESS) {
- t_info("dst_lib_init failed %s\n",
- isc_result_totext(isc_result));
- return(0);
- }
- return(1);
-}
-
-/*
- * av == datafile, sigpath, keyname, keyid, alg, exp_result.
- */
-static int
-t2_vfy(char **av) {
- char *datapath;
- char *sigpath;
- char *keyname;
- char *key;
- int keyid;
- char *alg;
- int algid;
- char *exp_result;
- int nfails;
- int nprobs;
- int result;
-
- datapath = *av++;
- sigpath = *av++;
- keyname = *av++;
- key = *av++;
- keyid = atoi(key);
- alg = *av++;
- exp_result = *av++;
- nfails = 0;
- nprobs = 0;
-
- if (! strcasecmp(alg, "DST_ALG_DSA"))
- algid = DST_ALG_DSA;
- else if (! strcasecmp(alg, "DST_ALG_RSAMD5"))
- algid = DST_ALG_RSAMD5;
- else {
- t_info("Unknown algorithm %s\n", alg);
- return(T_UNRESOLVED);
- }
-
- if (!dst_algorithm_supported(DST_ALG_RSAMD5)) {
- t_info("library built without crypto support\n");
- return (T_SKIPPED);
- }
-
- t_info("testing %s, %s, %s, %s, %s, %s\n",
- datapath, sigpath, keyname, key, alg, exp_result);
- t2_sigchk(datapath, sigpath, keyname, keyid,
- algid, DST_TYPE_PRIVATE|DST_TYPE_PUBLIC,
- t2_mctx, exp_result,
- &nfails, &nprobs);
-
- result = T_UNRESOLVED;
- if (nfails)
- result = T_FAIL;
- else if ((nfails == 0) && (nprobs == 0))
- result = T_PASS;
-
- return(result);
-}
-
-static const char *a2 =
- "the dst module provides the capability to "
- "verify data signed with the RSA and DSA algorithms";
-
-static void
-t2(void) {
- int result;
- t_assert("dst", 2, T_REQUIRED, "%s", a2);
- if (!t2_vfy_init()) {
- result = T_UNRESOLVED;
- } else {
- result = t_eval("dst_2_data", t2_vfy, 6);
- dst_lib_destroy();
- }
- if (t2_ectx)
- isc_entropy_detach(&t2_ectx);
- if (t2_mctx)
- isc_mem_destroy(&t2_mctx);
- t_result(result);
-}
-
-testspec_t T_testlist[] = {
- { (PFV) t1, "basic dst module verification" },
- { (PFV) t2, "signature ineffability" },
- { (PFV) 0, NULL }
-};
-
-#ifdef WIN32
-int
-main(int argc, char **argv) {
- t_settests(T_testlist);
- return (t_main(argc, argv));
-}
-#endif
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup>
- <Filter Include="Source Files">
- <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
- <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
- </Filter>
- <Filter Include="Header Files">
- <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
- <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
- </Filter>
- <Filter Include="Resource Files">
- <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
- <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
- </Filter>
- </ItemGroup>
- <ItemGroup>
- <ClCompile Include="..\t_dst.c">
- <Filter>Source Files</Filter>
- </ClCompile>
- </ItemGroup>
-</Project>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup Label="ProjectConfigurations">
- <ProjectConfiguration Include="Debug|@PLATFORM@">
- <Configuration>Debug</Configuration>
- <Platform>@PLATFORM@</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|@PLATFORM@">
- <Configuration>Release</Configuration>
- <Platform>@PLATFORM@</Platform>
- </ProjectConfiguration>
- </ItemGroup>
- <PropertyGroup Label="Globals">
- <ProjectGuid>{EE9B94CF-7C33-4F3B-A674-FB756D422C54}</ProjectGuid>
- <Keyword>Win32Proj</Keyword>
- <RootNamespace>t_dst</RootNamespace>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|@PLATFORM@'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- <UseDebugLibraries>true</UseDebugLibraries>
- <CharacterSet>MultiByte</CharacterSet>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|@PLATFORM@'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- <UseDebugLibraries>false</UseDebugLibraries>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- <CharacterSet>MultiByte</CharacterSet>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
- <ImportGroup Label="ExtensionSettings">
- </ImportGroup>
- <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|@PLATFORM@'">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|@PLATFORM@'">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <PropertyGroup Label="UserMacros" />
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|@PLATFORM@'">
- <LinkIncremental>true</LinkIncremental>
- <OutDir>..\..\..\..\Build\$(Configuration)\</OutDir>
- <IntDir>.\$(Configuration)\</IntDir>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|@PLATFORM@'">
- <LinkIncremental>false</LinkIncremental>
- <OutDir>..\..\..\..\Build\$(Configuration)\</OutDir>
- <IntDir>.\$(Configuration)\</IntDir>
- </PropertyGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|@PLATFORM@'">
- <ClCompile>
- <PrecompiledHeader>
- </PrecompiledHeader>
- <WarningLevel>Level3</WarningLevel>
- <Optimization>Disabled</Optimization>
- <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <FunctionLevelLinking>true</FunctionLevelLinking>
- <PrecompiledHeaderOutputFile>.\$(Configuration)\$(TargetName).pch</PrecompiledHeaderOutputFile>
- <AssemblerListingLocation>.\$(Configuration)\</AssemblerListingLocation>
- <ObjectFileName>.\$(Configuration)\</ObjectFileName>
- <ProgramDataBaseFileName>$(OutDir)$(TargetName).pdb</ProgramDataBaseFileName>
- <BrowseInformation>true</BrowseInformation>
- <AdditionalIncludeDirectories>.\;..\..\..\..\;@LIBXML2_INC@..\..\..\..\lib\isc\win32;..\..\..\..\lib\isc\win32\include;..\..\..\..\lib\isc\include;..\..\..\..\lib\dns\include;..\..\..\..\lib\tests\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <CompileAs>CompileAsC</CompileAs>
- </ClCompile>
- <Link>
- <SubSystem>Console</SubSystem>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <OutputFile>..\..\..\..\Build\$(Configuration)\$(TargetName)$(TargetExt)</OutputFile>
- <AdditionalLibraryDirectories>..\..\..\..\lib\isc\win32\$(Configuration);..\..\..\..\lib\dns\win32\$(Configuration);..\..\..\..\lib\tests\win32\$(Configuration);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
- <AdditionalDependencies>@LIBXML2_LIB@libisc.lib;libdns.lib;libtests.lib;ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
- </Link>
- <PreBuildEvent>
- <Command>cd ..
-copy "Kdh.+002+18602.key.in" "Kdh.+002+18602.key"
-copy "Kdh.+002+18602.private.in" "Kdh.+002+18602.private"
-copy "Kdh.+002+48957.key.in" "Kdh.+002+48957.key"
-copy "Kdh.+002+48957.private.in" "Kdh.+002+48957.private"
-copy "Ktest.+001+00002.key.in" "Ktest.+001+00002.key"
-copy "Ktest.+001+54622.key.in" "Ktest.+001+54622.key"
-copy "Ktest.+001+54622.private.in" "Ktest.+001+54622.private"
-copy "Ktest.+003+23616.key.in" "Ktest.+003+23616.key"
-copy "Ktest.+003+23616.private.in" "Ktest.+003+23616.private"
-copy "Ktest.+003+49667.key.in" "Ktest.+003+49667.key"
-copy dst_2_data.in dst_2_data
-copy t2_data_1.in t2_data_1
-copy t2_data_2.in t2_data_2
-copy t2_dsasig.in t2_dsasig
-copy t2_rsasig.in t2_rsasig
-</Command>
- </PreBuildEvent>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|@PLATFORM@'">
- <ClCompile>
- <WarningLevel>Level3</WarningLevel>
- <PrecompiledHeader>
- </PrecompiledHeader>
- <Optimization>MaxSpeed</Optimization>
- <FunctionLevelLinking>true</FunctionLevelLinking>
- <IntrinsicFunctions>@INTRINSIC@</IntrinsicFunctions>
- <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
- <WholeProgramOptimization>false</WholeProgramOptimization>
- <StringPooling>true</StringPooling>
- <PrecompiledHeaderOutputFile>.\$(Configuration)\$(TargetName).pch</PrecompiledHeaderOutputFile>
- <AssemblerListingLocation>.\$(Configuration)\</AssemblerListingLocation>
- <ObjectFileName>.\$(Configuration)\</ObjectFileName>
- <ProgramDataBaseFileName>$(OutDir)$(TargetName).pdb</ProgramDataBaseFileName>
- <AdditionalIncludeDirectories>.\;..\..\..\..\;@LIBXML2_INC@..\..\..\..\lib\isc\win32;..\..\..\..\lib\isc\win32\include;..\..\..\..\lib\isc\include;..\..\..\..\lib\dns\include;..\..\..\..\lib\tests\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <CompileAs>CompileAsC</CompileAs>
- </ClCompile>
- <Link>
- <SubSystem>Console</SubSystem>
- <GenerateDebugInformation>false</GenerateDebugInformation>
- <EnableCOMDATFolding>true</EnableCOMDATFolding>
- <OptimizeReferences>true</OptimizeReferences>
- <OutputFile>..\..\..\..\Build\$(Configuration)\$(TargetName)$(TargetExt)</OutputFile>
- <LinkTimeCodeGeneration>Default</LinkTimeCodeGeneration>
- <AdditionalLibraryDirectories>..\..\..\..\lib\isc\win32\$(Configuration);..\..\..\..\lib\dns\win32\$(Configuration);..\..\..\..\lib\tests\win32\$(Configuration);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
- <AdditionalDependencies>@LIBXML2_LIB@libisc.lib;libdns.lib;libtests.lib;ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
- </Link>
- <PreBuildEvent>
- <Command>cd ..
-copy "Kdh.+002+18602.key.in" "Kdh.+002+18602.key"
-copy "Kdh.+002+18602.private.in" "Kdh.+002+18602.private"
-copy "Kdh.+002+48957.key.in" "Kdh.+002+48957.key"
-copy "Kdh.+002+48957.private.in" "Kdh.+002+48957.private"
-copy "Ktest.+001+00002.key.in" "Ktest.+001+00002.key"
-copy "Ktest.+001+54622.key.in" "Ktest.+001+54622.key"
-copy "Ktest.+001+54622.private.in" "Ktest.+001+54622.private"
-copy "Ktest.+003+23616.key.in" "Ktest.+003+23616.key"
-copy "Ktest.+003+23616.private.in" "Ktest.+003+23616.private"
-copy "Ktest.+003+49667.key.in" "Ktest.+003+49667.key"
-copy dst_2_data.in dst_2_data
-copy t2_data_1.in t2_data_1
-copy t2_data_2.in t2_data_2
-copy t2_dsasig.in t2_dsasig
-copy t2_rsasig.in t2_rsasig
-</Command>
- </PreBuildEvent>
- </ItemDefinitionGroup>
- <ItemGroup>
- <ClCompile Include="..\t_dst.c" />
- </ItemGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
- <ImportGroup Label="ExtensionTargets">
- </ImportGroup>
-</Project>
+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>\r
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
-</Project>
\ No newline at end of file
# elsewhere if there's a good reason for doing so.
#
-ac_config_files="$ac_config_files make/Makefile make/mkdep Makefile bin/Makefile bin/check/Makefile bin/confgen/Makefile bin/confgen/unix/Makefile bin/delv/Makefile bin/dig/Makefile bin/dnssec/Makefile bin/named/Makefile bin/named/unix/Makefile bin/nsupdate/Makefile bin/pkcs11/Makefile bin/python/Makefile bin/python/isc/Makefile bin/python/isc/utils.py bin/python/isc/tests/Makefile bin/python/dnssec-checkds.py bin/python/dnssec-coverage.py bin/python/dnssec-keymgr.py bin/python/isc/__init__.py bin/python/isc/checkds.py bin/python/isc/coverage.py bin/python/isc/dnskey.py bin/python/isc/eventlist.py bin/python/isc/keydict.py bin/python/isc/keyevent.py bin/python/isc/keymgr.py bin/python/isc/keyseries.py bin/python/isc/keyzone.py bin/python/isc/policy.py bin/python/isc/rndc.py bin/python/isc/tests/dnskey_test.py bin/python/isc/tests/policy_test.py bin/rndc/Makefile bin/tests/Makefile bin/tests/dst/Makefile bin/tests/dst/Kdh.+002+18602.key bin/tests/dst/Kdh.+002+18602.private bin/tests/dst/Kdh.+002+48957.key bin/tests/dst/Kdh.+002+48957.private bin/tests/dst/Ktest.+001+00002.key bin/tests/dst/Ktest.+001+54622.key bin/tests/dst/Ktest.+001+54622.private bin/tests/dst/Ktest.+003+23616.key bin/tests/dst/Ktest.+003+23616.private bin/tests/dst/Ktest.+003+49667.key bin/tests/dst/dst_2_data bin/tests/dst/t2_data_1 bin/tests/dst/t2_data_2 bin/tests/dst/t2_dsasig bin/tests/dst/t2_rsasig bin/tests/headerdep_test.sh bin/tests/optional/Makefile bin/tests/pkcs11/Makefile bin/tests/pkcs11/benchmarks/Makefile bin/tests/system/Makefile bin/tests/system/conf.sh bin/tests/system/dlz/prereq.sh bin/tests/system/dlzexternal/Makefile bin/tests/system/dlzexternal/ns1/dlzs.conf bin/tests/system/dyndb/Makefile bin/tests/system/dyndb/driver/Makefile bin/tests/system/inline/checkdsa.sh bin/tests/system/pipelined/Makefile bin/tests/system/rndc/Makefile bin/tests/system/rpz/Makefile bin/tests/system/rsabigexponent/Makefile bin/tests/system/tkey/Makefile bin/tests/virtual-time/Makefile bin/tests/virtual-time/conf.sh bin/tools/Makefile contrib/scripts/check-secure-delegation.pl contrib/scripts/zone-edit.sh doc/Makefile doc/arm/Makefile doc/arm/noteversion.xml doc/arm/pkgversion.xml doc/arm/releaseinfo.xml doc/doxygen/Doxyfile doc/doxygen/Makefile doc/doxygen/doxygen-input-filter doc/misc/Makefile doc/tex/Makefile doc/tex/armstyle.sty doc/xsl/Makefile doc/xsl/isc-docbook-chunk.xsl doc/xsl/isc-docbook-html.xsl doc/xsl/isc-manpage.xsl doc/xsl/isc-notes-html.xsl isc-config.sh lib/Makefile lib/bind9/Makefile lib/bind9/include/Makefile lib/bind9/include/bind9/Makefile lib/dns/Makefile lib/dns/include/Makefile lib/dns/include/dns/Makefile lib/dns/include/dst/Makefile lib/dns/tests/Makefile lib/irs/Makefile lib/irs/include/Makefile lib/irs/include/irs/Makefile lib/irs/include/irs/netdb.h lib/irs/include/irs/platform.h lib/irs/tests/Makefile lib/isc/$arch/Makefile lib/isc/$arch/include/Makefile lib/isc/$arch/include/isc/Makefile lib/isc/$thread_dir/Makefile lib/isc/$thread_dir/include/Makefile lib/isc/$thread_dir/include/isc/Makefile lib/isc/Makefile lib/isc/include/Makefile lib/isc/include/isc/Makefile lib/isc/include/isc/platform.h lib/isc/include/pk11/Makefile lib/isc/include/pkcs11/Makefile lib/isc/tests/Makefile lib/isc/nls/Makefile lib/isc/unix/Makefile lib/isc/unix/include/Makefile lib/isc/unix/include/isc/Makefile lib/isc/unix/include/pkcs11/Makefile lib/isccc/Makefile lib/isccc/include/Makefile lib/isccc/include/isccc/Makefile lib/isccfg/Makefile lib/isccfg/include/Makefile lib/isccfg/include/isccfg/Makefile lib/isccfg/tests/Makefile lib/ns/Makefile lib/ns/include/Makefile lib/ns/include/ns/Makefile lib/ns/tests/Makefile lib/tests/Makefile lib/tests/include/Makefile lib/tests/include/tests/Makefile lib/samples/Makefile lib/samples/Makefile-postinstall unit/Makefile unit/unittest.sh"
+ac_config_files="$ac_config_files make/Makefile make/mkdep Makefile bin/Makefile bin/check/Makefile bin/confgen/Makefile bin/confgen/unix/Makefile bin/delv/Makefile bin/dig/Makefile bin/dnssec/Makefile bin/named/Makefile bin/named/unix/Makefile bin/nsupdate/Makefile bin/pkcs11/Makefile bin/python/Makefile bin/python/isc/Makefile bin/python/isc/utils.py bin/python/isc/tests/Makefile bin/python/dnssec-checkds.py bin/python/dnssec-coverage.py bin/python/dnssec-keymgr.py bin/python/isc/__init__.py bin/python/isc/checkds.py bin/python/isc/coverage.py bin/python/isc/dnskey.py bin/python/isc/eventlist.py bin/python/isc/keydict.py bin/python/isc/keyevent.py bin/python/isc/keymgr.py bin/python/isc/keyseries.py bin/python/isc/keyzone.py bin/python/isc/policy.py bin/python/isc/rndc.py bin/python/isc/tests/dnskey_test.py bin/python/isc/tests/policy_test.py bin/rndc/Makefile bin/tests/Makefile bin/tests/headerdep_test.sh bin/tests/optional/Makefile bin/tests/pkcs11/Makefile bin/tests/pkcs11/benchmarks/Makefile bin/tests/system/Makefile bin/tests/system/conf.sh bin/tests/system/dlz/prereq.sh bin/tests/system/dlzexternal/Makefile bin/tests/system/dlzexternal/ns1/dlzs.conf bin/tests/system/dyndb/Makefile bin/tests/system/dyndb/driver/Makefile bin/tests/system/inline/checkdsa.sh bin/tests/system/pipelined/Makefile bin/tests/system/rndc/Makefile bin/tests/system/rpz/Makefile bin/tests/system/rsabigexponent/Makefile bin/tests/system/tkey/Makefile bin/tests/virtual-time/Makefile bin/tests/virtual-time/conf.sh bin/tools/Makefile contrib/scripts/check-secure-delegation.pl contrib/scripts/zone-edit.sh doc/Makefile doc/arm/Makefile doc/arm/noteversion.xml doc/arm/pkgversion.xml doc/arm/releaseinfo.xml doc/doxygen/Doxyfile doc/doxygen/Makefile doc/doxygen/doxygen-input-filter doc/misc/Makefile doc/tex/Makefile doc/tex/armstyle.sty doc/xsl/Makefile doc/xsl/isc-docbook-chunk.xsl doc/xsl/isc-docbook-html.xsl doc/xsl/isc-manpage.xsl doc/xsl/isc-notes-html.xsl isc-config.sh lib/Makefile lib/bind9/Makefile lib/bind9/include/Makefile lib/bind9/include/bind9/Makefile lib/dns/Makefile lib/dns/include/Makefile lib/dns/include/dns/Makefile lib/dns/include/dst/Makefile lib/dns/tests/Makefile lib/irs/Makefile lib/irs/include/Makefile lib/irs/include/irs/Makefile lib/irs/include/irs/netdb.h lib/irs/include/irs/platform.h lib/irs/tests/Makefile lib/isc/$arch/Makefile lib/isc/$arch/include/Makefile lib/isc/$arch/include/isc/Makefile lib/isc/$thread_dir/Makefile lib/isc/$thread_dir/include/Makefile lib/isc/$thread_dir/include/isc/Makefile lib/isc/Makefile lib/isc/include/Makefile lib/isc/include/isc/Makefile lib/isc/include/isc/platform.h lib/isc/include/pk11/Makefile lib/isc/include/pkcs11/Makefile lib/isc/tests/Makefile lib/isc/nls/Makefile lib/isc/unix/Makefile lib/isc/unix/include/Makefile lib/isc/unix/include/isc/Makefile lib/isc/unix/include/pkcs11/Makefile lib/isccc/Makefile lib/isccc/include/Makefile lib/isccc/include/isccc/Makefile lib/isccfg/Makefile lib/isccfg/include/Makefile lib/isccfg/include/isccfg/Makefile lib/isccfg/tests/Makefile lib/ns/Makefile lib/ns/include/Makefile lib/ns/include/ns/Makefile lib/ns/tests/Makefile lib/tests/Makefile lib/tests/include/Makefile lib/tests/include/tests/Makefile lib/samples/Makefile lib/samples/Makefile-postinstall unit/Makefile unit/unittest.sh"
#
"bin/python/isc/tests/policy_test.py") CONFIG_FILES="$CONFIG_FILES bin/python/isc/tests/policy_test.py" ;;
"bin/rndc/Makefile") CONFIG_FILES="$CONFIG_FILES bin/rndc/Makefile" ;;
"bin/tests/Makefile") CONFIG_FILES="$CONFIG_FILES bin/tests/Makefile" ;;
- "bin/tests/dst/Makefile") CONFIG_FILES="$CONFIG_FILES bin/tests/dst/Makefile" ;;
- "bin/tests/dst/Kdh.+002+18602.key") CONFIG_FILES="$CONFIG_FILES bin/tests/dst/Kdh.+002+18602.key" ;;
- "bin/tests/dst/Kdh.+002+18602.private") CONFIG_FILES="$CONFIG_FILES bin/tests/dst/Kdh.+002+18602.private" ;;
- "bin/tests/dst/Kdh.+002+48957.key") CONFIG_FILES="$CONFIG_FILES bin/tests/dst/Kdh.+002+48957.key" ;;
- "bin/tests/dst/Kdh.+002+48957.private") CONFIG_FILES="$CONFIG_FILES bin/tests/dst/Kdh.+002+48957.private" ;;
- "bin/tests/dst/Ktest.+001+00002.key") CONFIG_FILES="$CONFIG_FILES bin/tests/dst/Ktest.+001+00002.key" ;;
- "bin/tests/dst/Ktest.+001+54622.key") CONFIG_FILES="$CONFIG_FILES bin/tests/dst/Ktest.+001+54622.key" ;;
- "bin/tests/dst/Ktest.+001+54622.private") CONFIG_FILES="$CONFIG_FILES bin/tests/dst/Ktest.+001+54622.private" ;;
- "bin/tests/dst/Ktest.+003+23616.key") CONFIG_FILES="$CONFIG_FILES bin/tests/dst/Ktest.+003+23616.key" ;;
- "bin/tests/dst/Ktest.+003+23616.private") CONFIG_FILES="$CONFIG_FILES bin/tests/dst/Ktest.+003+23616.private" ;;
- "bin/tests/dst/Ktest.+003+49667.key") CONFIG_FILES="$CONFIG_FILES bin/tests/dst/Ktest.+003+49667.key" ;;
- "bin/tests/dst/dst_2_data") CONFIG_FILES="$CONFIG_FILES bin/tests/dst/dst_2_data" ;;
- "bin/tests/dst/t2_data_1") CONFIG_FILES="$CONFIG_FILES bin/tests/dst/t2_data_1" ;;
- "bin/tests/dst/t2_data_2") CONFIG_FILES="$CONFIG_FILES bin/tests/dst/t2_data_2" ;;
- "bin/tests/dst/t2_dsasig") CONFIG_FILES="$CONFIG_FILES bin/tests/dst/t2_dsasig" ;;
- "bin/tests/dst/t2_rsasig") CONFIG_FILES="$CONFIG_FILES bin/tests/dst/t2_rsasig" ;;
"bin/tests/headerdep_test.sh") CONFIG_FILES="$CONFIG_FILES bin/tests/headerdep_test.sh" ;;
"bin/tests/optional/Makefile") CONFIG_FILES="$CONFIG_FILES bin/tests/optional/Makefile" ;;
"bin/tests/pkcs11/Makefile") CONFIG_FILES="$CONFIG_FILES bin/tests/pkcs11/Makefile" ;;
bin/python/isc/tests/policy_test.py
bin/rndc/Makefile
bin/tests/Makefile
- bin/tests/dst/Makefile
- bin/tests/dst/Kdh.+002+18602.key
- bin/tests/dst/Kdh.+002+18602.private
- bin/tests/dst/Kdh.+002+48957.key
- bin/tests/dst/Kdh.+002+48957.private
- bin/tests/dst/Ktest.+001+00002.key
- bin/tests/dst/Ktest.+001+54622.key
- bin/tests/dst/Ktest.+001+54622.private
- bin/tests/dst/Ktest.+003+23616.key
- bin/tests/dst/Ktest.+003+23616.private
- bin/tests/dst/Ktest.+003+49667.key
- bin/tests/dst/dst_2_data
- bin/tests/dst/t2_data_1
- bin/tests/dst/t2_data_2
- bin/tests/dst/t2_dsasig
- bin/tests/dst/t2_rsasig
bin/tests/headerdep_test.sh
bin/tests/optional/Makefile
bin/tests/pkcs11/Makefile
tp: dh_test
tp: dispatch_test
tp: dnstap_test
+tp: dst_test
tp: dstrandom_test
tp: geoip_test
tp: gost_test
dh_test.c \
dispatch_test.c \
dnstap_test.c \
+ dst_test.c \
dnstest.c \
dstrandom_test.c \
geoip_test.c \
dh_test@EXEEXT@ \
dispatch_test@EXEEXT@ \
dnstap_test@EXEEXT@ \
+ dst_test@EXEEXT@ \
dstrandom_test@EXEEXT@ \
geoip_test@EXEEXT@ \
gost_test@EXEEXT@ \
dnstap_test.@O@ dnstest.@O@ ${DNSLIBS} \
${ISCLIBS} ${LIBS}
+dst_test@EXEEXT@: dst_test.@O@ ${ISCDEPLIBS} ${DNSDEPLIBS}
+ ${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} ${LDFLAGS} -o $@ \
+ dst_test.@O@ dnstest.@O@ ${DNSLIBS} \
+ ${ISCLIBS} ${LIBS}
+
geoip_test@EXEEXT@: geoip_test.@O@ ${ISCDEPLIBS} ${DNSDEPLIBS}
${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} ${LDFLAGS} -o $@ \
geoip_test.@O@ dnstest.@O@ ${DNSLIBS} \
--- /dev/null
+/*
+ * Copyright (C) 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/.
+ *
+ * See the COPYRIGHT file distributed with this work for additional
+ * information regarding copyright ownership.
+ */
+
+/* ! \file */
+
+#include <config.h>
+
+#include <atf-c.h>
+
+#include <unistd.h>
+
+#include <isc/file.h>
+#include <isc/util.h>
+#include <isc/stdio.h>
+#include <isc/string.h>
+
+#include <dst/dst.h>
+#include <dst/result.h>
+
+#include "../dst_internal.h"
+
+#include "dnstest.h"
+
+ATF_TC(sig);
+ATF_TC_HEAD(sig, tc) {
+ atf_tc_set_md_var(tc, "descr", "signature ineffability");
+}
+
+/*
+ * Read sig in file at path to buf.
+ */
+static isc_result_t
+sig_fromfile(const char *path, isc_buffer_t *buf) {
+ isc_result_t result;
+ size_t rval, len;
+ FILE *fp = NULL;
+ unsigned char val;
+ char *p, *data;
+ off_t size;
+
+ result = isc_stdio_open(path, "rb", &fp);
+ ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
+
+ result = isc_file_getsizefd(fileno(fp), &size);
+ ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
+
+ data = isc_mem_get(mctx, (size + 1));
+ ATF_REQUIRE(data != NULL);
+
+ len = (size_t)size;
+ p = data;
+ while (len != 0U) {
+ result = isc_stdio_read(p, 1, len, fp, &rval);
+ ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
+ len -= rval;
+ p += rval;
+ }
+ isc_stdio_close(fp);
+
+ p = data;
+ len = size;
+ while (len > 0U) {
+ if ((*p == '\r') || (*p == '\n')) {
+ ++p;
+ --len;
+ continue;
+ } else if (len < 2U)
+ goto err;
+ if (('0' <= *p) && (*p <= '9')) {
+ val = *p - '0';
+ } else if (('A' <= *p) && (*p <= 'F')) {
+ val = *p - 'A' + 10;
+ } else {
+ result = ISC_R_BADHEX;
+ goto err;
+ }
+ ++p;
+ val <<= 4;
+ --len;
+ if (('0' <= *p) && (*p <= '9')) {
+ val |= (*p - '0');
+ } else if (('A' <= *p) && (*p <= 'F')) {
+ val |= (*p - 'A' + 10);
+ } else {
+ result = ISC_R_BADHEX;
+ goto err;
+ }
+ ++p;
+ --len;
+ isc_buffer_putuint8(buf, val);
+ }
+
+ result = ISC_R_SUCCESS;
+
+ err:
+ isc_mem_put(mctx, data, size + 1);
+ return (result);
+}
+
+static void
+check_sig(const char *datapath, const char *sigpath, const char *keyname,
+ dns_keytag_t id, dns_secalg_t alg, int type, isc_boolean_t expect)
+{
+ isc_result_t result;
+ size_t rval, len;
+ FILE *fp;
+ dst_key_t *key = NULL;
+ unsigned char sig[512];
+ unsigned char *p;
+ unsigned char *data;
+ off_t size;
+ isc_buffer_t b;
+ isc_buffer_t databuf, sigbuf;
+ isc_region_t datareg, sigreg;
+ dns_fixedname_t fname;
+ dns_name_t *name;
+ dst_context_t *ctx = NULL;
+
+ /*
+ * Read data from file in a form usable by dst_verify.
+ */
+ result = isc_stdio_open(datapath, "rb", &fp);
+ ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
+
+ result = isc_file_getsizefd(fileno(fp), &size);
+ ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
+
+ data = isc_mem_get(mctx, (size + 1));
+ ATF_REQUIRE(data != NULL);
+
+ p = data;
+ len = (size_t)size;
+ do {
+ result = isc_stdio_read(p, 1, len, fp, &rval);
+ ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
+ len -= rval;
+ p += rval;
+ } while (len);
+ isc_stdio_close(fp);
+
+ /*
+ * Read key from file in a form usable by dst_verify.
+ */
+ dns_fixedname_init(&fname);
+ name = dns_fixedname_name(&fname);
+ isc_buffer_constinit(&b, keyname, strlen(keyname));
+ isc_buffer_add(&b, strlen(keyname));
+ result = dns_name_fromtext(name, &b, dns_rootname, 0, NULL);
+ ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
+ result = dst_key_fromfile(name, id, alg, type, "testdata/dst",
+ mctx, &key);
+ ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
+
+ isc_buffer_init(&databuf, data, (unsigned int)size);
+ isc_buffer_add(&databuf, (unsigned int)size);
+ isc_buffer_usedregion(&databuf, &datareg);
+
+ memset(sig, 0, sizeof(sig));
+ isc_buffer_init(&sigbuf, sig, sizeof(sig));
+
+ /*
+ * Read precomputed signature from file in a form usable by dst_verify.
+ */
+ result = sig_fromfile(sigpath, &sigbuf);
+ ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
+
+ /*
+ * Verify that the key signed the data.
+ */
+ isc_buffer_remainingregion(&sigbuf, &sigreg);
+
+ result = dst_context_create3(key, mctx, DNS_LOGCATEGORY_GENERAL,
+ ISC_FALSE, &ctx);
+ ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
+
+ result = dst_context_adddata(ctx, &datareg);
+ ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
+ result = dst_context_verify(ctx, &sigreg);
+
+ ATF_REQUIRE((expect && (result == ISC_R_SUCCESS)) ||
+ (!expect && (result != ISC_R_SUCCESS)));
+
+
+ isc_mem_put(mctx, data, size + 1);
+ dst_context_destroy(&ctx);
+ dst_key_free(&key);
+
+ return;
+}
+
+ATF_TC_BODY(sig, tc) {
+ isc_result_t result;
+
+ UNUSED(tc);
+
+ result = dns_test_begin(NULL, ISC_FALSE);
+ ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
+ struct {
+ const char *datapath;
+ const char *sigpath;
+ const char *keyname;
+ dns_keytag_t keyid;
+ dns_secalg_t alg;
+ isc_boolean_t expect;
+ } testcases[] = {
+ {
+ "testdata/dst/test1.data",
+ "testdata/dst/test1.dsasig",
+ "test.", 23616, DST_ALG_DSA, ISC_TRUE
+ },
+ {
+ "testdata/dst/test1.data",
+ "testdata/dst/test1.rsasig",
+ "test.", 54622, DST_ALG_RSAMD5, ISC_TRUE
+ },
+ {
+ /* wrong sig */
+ "testdata/dst/test1.data",
+ "testdata/dst/test1.dsasig",
+ "test.", 54622, DST_ALG_RSAMD5, ISC_FALSE
+ },
+ {
+ /* wrong data */
+ "testdata/dst/test2.data",
+ "testdata/dst/test1.dsasig",
+ "test.", 23616, DST_ALG_DSA, ISC_FALSE
+ },
+ };
+ unsigned int i;
+
+ for (i = 0; i < (sizeof(testcases)/sizeof(testcases[0])); i++) {
+ if (!dst_algorithm_supported(testcases[i].alg)) {
+ continue;
+ }
+
+ check_sig(testcases[i].datapath,
+ testcases[i].sigpath,
+ testcases[i].keyname,
+ testcases[i].keyid,
+ testcases[i].alg,
+ DST_TYPE_PRIVATE|DST_TYPE_PUBLIC,
+ testcases[i].expect);
+ }
+
+ dns_test_end();
+}
+
+/*
+ * Main
+ */
+ATF_TP_ADD_TCS(tp) {
+ ATF_TP_ADD_TC(tp, sig);
+
+ return (atf_no_error());
+}
F5CD6FB41FB15D4213705ABE9B563896
2196228648E0F8AA7F2F4EED3C19165C
1B4C70C9D69B93A1F2BE5B2F948CE023
-
./bin/tests/byaddr_test.c C 2000,2001,2002,2004,2005,2007,2012,2015,2016,2018
./bin/tests/byname_test.c C 2000,2001,2004,2005,2007,2009,2012,2015,2016,2017,2018
./bin/tests/cfg_test.c C 2001,2002,2004,2005,2007,2009,2010,2011,2015,2016,2018
-./bin/tests/db_test.c C 1999,2000,2001,2004,2005,2007,2008,2009,2011,2012,2013,2015,2016,2017,2018
-./bin/tests/dst/.gitignore X 2012,2013,2018
-./bin/tests/dst/Kdh.+002+18602.key.in X 2001,2013,2018
-./bin/tests/dst/Kdh.+002+18602.private.in X 2001,2013,2018
-./bin/tests/dst/Kdh.+002+48957.key.in X 2001,2013,2018
-./bin/tests/dst/Kdh.+002+48957.private.in X 2001,2013,2018
-./bin/tests/dst/Ktest.+001+00002.key.in X 2001,2004,2013,2018
-./bin/tests/dst/Ktest.+001+54622.key.in X 1999,2000,2001,2004,2013,2018
-./bin/tests/dst/Ktest.+001+54622.private.in X 1999,2000,2001,2013,2018
-./bin/tests/dst/Ktest.+003+23616.key.in X 2001,2004,2013,2018
-./bin/tests/dst/Ktest.+003+23616.private.in X 2001,2013,2018
-./bin/tests/dst/Ktest.+003+49667.key.in X 2001,2004,2013,2018
-./bin/tests/dst/Makefile.in MAKE 1999,2000,2001,2002,2004,2006,2007,2008,2009,2010,2012,2013,2014,2016,2017,2018
-./bin/tests/dst/dst_2_data.in X 1999,2000,2001,2013,2018
-./bin/tests/dst/dst_test.c C 1999,2000,2001,2004,2005,2007,2009,2012,2014,2015,2016,2018
-./bin/tests/dst/gsstest.c C 2006,2007,2009,2010,2011,2013,2014,2015,2016,2018
-./bin/tests/dst/t2_data_1.in X 1999,2000,2001,2013,2018
-./bin/tests/dst/t2_data_2.in X 1999,2000,2001,2013,2018
-./bin/tests/dst/t2_dsasig.in X 1999,2000,2001,2013,2018
-./bin/tests/dst/t2_rsasig.in X 1999,2000,2001,2013,2018
-./bin/tests/dst/t_dst.c C 1999,2000,2001,2004,2005,2007,2008,2009,2011,2012,2013,2014,2016,2017,2018
-./bin/tests/dst/win32/REQUIRE_EXTENDED_DIR X 2013,2018
-./bin/tests/dst/win32/t_dst.vcxproj.filters.in X 2013,2015,2018
-./bin/tests/dst/win32/t_dst.vcxproj.in X 2013,2015,2016,2017,2018
-./bin/tests/dst/win32/t_dst.vcxproj.user X 2013,2018
-./bin/tests/entropy2_test.c C 2000,2001,2004,2005,2007,2015,2016,2018
-./bin/tests/entropy_test.c C 2000,2001,2004,2005,2007,2015,2016,2018
./bin/tests/fromhex.pl PERL 2015,2016,2018
./bin/tests/fsaccess_test.c C 2000,2001,2004,2005,2007,2012,2015,2016,2018
./bin/tests/hash_test.c C 2000,2001,2004,2005,2006,2007,2014,2015,2016,2017,2018
./bin/tests/named.conf CONF-C 1999,2000,2001,2004,2007,2011,2015,2016,2018
./bin/tests/ndc.conf CONF-C 2000,2001,2004,2007,2016,2018
./bin/tests/ndc.conf-include CONF-C 2001,2004,2007,2016,2018
-./bin/tests/nsecify.c C 1999,2000,2001,2003,2004,2007,2008,2009,2011,2015,2016,2017,2018
+./bin/tests/optional/Kchild.example.+003+04017.key X 2000,2001,2018
+./bin/tests/optional/Kchild.example.+003+04017.private X 2000,2001,2018
+./bin/tests/optional/Makefile.in MAKE 2018
+./bin/tests/optional/adb_test.c C 1999,2000,2001,2004,2005,2007,2009,2011,2012,2013,2015,2016,2018
+./bin/tests/optional/backtrace_test.c C 2009,2013,2015,2016,2018
+./bin/tests/optional/byaddr_test.c C 2000,2001,2002,2004,2005,2007,2012,2015,2016,2018
+./bin/tests/optional/byname_test.c C 2000,2001,2004,2005,2007,2009,2012,2015,2016,2017,2018
+./bin/tests/optional/db_test.c C 1999,2000,2001,2004,2005,2007,2008,2009,2011,2012,2013,2015,2016,2017,2018
+./bin/tests/optional/dst_test.c C 2018
+./bin/tests/optional/entropy2_test.c C 2000,2001,2004,2005,2007,2015,2016,2018
+./bin/tests/optional/entropy_test.c C 2000,2001,2004,2005,2007,2015,2016,2018
+./bin/tests/optional/fsaccess_test.c C 2000,2001,2004,2005,2007,2012,2015,2016,2018
+./bin/tests/optional/gsstest.c C 2018
+./bin/tests/optional/hash_test.c C 2000,2001,2004,2005,2006,2007,2014,2015,2016,2017,2018
+./bin/tests/optional/inter_test.c C 2000,2001,2003,2004,2005,2007,2008,2015,2016,2018
+./bin/tests/optional/keyboard_test.c C 2000,2001,2004,2005,2007,2015,2016,2018
+./bin/tests/optional/lex_test.c C 1998,1999,2000,2001,2004,2005,2007,2015,2016,2018
+./bin/tests/optional/lfsr_test.c C 1999,2000,2001,2004,2005,2007,2015,2016,2018
+./bin/tests/optional/log_test.c C 1999,2000,2001,2004,2007,2011,2014,2015,2016,2018
+./bin/tests/optional/master_test.c C 1999,2000,2001,2004,2007,2009,2015,2016,2017,2018
+./bin/tests/optional/mempool_test.c C 1999,2000,2001,2004,2007,2016,2018
+./bin/tests/optional/name_test.c C 1998,1999,2000,2001,2003,2004,2005,2007,2009,2015,2016,2017,2018
+./bin/tests/optional/nsecify.c C 1999,2000,2001,2003,2004,2007,2008,2009,2011,2015,2016,2017,2018
+./bin/tests/optional/ratelimiter_test.c C 1999,2000,2001,2004,2007,2015,2016,2018
+./bin/tests/optional/rbt_test.c C 1999,2000,2001,2004,2005,2007,2009,2011,2012,2014,2015,2016,2018
+./bin/tests/optional/rbt_test.out X 1999,2000,2001,2018
+./bin/tests/optional/rbt_test.txt SH 1999,2000,2001,2004,2007,2012,2016,2018
+./bin/tests/optional/rwlock_test.c C 1998,1999,2000,2001,2004,2005,2007,2013,2016,2017,2018
+./bin/tests/optional/serial_test.c C 1999,2000,2001,2003,2004,2007,2015,2016,2018
+./bin/tests/optional/shutdown_test.c C 1998,1999,2000,2001,2004,2007,2011,2013,2016,2017,2018
+./bin/tests/optional/sig0_test.c C 2000,2001,2004,2005,2007,2008,2009,2012,2015,2016,2018
+./bin/tests/optional/sock_test.c C 1998,1999,2000,2001,2004,2007,2008,2012,2013,2014,2015,2016,2017,2018
+./bin/tests/optional/sym_test.c C 1998,1999,2000,2001,2004,2005,2007,2015,2016,2018
+./bin/tests/optional/task_test.c C 1998,1999,2000,2001,2004,2007,2013,2014,2015,2016,2018
+./bin/tests/optional/timer_test.c C 1998,1999,2000,2001,2004,2007,2013,2014,2015,2016,2018
+./bin/tests/optional/zone_test.c C 1999,2000,2001,2002,2004,2005,2007,2009,2012,2014,2015,2016,2018
./bin/tests/pkcs11/.gitignore X 2014,2018
./bin/tests/pkcs11/Makefile.in MAKE 2014,2016,2018
./bin/tests/pkcs11/README X 2014,2016,2018
./lib/dns/tests/dnstap_test.c C 2015,2016,2017,2018
./lib/dns/tests/dnstest.c C 2011,2012,2013,2014,2015,2016,2017,2018
./lib/dns/tests/dnstest.h C 2011,2012,2014,2015,2016,2017,2018
+./lib/dns/tests/dst_test.c C 2018
./lib/dns/tests/dstrandom_test.c C 2017,2018
./lib/dns/tests/geoip_test.c C 2013,2014,2015,2016,2017,2018
./lib/dns/tests/gost_test.c C 2014,2015,2016,2017,2018
./lib/dns/tests/rdataset_test.c C 2012,2016,2018
./lib/dns/tests/rdatasetstats_test.c C 2012,2015,2016,2018
./lib/dns/tests/rsa_test.c C 2016,2018
+./lib/dns/tests/testdata/db/data.db ZONE 2018
./lib/dns/tests/testdata/dbiterator/zone1.data ZONE 2011,2012,2016,2018
./lib/dns/tests/testdata/dbiterator/zone2.data X 2011,2018
./lib/dns/tests/testdata/diff/zone1.data ZONE 2011,2012,2016,2018
./lib/dns/tests/testdata/dnstap/query.recursive X 2015,2018
./lib/dns/tests/testdata/dnstap/response.auth X 2015,2018
./lib/dns/tests/testdata/dnstap/response.recursive X 2015,2018
+./lib/dns/tests/testdata/dst/Ktest.+001+00002.key X 2018
+./lib/dns/tests/testdata/dst/Ktest.+001+54622.key X 2018
+./lib/dns/tests/testdata/dst/Ktest.+001+54622.private X 2018
+./lib/dns/tests/testdata/dst/Ktest.+003+23616.key X 2018
+./lib/dns/tests/testdata/dst/Ktest.+003+23616.private X 2018
+./lib/dns/tests/testdata/dst/Ktest.+003+49667.key X 2018
+./lib/dns/tests/testdata/dst/test1.data X 2018
+./lib/dns/tests/testdata/dst/test1.dsasig X 2018
+./lib/dns/tests/testdata/dst/test1.rsasig X 2018
+./lib/dns/tests/testdata/dst/test2.data X 2018
./lib/dns/tests/testdata/dstrandom/random.data X 2017,2018
./lib/dns/tests/testdata/master/.gitignore X 2012,2018
./lib/dns/tests/testdata/master/master1.data X 2011,2018
"..\\bin\\tools\\win32\\nsec3hash.vcxproj.filters",
"..\\bin\\tools\\win32\\rrchecker.vcxproj",
"..\\bin\\tools\\win32\\rrchecker.vcxproj.filters",
- "..\\bin\\tests\\dst\\win32\\t_dst.vcxproj",
- "..\\bin\\tests\\dst\\win32\\t_dst.vcxproj.filters",
"..\\bin\\tests\\system\\win32\\bigkey.vcxproj",
"..\\bin\\tests\\system\\win32\\bigkey.vcxproj.filters",
"..\\bin\\tests\\system\\win32\\feature-test.vcxproj",
EndProjectSection
EndProject
@END PKCS11
-@IF TESTS
-@IF ATOMIC
-@END ATOMIC
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "t_dst", "..\bin\tests\dst\win32\t_dst.vcxproj", "{EE9B94CF-7C33-4F3B-A674-FB756D422C54}"
- ProjectSection(ProjectDependencies) = postProject
- {A3F71D12-F38A-4C77-8D87-8E8854CA74A1} = {A3F71D12-F38A-4C77-8D87-8E8854CA74A1}
- {3840E563-D180-4761-AA9C-E6155F02EAFF} = {3840E563-D180-4761-AA9C-E6155F02EAFF}
- {5FEBFD4E-CCB0-48B9-B733-E15EEB85C16A} = {5FEBFD4E-CCB0-48B9-B733-E15EEB85C16A}
- {F6F08940-7597-4FEE-9CE0-E09A009C45A3} = {F6F08940-7597-4FEE-9CE0-E09A009C45A3}
- {B4AC7F81-E3DC-43E9-B339-4FA5149FA8F7} = {B4AC7F81-E3DC-43E9-B339-4FA5149FA8F7}
- EndProjectSection
-EndProject
-@END TESTS
@IF XTESTS
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "backtrace_test", "..\bin\tests\win32\backtrace_test.vcxproj", "{14751171-C40E-40EE-A2F0-37FFC3CCD4A2}"
ProjectSection(ProjectDependencies) = postProject