t_dst.c revision e5966f9b9a13fc83afaf9b74ac1f7eea6a647817
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * Copyright (C) 1999 Internet Software Consortium.
ec5347e2c775f027573ce5648b910361aa926c01Automatic Updater * Permission to use, copy, modify, and distribute this software for any
4c1132f34493327abc632196f5876a89aa573687Bob Halley * purpose with or without fee is hereby granted, provided that the above
4c1132f34493327abc632196f5876a89aa573687Bob Halley * copyright notice and this permission notice appear in all copies.
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
b6d52ee5bea1b9d9074698e693b49ce96edff47bMark Andrewsstatic void t1(void);
b6d52ee5bea1b9d9074698e693b49ce96edff47bMark Andrewsstatic void t2(void);
c45abd11bb68005d8a5c56c14b16f4184c3e057dMichael Graff * adapted from the original dst_test.c program
fc80027fb54b501cdd88461bf879d078259e0226David Lawrence t_info("opendir(%s) failed %d\n", path, opendir);
87708bde16713bc02ff2598f4a82f98c699a2f2dMark Andrews t_info("remove(%s) failed %d\n", fullname, errno);
76117ff568dc788ed24937cfea916a18db285960Mark Andrewsuse(dst_key_t *key, dst_result_t exp_result, int *nfails) {
e334405421979688f2d838805ac67ee47bd62976Mark Andrews isc_buffer_init(&sigbuf, sig, sizeof(sig), ISC_BUFFERTYPE_BINARY);
cfb1587eb9a6dc6d1d36ea0344e1b20068b81e88Evan Hunt isc_buffer_init(&databuf, data, strlen(data), ISC_BUFFERTYPE_TEXT);
3cd88f71b01833d5c2474638854dfa5c4244a22aBrian Wellington ret = dst_sign(DST_SIGMODE_ALL, key, NULL, &datareg, &sigbuf);
87708bde16713bc02ff2598f4a82f98c699a2f2dMark Andrews t_info("dst_sign(%d) returned (%s) expected (%s)\n",
ce1f5b8d0ae5936fd187c1f414ff12a7e3b0aa37Andreas Gustafsson dst_key_alg(key), dst_result_totext(ret),
4fd3e3482c7e4ce01e2cf28f13e0152c8e50d746Mark Andrews ret = dst_verify(DST_SIGMODE_ALL, key, NULL, &datareg, &sigreg);
a5d43b72413db3edd6b36a58f9bdf2cf6ff692f2Bob Halley t_info("dst_verify(%d) returned (%s) expected (%s)\n",
64e41159a919b0711321fe688ca5da4f4d1b7d80Bob Halleyio(char *name, int id, int alg, int type, isc_mem_t *mctx, dst_result_t exp_result,
881702c9c0079cd48a45054fd90d043f3a8b7e11Mark Andrews ret = dst_key_fromfile(name, id, alg, type, mctx, &key);
64e41159a919b0711321fe688ca5da4f4d1b7d80Bob Halley t_info("dst_key_fromfile(%d) returned: %s\n", alg, dst_result_totext(ret));
6d7585b3e948dd31bf78321d83ac0e024f44a71bMark Andrews t_info("dst_key_tofile(%d) returned: %s\n", alg, dst_result_totext(ret));
289ae548d52bc8f982d9823af64cafda7bd92232Mark Andrews ret = dst_key_generate("test.", alg, 512, 0, 0, 0, mctx, &key);
++*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;