t_dst.c revision 0942b8e0d660895ae96ffbd447fd0290fe60539c
503ffdad3bc62e6458e4b60e329aa448ce1803a1Tinderbox User * Copyright (C) 1999, 2000 Internet Software Consortium.
f1c1aab2c9e720399d66d8db5f40515d47c45ecfMark Andrews * Permission to use, copy, modify, and distribute this software for any
f1c1aab2c9e720399d66d8db5f40515d47c45ecfMark Andrews * purpose with or without fee is hereby granted, provided that the above
f1c1aab2c9e720399d66d8db5f40515d47c45ecfMark Andrews * copyright notice and this permission notice appear in all copies.
f1c1aab2c9e720399d66d8db5f40515d47c45ecfMark Andrews * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
f1c1aab2c9e720399d66d8db5f40515d47c45ecfMark Andrews * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
f1c1aab2c9e720399d66d8db5f40515d47c45ecfMark Andrews * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
f1c1aab2c9e720399d66d8db5f40515d47c45ecfMark Andrews * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
f1c1aab2c9e720399d66d8db5f40515d47c45ecfMark Andrews * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
f1c1aab2c9e720399d66d8db5f40515d47c45ecfMark Andrews * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
f1c1aab2c9e720399d66d8db5f40515d47c45ecfMark Andrews * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
f1c1aab2c9e720399d66d8db5f40515d47c45ecfMark Andrewsstatic void t1(void);
f1c1aab2c9e720399d66d8db5f40515d47c45ecfMark Andrewsstatic void t2(void);
e0a30050c8516a3d54a4f8dcdd88435704a8a3edMark Andrews * adapted from the original dst_test.c program
f1c1aab2c9e720399d66d8db5f40515d47c45ecfMark Andrews t_info("opendir(%s) failed %d\n", path, opendir);
f1c1aab2c9e720399d66d8db5f40515d47c45ecfMark Andrews t_info("remove(%s) failed %d\n", fullname, errno);
f1c1aab2c9e720399d66d8db5f40515d47c45ecfMark Andrewsuse(dst_key_t *key, isc_result_t exp_result, int *nfails) {
f1c1aab2c9e720399d66d8db5f40515d47c45ecfMark Andrews isc_buffer_init(&sigbuf, sig, sizeof(sig), ISC_BUFFERTYPE_BINARY);
f1c1aab2c9e720399d66d8db5f40515d47c45ecfMark Andrews isc_buffer_init(&databuf, data, strlen(data), ISC_BUFFERTYPE_TEXT);
f1c1aab2c9e720399d66d8db5f40515d47c45ecfMark Andrews ret = dst_sign(DST_SIGMODE_ALL, key, NULL, &datareg, &sigbuf);
f1c1aab2c9e720399d66d8db5f40515d47c45ecfMark Andrews t_info("dst_sign(%d) returned (%s) expected (%s)\n",
f1c1aab2c9e720399d66d8db5f40515d47c45ecfMark Andrews ret = dst_verify(DST_SIGMODE_ALL, key, NULL, &datareg, &sigreg);
f1c1aab2c9e720399d66d8db5f40515d47c45ecfMark Andrews t_info("dst_verify(%d) returned (%s) expected (%s)\n",
f1c1aab2c9e720399d66d8db5f40515d47c45ecfMark Andrewsdh(char *name1, int id1, char *name2, int id2, isc_mem_t *mctx,
f1c1aab2c9e720399d66d8db5f40515d47c45ecfMark Andrews isc_result_t exp_result, int *nfails, int *nprobs)
f1c1aab2c9e720399d66d8db5f40515d47c45ecfMark Andrews ret = dst_key_fromfile(name1, id1, alg, type, mctx, &key1);
f1c1aab2c9e720399d66d8db5f40515d47c45ecfMark Andrews ret = dst_key_fromfile(name2, id2, alg, type, mctx, &key2);
f1c1aab2c9e720399d66d8db5f40515d47c45ecfMark Andrews isc_buffer_init(&b1, array1, sizeof(array1), ISC_BUFFERTYPE_BINARY);
f1c1aab2c9e720399d66d8db5f40515d47c45ecfMark Andrews isc_buffer_init(&b2, array2, sizeof(array2), ISC_BUFFERTYPE_BINARY);
f1c1aab2c9e720399d66d8db5f40515d47c45ecfMark Andrews if (r1.length != r2.length || memcmp(r1.base, r2.base, r1.length) != 0)
f1c1aab2c9e720399d66d8db5f40515d47c45ecfMark Andrewsio(char *name, int id, int alg, int type, isc_mem_t *mctx, isc_result_t exp_result,
f1c1aab2c9e720399d66d8db5f40515d47c45ecfMark Andrews ret = dst_key_fromfile(name, id, alg, type, mctx, &key);
f1c1aab2c9e720399d66d8db5f40515d47c45ecfMark Andrews t_info("dst_key_fromfile(%d) returned: %s\n", alg, dst_result_totext(ret));
++*nprobs;
if (ret != 0) {
++*nfails;
++*nprobs;
++*nfails;
++*nfails;
++*nfails;
++*nfails;
if (T_debug) {
for (i = 0; i < sizeof(data1); i++)
for (i = 0; i < sizeof(data2); i++)
static char *a1 =
t1() {
int nfails;
int nprobs;
int result;
nfails = 0;
nprobs = 0;
else if (nfails)
#ifdef NEWSIG
int rval;
int fd;
int len;
int nprobs;
int cnt;
unsigned char val;
cnt = 0;
nprobs = 0;
if (fd < 0) {
while (len) {
++nprobs;
++nprobs;
--len;
++cnt;
++nprobs;
++nprobs;
return(nprobs);
int rval;
int len;
int fd;
unsigned char val;
char *buf;
if (rval != 0) {
if (fd < 0) {
p = buf;
while (len) {
if (rval > 0) {
p += rval;
p = buf;
while(len) {
--len;
--len;
--len;
int rval;
int len;
int fd;
int exp_res;
unsigned char *data;
if (rval != 0) {
++*nprobs;
++*nprobs;
if (fd < 0) {
++*nprobs;
p = data;
if (rval > 0) {
p += rval;
} while (len);
++*nprobs;
#ifdef NEWSIG
++*nprobs;
if (rval != 0) {
++*nprobs;
if (rval != 0) {
++*nprobs;
exp_res = 0;
++*nfails;
static char *a2 =
char *datapath;
char *sigpath;
char *keyname;
char *key;
int keyid;
char *alg;
int algid;
char *exp_result;
int nfails;
int nprobs;
int result;
nfails = 0;
nprobs = 0;
return(T_UNRESOLVED);
return(T_UNRESOLVED);
if (nfails)
return(result);
t2() {
int result;