tsig_test.c revision 3c3d824db75bf1e008c645521112b91899b7938e
/*
* Copyright (C) 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/.
*/
/* ! \file */
#include <config.h>
#include <atf-c.h>
#include <dns/rdatalist.h>
#include <dns/rdataset.h>
#include "dnstest.h"
#ifdef HAVE_INTTYPES_H
#include <inttypes.h> /* uintptr_t */
#endif
static int debug = 0;
static isc_result_t
isc_region_t r;
unsigned char tsigbuf[1024];
isc_buffer_usedregion(buf, &r);
dns_rdatatype_tsig, &r);
isc_buffer_usedregion(&databuf, &r);
return (result);
}
static isc_result_t
isc_region_t r;
unsigned char tsigbuf[1024];
unsigned int count;
unsigned int sigsize = 0;
isc_buffer_usedregion(&databuf, &r);
/*
* Fixup additional record count.
*/
if (invalidate_ctx)
return (result);
}
static void
isc_buffer_t b;
int len = 1024;
if (!debug)
return;
do {
return;
0, &b);
if (result == ISC_R_NOSPACE) {
len *= 2;
} else if (result == ISC_R_SUCCESS)
} while (result == ISC_R_NOSPACE);
}
static void
{
"dns_message_create: %s",
/*
* XXXMPA: this hack needs to be replaced with use of
* dns_message_reply() at some point.
*/
if ((flags & DNS_MESSAGEFLAG_QR) != 0)
"dns_message_settsigkey: %s",
"dns_message_setquerytsig: %s",
}
"dns_compress_init: %s",
"dns_message_renderbegin: %s",
"dns_message_renderend: %s",
isc_region_t r;
isc_buffer_usedregion(buf, &r);
"dst_context_adddata: %s",
} else {
"dns_message_getquerytsig: %s",
}
}
/*
* Check that a simulated three message TCP sequence where the first
* and last messages contain TSIGs but the intermediate message doesn't
* correctly verifies.
*/
}
unsigned char secret[16] = { 0 };
/* isc_log_setdebuglevel(lctx, 99); */
/*
* Create request.
*/
/*
* Create response message 1.
*/
/*
* Process response message 1.
*/
"dns_message_setquerytsig: %s",
"dns_tsig_verify: %s",
/*
* Check that we have a TSIG in the first message.
*/
"dns_message_getquerytsig: %s",
/*
* Start digesting.
*/
/*
* Create response message 2.
*/
/*
* Process response message 2.
*/
"dns_message_setquerytsig: %s",
"dns_tsig_verify: %s",
/*
* Check that we don't have a TSIG in the second message.
*/
/*
* Create response message 3.
*/
/*
* Process response message 3.
*/
/*
* Check that we had a TSIG in the third message.
*/
"dns_message_setquerytsig: %s",
"dns_tsig_verify: %s",
"dns_message_getquerytsig: %s",
dns_test_end();
}
/*
* Main
*/
ATF_TP_ADD_TCS(tp) {
return (atf_no_error());
}