tsig_unittest.cc 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505
  1. // Copyright (C) 2011 Internet Systems Consortium, Inc. ("ISC")
  2. //
  3. // Permission to use, copy, modify, and/or distribute this software for any
  4. // purpose with or without fee is hereby granted, provided that the above
  5. // copyright notice and this permission notice appear in all copies.
  6. //
  7. // THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
  8. // REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
  9. // AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
  10. // INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
  11. // LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
  12. // OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  13. // PERFORMANCE OF THIS SOFTWARE.
  14. #include <time.h>
  15. #include <string>
  16. #include <stdexcept>
  17. #include <vector>
  18. #include <boost/scoped_ptr.hpp>
  19. #include <gtest/gtest.h>
  20. #include <exceptions/exceptions.h>
  21. #include <util/buffer.h>
  22. #include <util/encode/base64.h>
  23. #include <util/unittests/newhook.h>
  24. #include <util/time_utilities.h>
  25. #include <dns/message.h>
  26. #include <dns/messagerenderer.h>
  27. #include <dns/question.h>
  28. #include <dns/opcode.h>
  29. #include <dns/rcode.h>
  30. #include <dns/rrclass.h>
  31. #include <dns/rrtype.h>
  32. #include <dns/tsig.h>
  33. #include <dns/tsigkey.h>
  34. #include <dns/tsigrecord.h>
  35. #include <dns/tests/unittest_util.h>
  36. using namespace std;
  37. using namespace isc;
  38. using namespace isc::dns;
  39. using namespace isc::util;
  40. using namespace isc::util::encode;
  41. using namespace isc::dns::rdata;
  42. using isc::UnitTestUtil;
  43. // See dnssectime.cc
  44. namespace isc {
  45. namespace util {
  46. namespace detail {
  47. extern int64_t (*gettimeFunction)();
  48. }
  49. }
  50. }
  51. namespace {
  52. // See dnssectime_unittest.cc
  53. template <int64_t NOW>
  54. int64_t
  55. testGetTime() {
  56. return (NOW);
  57. }
  58. class TSIGTest : public ::testing::Test {
  59. protected:
  60. TSIGTest() :
  61. tsig_ctx(NULL), qid(0x2d65), test_name("www.example.com"),
  62. test_class(RRClass::IN()), test_ttl(86400), message(Message::RENDER),
  63. buffer(0), renderer(buffer)
  64. {
  65. // Make sure we use the system time by default so that we won't be
  66. // confused due to other tests that tweak the time.
  67. isc::util::detail::gettimeFunction = NULL;
  68. decodeBase64("SFuWd/q99SzF8Yzd1QbB9g==", secret);
  69. tsig_ctx.reset(new TSIGContext(TSIGKey(test_name,
  70. TSIGKey::HMACMD5_NAME(),
  71. &secret[0], secret.size())));
  72. tsig_verify_ctx.reset(new TSIGContext(TSIGKey(test_name,
  73. TSIGKey::HMACMD5_NAME(),
  74. &secret[0],
  75. secret.size())));
  76. }
  77. ~TSIGTest() {
  78. isc::util::detail::gettimeFunction = NULL;
  79. }
  80. // Many of the tests below create some DNS message and sign it under
  81. // some specific TSIG context. This helper method unifies the common
  82. // logic with slightly different parameters.
  83. ConstTSIGRecordPtr createMessageAndSign(uint16_t qid, const Name& qname,
  84. TSIGContext* ctx,
  85. unsigned int message_flags =
  86. RD_FLAG,
  87. RRType qtype = RRType::A(),
  88. const char* answer_data = NULL,
  89. const RRType* answer_type = NULL,
  90. bool add_question = true,
  91. Rcode rcode = Rcode::NOERROR());
  92. // bit-wise constant flags to configure DNS header flags for test
  93. // messages.
  94. static const unsigned int QR_FLAG = 0x1;
  95. static const unsigned int AA_FLAG = 0x2;
  96. static const unsigned int RD_FLAG = 0x4;
  97. boost::scoped_ptr<TSIGContext> tsig_ctx;
  98. boost::scoped_ptr<TSIGContext> tsig_verify_ctx;
  99. const uint16_t qid;
  100. const Name test_name;
  101. const RRClass test_class;
  102. const RRTTL test_ttl;
  103. Message message;
  104. OutputBuffer buffer;
  105. MessageRenderer renderer;
  106. vector<uint8_t> secret;
  107. };
  108. ConstTSIGRecordPtr
  109. TSIGTest::createMessageAndSign(uint16_t id, const Name& qname,
  110. TSIGContext* ctx, unsigned int message_flags,
  111. RRType qtype, const char* answer_data,
  112. const RRType* answer_type, bool add_question,
  113. Rcode rcode)
  114. {
  115. message.clear(Message::RENDER);
  116. message.setQid(id);
  117. message.setOpcode(Opcode::QUERY());
  118. message.setRcode(rcode);
  119. if ((message_flags & QR_FLAG) != 0) {
  120. message.setHeaderFlag(Message::HEADERFLAG_QR);
  121. }
  122. if ((message_flags & AA_FLAG) != 0) {
  123. message.setHeaderFlag(Message::HEADERFLAG_AA);
  124. }
  125. if ((message_flags & RD_FLAG) != 0) {
  126. message.setHeaderFlag(Message::HEADERFLAG_RD);
  127. }
  128. if (add_question) {
  129. message.addQuestion(Question(qname, test_class, qtype));
  130. }
  131. if (answer_data != NULL) {
  132. if (answer_type == NULL) {
  133. answer_type = &qtype;
  134. }
  135. RRsetPtr answer_rrset(new RRset(qname, test_class, *answer_type,
  136. test_ttl));
  137. answer_rrset->addRdata(createRdata(*answer_type, test_class,
  138. answer_data));
  139. message.addRRset(Message::SECTION_ANSWER, answer_rrset);
  140. }
  141. renderer.clear();
  142. message.toWire(renderer);
  143. ConstTSIGRecordPtr tsig = ctx->sign(id, renderer.getData(),
  144. renderer.getLength());
  145. EXPECT_EQ(TSIGContext::SIGNED, ctx->getState());
  146. return (tsig);
  147. }
  148. void
  149. commonTSIGChecks(ConstTSIGRecordPtr tsig, uint16_t expected_qid,
  150. uint64_t expected_timesigned,
  151. const uint8_t* expected_mac, size_t expected_maclen,
  152. uint16_t expected_error = 0,
  153. uint16_t expected_otherlen = 0,
  154. const uint8_t* expected_otherdata = NULL,
  155. const Name& expected_algorithm = TSIGKey::HMACMD5_NAME())
  156. {
  157. ASSERT_TRUE(tsig != NULL);
  158. const any::TSIG& tsig_rdata = tsig->getRdata();
  159. EXPECT_EQ(expected_algorithm, tsig_rdata.getAlgorithm());
  160. EXPECT_EQ(expected_timesigned, tsig_rdata.getTimeSigned());
  161. EXPECT_EQ(300, tsig_rdata.getFudge());
  162. EXPECT_EQ(expected_maclen, tsig_rdata.getMACSize());
  163. EXPECT_PRED_FORMAT4(UnitTestUtil::matchWireData,
  164. tsig_rdata.getMAC(), tsig_rdata.getMACSize(),
  165. expected_mac, expected_maclen);
  166. EXPECT_EQ(expected_qid, tsig_rdata.getOriginalID());
  167. EXPECT_EQ(expected_error, tsig_rdata.getError());
  168. EXPECT_EQ(expected_otherlen, tsig_rdata.getOtherLen());
  169. EXPECT_PRED_FORMAT4(UnitTestUtil::matchWireData,
  170. tsig_rdata.getOtherData(), tsig_rdata.getOtherLen(),
  171. expected_otherdata, expected_otherlen);
  172. }
  173. TEST_F(TSIGTest, initialState) {
  174. // Until signing or verifying, the state should be INIT
  175. EXPECT_EQ(TSIGContext::INIT, tsig_ctx->getState());
  176. // And there should be no error code.
  177. EXPECT_EQ(TSIGError(Rcode::NOERROR()), tsig_ctx->getError());
  178. }
  179. // Example output generated by
  180. // "dig -y www.example.com:SFuWd/q99SzF8Yzd1QbB9g== www.example.com
  181. // QID: 0x2d65
  182. // Time Signed: 0x00004da8877a
  183. // MAC: 227026ad297beee721ce6c6fff1e9ef3
  184. const uint8_t common_expected_mac[] = {
  185. 0x22, 0x70, 0x26, 0xad, 0x29, 0x7b, 0xee, 0xe7,
  186. 0x21, 0xce, 0x6c, 0x6f, 0xff, 0x1e, 0x9e, 0xf3
  187. };
  188. TEST_F(TSIGTest, sign) {
  189. isc::util::detail::gettimeFunction = testGetTime<0x4da8877a>;
  190. {
  191. SCOPED_TRACE("Sign test for query");
  192. commonTSIGChecks(createMessageAndSign(qid, test_name, tsig_ctx.get()),
  193. qid, 0x4da8877a, common_expected_mac,
  194. sizeof(common_expected_mac));
  195. }
  196. }
  197. // Same test as sign, but specifying the key name with upper-case (i.e.
  198. // non canonical) characters. The digest must be the same. It should actually
  199. // be ensured at the level of TSIGKey, but we confirm that at this level, too.
  200. TEST_F(TSIGTest, signUsingUpperCasedKeyName) {
  201. isc::util::detail::gettimeFunction = testGetTime<0x4da8877a>;
  202. TSIGContext cap_ctx(TSIGKey(Name("WWW.EXAMPLE.COM"),
  203. TSIGKey::HMACMD5_NAME(),
  204. &secret[0], secret.size()));
  205. {
  206. SCOPED_TRACE("Sign test for query using non canonical key name");
  207. commonTSIGChecks(createMessageAndSign(qid, test_name, &cap_ctx), qid,
  208. 0x4da8877a, common_expected_mac,
  209. sizeof(common_expected_mac));
  210. }
  211. }
  212. // Same as the previous test, but for the algorithm name.
  213. TEST_F(TSIGTest, signUsingUpperCasedAlgorithmName) {
  214. isc::util::detail::gettimeFunction = testGetTime<0x4da8877a>;
  215. TSIGContext cap_ctx(TSIGKey(test_name,
  216. Name("HMAC-md5.SIG-alg.REG.int"),
  217. &secret[0], secret.size()));
  218. {
  219. SCOPED_TRACE("Sign test for query using non canonical algorithm name");
  220. commonTSIGChecks(createMessageAndSign(qid, test_name, &cap_ctx), qid,
  221. 0x4da8877a, common_expected_mac,
  222. sizeof(common_expected_mac));
  223. }
  224. }
  225. TEST_F(TSIGTest, signAtActualTime) {
  226. // Sign the message using the actual time, and check the accuracy of it.
  227. // We cannot reasonably predict the expected MAC, so don't bother to
  228. // check it.
  229. const uint64_t now = static_cast<uint64_t>(time(NULL));
  230. {
  231. SCOPED_TRACE("Sign test for query at actual time");
  232. ConstTSIGRecordPtr tsig = createMessageAndSign(qid, test_name,
  233. tsig_ctx.get());
  234. const any::TSIG& tsig_rdata = tsig->getRdata();
  235. // Check the resulted time signed is in the range of [now, now + 5]
  236. // (5 is an arbitrary choice). Note that due to the order of the call
  237. // to time() and sign(), time signed must not be smaller than the
  238. // current time.
  239. EXPECT_LE(now, tsig_rdata.getTimeSigned());
  240. EXPECT_GE(now + 5, tsig_rdata.getTimeSigned());
  241. }
  242. }
  243. TEST_F(TSIGTest, signBadData) {
  244. // some specific bad data should be rejected proactively.
  245. const unsigned char dummy_data = 0;
  246. EXPECT_THROW(tsig_ctx->sign(0, NULL, 10), InvalidParameter);
  247. EXPECT_THROW(tsig_ctx->sign(0, &dummy_data, 0), InvalidParameter);
  248. }
  249. #ifdef ENABLE_CUSTOM_OPERATOR_NEW
  250. // We enable this test only when we enable custom new/delete at build time
  251. // We could enable/disable the test runtime using the gtest filter, but
  252. // we'd basically like to minimize the number of disabled tests (they
  253. // should generally be considered tests that temporarily fail and should
  254. // be fixed).
  255. TEST_F(TSIGTest, signExceptionSafety) {
  256. // Check sign() provides the strong exception guarantee for the simpler
  257. // case (with a key error and empty MAC). The general case is more
  258. // complicated and involves more memory allocation, so the test result
  259. // won't be reliable.
  260. tsig_verify_ctx->verifyTentative(createMessageAndSign(qid, test_name,
  261. tsig_ctx.get()),
  262. TSIGError::BAD_KEY());
  263. // At this point the state should be changed to "CHECKED"
  264. ASSERT_EQ(TSIGContext::CHECKED, tsig_verify_ctx->getState());
  265. try {
  266. int dummydata;
  267. isc::util::unittests::force_throw_on_new = true;
  268. isc::util::unittests::throw_size_on_new = sizeof(TSIGRecord);
  269. tsig_verify_ctx->sign(0, &dummydata, sizeof(dummydata));
  270. isc::util::unittests::force_throw_on_new = false;
  271. ASSERT_FALSE(true) << "Expected throw on new, but it didn't happen";
  272. } catch (const std::bad_alloc&) {
  273. isc::util::unittests::force_throw_on_new = false;
  274. // sign() threw, so the state should still be "CHECKED".
  275. EXPECT_EQ(TSIGContext::CHECKED, tsig_verify_ctx->getState());
  276. }
  277. isc::util::unittests::force_throw_on_new = false;
  278. }
  279. #endif // ENABLE_CUSTOM_OPERATOR_NEW
  280. // Same test as "sign" but use a different algorithm just to confirm we don't
  281. // naively hardcode constants specific to a particular algorithm.
  282. // Test data generated by
  283. // "dig -y hmac-sha1:www.example.com:MA+QDhXbyqUak+qnMFyTyEirzng= www.example.com"
  284. // QID: 0x0967, RDflag
  285. // Current Time: 00004da8be86
  286. // Time Signed: 00004dae7d5f
  287. // HMAC Size: 20
  288. // HMAC: 415340c7daf824ed684ee586f7b5a67a2febc0d3
  289. TEST_F(TSIGTest, signUsingHMACSHA1) {
  290. isc::util::detail::gettimeFunction = testGetTime<0x4dae7d5f>;
  291. secret.clear();
  292. decodeBase64("MA+QDhXbyqUak+qnMFyTyEirzng=", secret);
  293. TSIGContext sha1_ctx(TSIGKey(test_name, TSIGKey::HMACSHA1_NAME(),
  294. &secret[0], secret.size()));
  295. const uint16_t sha1_qid = 0x0967;
  296. const uint8_t expected_mac[] = {
  297. 0x41, 0x53, 0x40, 0xc7, 0xda, 0xf8, 0x24, 0xed, 0x68, 0x4e,
  298. 0xe5, 0x86, 0xf7, 0xb5, 0xa6, 0x7a, 0x2f, 0xeb, 0xc0, 0xd3
  299. };
  300. {
  301. SCOPED_TRACE("Sign test using HMAC-SHA1");
  302. commonTSIGChecks(createMessageAndSign(sha1_qid, test_name, &sha1_ctx),
  303. sha1_qid, 0x4dae7d5f, expected_mac,
  304. sizeof(expected_mac), 0, 0, NULL,
  305. TSIGKey::HMACSHA1_NAME());
  306. }
  307. }
  308. // An example response to the signed query used for the "sign" test.
  309. // Answer: www.example.com. 86400 IN A 192.0.2.1
  310. // MAC: 8fcda66a7cd1a3b9948eb1869d384a9f
  311. TEST_F(TSIGTest, signResponse) {
  312. isc::util::detail::gettimeFunction = testGetTime<0x4da8877a>;
  313. ConstTSIGRecordPtr tsig = createMessageAndSign(qid, test_name,
  314. tsig_ctx.get());
  315. tsig_verify_ctx->verifyTentative(tsig);
  316. EXPECT_EQ(TSIGContext::CHECKED, tsig_verify_ctx->getState());
  317. // Transform the original message to a response, then sign the response
  318. // with the context of "verified state".
  319. tsig = createMessageAndSign(qid, test_name, tsig_verify_ctx.get(),
  320. QR_FLAG|AA_FLAG|RD_FLAG,
  321. RRType::A(), "192.0.2.1");
  322. const uint8_t expected_mac[] = {
  323. 0x8f, 0xcd, 0xa6, 0x6a, 0x7c, 0xd1, 0xa3, 0xb9,
  324. 0x94, 0x8e, 0xb1, 0x86, 0x9d, 0x38, 0x4a, 0x9f
  325. };
  326. {
  327. SCOPED_TRACE("Sign test for response");
  328. commonTSIGChecks(tsig, qid, 0x4da8877a,
  329. expected_mac, sizeof(expected_mac));
  330. }
  331. }
  332. // Example of signing multiple messages in a single TCP stream,
  333. // taken from data using BIND 9's "one-answer" transfer-format.
  334. // First message:
  335. // QID: 0x3410, flags QR, AA
  336. // Question: example.com/IN/AXFR
  337. // Answer: example.com. 86400 IN SOA ns.example.com. root.example.com. (
  338. // 2011041503 7200 3600 2592000 1200)
  339. // Time Signed: 0x4da8e951
  340. // Second message:
  341. // Answer: example.com. 86400 IN NS ns.example.com.
  342. // MAC: 102458f7f62ddd7d638d746034130968
  343. TEST_F(TSIGTest, signContinuation) {
  344. isc::util::detail::gettimeFunction = testGetTime<0x4da8e951>;
  345. const uint16_t axfr_qid = 0x3410;
  346. const Name zone_name("example.com");
  347. // Create and sign the AXFR request, then verify it.
  348. tsig_verify_ctx->verifyTentative(createMessageAndSign(axfr_qid, zone_name,
  349. tsig_ctx.get(), 0,
  350. RRType::AXFR()));
  351. EXPECT_EQ(TSIGContext::CHECKED, tsig_verify_ctx->getState());
  352. // Create and sign the first response message (we don't need the result
  353. // for the purpose of this test)
  354. createMessageAndSign(axfr_qid, zone_name, tsig_verify_ctx.get(),
  355. AA_FLAG|QR_FLAG, RRType::AXFR(),
  356. "ns.example.com. root.example.com. "
  357. "2011041503 7200 3600 2592000 1200",
  358. &RRType::SOA());
  359. // Create and sign the second response message
  360. const uint8_t expected_mac[] = {
  361. 0x10, 0x24, 0x58, 0xf7, 0xf6, 0x2d, 0xdd, 0x7d,
  362. 0x63, 0x8d, 0x74, 0x60, 0x34, 0x13, 0x09, 0x68
  363. };
  364. {
  365. SCOPED_TRACE("Sign test for continued response in TCP stream");
  366. commonTSIGChecks(createMessageAndSign(axfr_qid, zone_name,
  367. tsig_verify_ctx.get(),
  368. AA_FLAG|QR_FLAG, RRType::AXFR(),
  369. "ns.example.com.", &RRType::NS(),
  370. false),
  371. axfr_qid, 0x4da8e951,
  372. expected_mac, sizeof(expected_mac));
  373. }
  374. }
  375. // BADTIME example, taken from data using specially hacked BIND 9's nsupdate
  376. // Query:
  377. // QID: 0x1830, RD flag
  378. // Current Time: 00004da8be86
  379. // Time Signed: 00004da8b9d6
  380. // Question: www.example.com/IN/SOA
  381. //(mac) 8406 7d50 b8e7 d054 3d50 5bd9 de2a bb68
  382. // Response:
  383. // QRbit, RCODE=9(NOTAUTH)
  384. // Time Signed: 00004da8b9d6 (the one in the query)
  385. // MAC: d4b043f6f44495ec8a01260e39159d76
  386. // Error: 0x12 (BADTIME), Other Len: 6
  387. // Other data: 00004da8be86
  388. TEST_F(TSIGTest, badtimeResponse) {
  389. isc::util::detail::gettimeFunction = testGetTime<0x4da8b9d6>;
  390. const uint16_t test_qid = 0x7fc4;
  391. ConstTSIGRecordPtr tsig = createMessageAndSign(test_qid, test_name,
  392. tsig_ctx.get(), 0,
  393. RRType::SOA());
  394. // "advance the clock" and try validating, which should fail due to BADTIME
  395. // (verifyTentative actually doesn't check the time, though)
  396. isc::util::detail::gettimeFunction = testGetTime<0x4da8be86>;
  397. tsig_verify_ctx->verifyTentative(tsig, TSIGError::BAD_TIME());
  398. EXPECT_EQ(TSIGError::BAD_TIME(), tsig_verify_ctx->getError());
  399. // make and sign a response in the context of TSIG error.
  400. tsig = createMessageAndSign(test_qid, test_name, tsig_verify_ctx.get(),
  401. QR_FLAG, RRType::SOA(), NULL, NULL,
  402. true, Rcode::NOTAUTH());
  403. const uint8_t expected_otherdata[] = { 0, 0, 0x4d, 0xa8, 0xbe, 0x86 };
  404. const uint8_t expected_mac[] = {
  405. 0xd4, 0xb0, 0x43, 0xf6, 0xf4, 0x44, 0x95, 0xec,
  406. 0x8a, 0x01, 0x26, 0x0e, 0x39, 0x15, 0x9d, 0x76
  407. };
  408. {
  409. SCOPED_TRACE("Sign test for response with BADTIME");
  410. commonTSIGChecks(tsig, message.getQid(), 0x4da8b9d6,
  411. expected_mac, sizeof(expected_mac),
  412. 18, // error: BADTIME
  413. sizeof(expected_otherdata),
  414. expected_otherdata);
  415. }
  416. }
  417. TEST_F(TSIGTest, badsigResponse) {
  418. isc::util::detail::gettimeFunction = testGetTime<0x4da8877a>;
  419. // Sign a simple message, and force the verification to fail with
  420. // BADSIG.
  421. tsig_verify_ctx->verifyTentative(createMessageAndSign(qid, test_name,
  422. tsig_ctx.get()),
  423. TSIGError::BAD_SIG());
  424. // Sign the same message (which doesn't matter for this test) with the
  425. // context of "checked state".
  426. {
  427. SCOPED_TRACE("Sign test for response with BADSIG error");
  428. commonTSIGChecks(createMessageAndSign(qid, test_name,
  429. tsig_verify_ctx.get()),
  430. message.getQid(), 0x4da8877a, NULL, 0,
  431. 16); // 16: BADSIG
  432. }
  433. }
  434. TEST_F(TSIGTest, badkeyResponse) {
  435. // A similar test as badsigResponse but for BADKEY
  436. isc::util::detail::gettimeFunction = testGetTime<0x4da8877a>;
  437. tsig_verify_ctx->verifyTentative(createMessageAndSign(qid, test_name,
  438. tsig_ctx.get()),
  439. TSIGError::BAD_KEY());
  440. {
  441. SCOPED_TRACE("Sign test for response with BADKEY error");
  442. commonTSIGChecks(createMessageAndSign(qid, test_name,
  443. tsig_verify_ctx.get()),
  444. message.getQid(), 0x4da8877a, NULL, 0,
  445. 17); // 17: BADKEYSIG
  446. }
  447. }
  448. } // end namespace