89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews/*
a134177ed9f82189504191d90f3ed9e97c2b47cbTinderbox User * Copyright (C) 2003, 2004, 2006, 2007, 2009, 2011-2013, 2015-2017 Internet Systems Consortium, Inc. ("ISC")
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews *
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews * This Source Code Form is subject to the terms of the Mozilla Public
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews * License, v. 2.0. If a copy of the MPL was not distributed with this
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews * file, You can obtain one at http://mozilla.org/MPL/2.0/.
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews */
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews
28a8f5b0de57d269cf2845c69cb6abe18cbd3b3aMark Andrews/* $Id$ */
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews
00b872e4f76587584a2359e9001e9cf08b195ccfMark Andrews/* RFC 4255 */
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews#ifndef RDATA_GENERIC_SSHFP_44_C
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews#define RDATA_GENERIC_SSHFP_44_C
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews#define RRTYPE_SSHFP_ATTRIBUTES (0)
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrewsstatic inline isc_result_t
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrewsfromtext_sshfp(ARGS_FROMTEXT) {
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews isc_token_t token;
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews
b0ba1a6059b6d6c4b3aa77d8bc84cc443b981e01Mukund Sivaraman REQUIRE(type == dns_rdatatype_sshfp);
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews UNUSED(type);
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews UNUSED(rdclass);
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews UNUSED(origin);
2047977ce2dfcfe3a0fa2d638c3242841310fad3Mark Andrews UNUSED(options);
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews UNUSED(callbacks);
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews /*
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews * Algorithm.
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews */
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_number,
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews ISC_FALSE));
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews if (token.value.as_ulong > 0xffU)
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews RETTOK(ISC_R_RANGE);
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews RETERR(uint8_tobuffer(token.value.as_ulong, target));
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews /*
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews * Digest type.
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews */
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_number,
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews ISC_FALSE));
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews if (token.value.as_ulong > 0xffU)
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews RETTOK(ISC_R_RANGE);
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews RETERR(uint8_tobuffer(token.value.as_ulong, target));
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews /*
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews * Digest.
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews */
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews return (isc_hex_tobuffer(lexer, target, -1));
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews}
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrewsstatic inline isc_result_t
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrewstotext_sshfp(ARGS_TOTEXT) {
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews isc_region_t sr;
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews char buf[sizeof("64000 ")];
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews unsigned int n;
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews
b0ba1a6059b6d6c4b3aa77d8bc84cc443b981e01Mukund Sivaraman REQUIRE(rdata->type == dns_rdatatype_sshfp);
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews REQUIRE(rdata->length != 0);
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews UNUSED(tctx);
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews dns_rdata_toregion(rdata, &sr);
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews /*
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews * Algorithm.
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews */
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews n = uint8_fromregion(&sr);
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews isc_region_consume(&sr, 1);
ad1317338af79edad878c9c3e4361798503310baMark Andrews snprintf(buf, sizeof(buf), "%u ", n);
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews RETERR(str_totext(buf, target));
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews /*
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews * Digest type.
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews */
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews n = uint8_fromregion(&sr);
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews isc_region_consume(&sr, 1);
ad1317338af79edad878c9c3e4361798503310baMark Andrews snprintf(buf, sizeof(buf), "%u", n);
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews RETERR(str_totext(buf, target));
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews /*
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews * Digest.
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews */
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews if ((tctx->flags & DNS_STYLEFLAG_MULTILINE) != 0)
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews RETERR(str_totext(" (", target));
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews RETERR(str_totext(tctx->linebreak, target));
9a859983d7059a6eb9c877c1d2ac6a3a5b7170f7Evan Hunt if (tctx->width == 0) /* No splitting */
9a859983d7059a6eb9c877c1d2ac6a3a5b7170f7Evan Hunt RETERR(isc_hex_totext(&sr, 0, "", target));
9a859983d7059a6eb9c877c1d2ac6a3a5b7170f7Evan Hunt else
9a859983d7059a6eb9c877c1d2ac6a3a5b7170f7Evan Hunt RETERR(isc_hex_totext(&sr, tctx->width - 2,
9a859983d7059a6eb9c877c1d2ac6a3a5b7170f7Evan Hunt tctx->linebreak, target));
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews if ((tctx->flags & DNS_STYLEFLAG_MULTILINE) != 0)
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews RETERR(str_totext(" )", target));
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews return (ISC_R_SUCCESS);
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews}
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrewsstatic inline isc_result_t
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrewsfromwire_sshfp(ARGS_FROMWIRE) {
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews isc_region_t sr;
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews
b0ba1a6059b6d6c4b3aa77d8bc84cc443b981e01Mukund Sivaraman REQUIRE(type == dns_rdatatype_sshfp);
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews UNUSED(type);
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews UNUSED(rdclass);
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews UNUSED(dctx);
2047977ce2dfcfe3a0fa2d638c3242841310fad3Mark Andrews UNUSED(options);
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews isc_buffer_activeregion(source, &sr);
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews if (sr.length < 4)
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews return (ISC_R_UNEXPECTEDEND);
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews isc_buffer_forward(source, sr.length);
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews return (mem_tobuffer(target, sr.base, sr.length));
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews}
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrewsstatic inline isc_result_t
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrewstowire_sshfp(ARGS_TOWIRE) {
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews isc_region_t sr;
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews
b0ba1a6059b6d6c4b3aa77d8bc84cc443b981e01Mukund Sivaraman REQUIRE(rdata->type == dns_rdatatype_sshfp);
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews REQUIRE(rdata->length != 0);
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews UNUSED(cctx);
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews dns_rdata_toregion(rdata, &sr);
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews return (mem_tobuffer(target, sr.base, sr.length));
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews}
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrewsstatic inline int
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrewscompare_sshfp(ARGS_COMPARE) {
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews isc_region_t r1;
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews isc_region_t r2;
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews REQUIRE(rdata1->type == rdata2->type);
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews REQUIRE(rdata1->rdclass == rdata2->rdclass);
b0ba1a6059b6d6c4b3aa77d8bc84cc443b981e01Mukund Sivaraman REQUIRE(rdata1->type == dns_rdatatype_sshfp);
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews REQUIRE(rdata1->length != 0);
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews REQUIRE(rdata2->length != 0);
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews dns_rdata_toregion(rdata1, &r1);
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews dns_rdata_toregion(rdata2, &r2);
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews return (isc_region_compare(&r1, &r2));
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews}
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrewsstatic inline isc_result_t
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrewsfromstruct_sshfp(ARGS_FROMSTRUCT) {
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews dns_rdata_sshfp_t *sshfp = source;
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews
b0ba1a6059b6d6c4b3aa77d8bc84cc443b981e01Mukund Sivaraman REQUIRE(type == dns_rdatatype_sshfp);
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews REQUIRE(source != NULL);
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews REQUIRE(sshfp->common.rdtype == type);
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews REQUIRE(sshfp->common.rdclass == rdclass);
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews UNUSED(type);
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews UNUSED(rdclass);
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews RETERR(uint8_tobuffer(sshfp->algorithm, target));
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews RETERR(uint8_tobuffer(sshfp->digest_type, target));
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews return (mem_tobuffer(target, sshfp->digest, sshfp->length));
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews}
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrewsstatic inline isc_result_t
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrewstostruct_sshfp(ARGS_TOSTRUCT) {
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews dns_rdata_sshfp_t *sshfp = target;
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews isc_region_t region;
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews
b0ba1a6059b6d6c4b3aa77d8bc84cc443b981e01Mukund Sivaraman REQUIRE(rdata->type == dns_rdatatype_sshfp);
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews REQUIRE(target != NULL);
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews REQUIRE(rdata->length != 0);
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews sshfp->common.rdclass = rdata->rdclass;
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews sshfp->common.rdtype = rdata->type;
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews ISC_LINK_INIT(&sshfp->common, link);
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews dns_rdata_toregion(rdata, &region);
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews sshfp->algorithm = uint8_fromregion(&region);
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews isc_region_consume(&region, 1);
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews sshfp->digest_type = uint8_fromregion(&region);
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews isc_region_consume(&region, 1);
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews sshfp->length = region.length;
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews sshfp->digest = mem_maybedup(mctx, region.base, region.length);
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews if (sshfp->digest == NULL)
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews return (ISC_R_NOMEMORY);
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews sshfp->mctx = mctx;
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews return (ISC_R_SUCCESS);
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews}
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrewsstatic inline void
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrewsfreestruct_sshfp(ARGS_FREESTRUCT) {
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews dns_rdata_sshfp_t *sshfp = source;
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews REQUIRE(sshfp != NULL);
b0ba1a6059b6d6c4b3aa77d8bc84cc443b981e01Mukund Sivaraman REQUIRE(sshfp->common.rdtype == dns_rdatatype_sshfp);
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews if (sshfp->mctx == NULL)
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews return;
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews if (sshfp->digest != NULL)
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews isc_mem_free(sshfp->mctx, sshfp->digest);
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews sshfp->mctx = NULL;
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews}
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrewsstatic inline isc_result_t
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrewsadditionaldata_sshfp(ARGS_ADDLDATA) {
b0ba1a6059b6d6c4b3aa77d8bc84cc443b981e01Mukund Sivaraman REQUIRE(rdata->type == dns_rdatatype_sshfp);
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews UNUSED(rdata);
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews UNUSED(add);
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews UNUSED(arg);
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews return (ISC_R_SUCCESS);
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews}
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrewsstatic inline isc_result_t
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrewsdigest_sshfp(ARGS_DIGEST) {
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews isc_region_t r;
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews
b0ba1a6059b6d6c4b3aa77d8bc84cc443b981e01Mukund Sivaraman REQUIRE(rdata->type == dns_rdatatype_sshfp);
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews dns_rdata_toregion(rdata, &r);
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews return ((digest)(arg, &r));
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews}
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews
2047977ce2dfcfe3a0fa2d638c3242841310fad3Mark Andrewsstatic inline isc_boolean_t
2047977ce2dfcfe3a0fa2d638c3242841310fad3Mark Andrewscheckowner_sshfp(ARGS_CHECKOWNER) {
2047977ce2dfcfe3a0fa2d638c3242841310fad3Mark Andrews
b0ba1a6059b6d6c4b3aa77d8bc84cc443b981e01Mukund Sivaraman REQUIRE(type == dns_rdatatype_sshfp);
2047977ce2dfcfe3a0fa2d638c3242841310fad3Mark Andrews
2047977ce2dfcfe3a0fa2d638c3242841310fad3Mark Andrews UNUSED(name);
2047977ce2dfcfe3a0fa2d638c3242841310fad3Mark Andrews UNUSED(type);
2047977ce2dfcfe3a0fa2d638c3242841310fad3Mark Andrews UNUSED(rdclass);
2047977ce2dfcfe3a0fa2d638c3242841310fad3Mark Andrews UNUSED(wildcard);
2047977ce2dfcfe3a0fa2d638c3242841310fad3Mark Andrews
2047977ce2dfcfe3a0fa2d638c3242841310fad3Mark Andrews return (ISC_TRUE);
2047977ce2dfcfe3a0fa2d638c3242841310fad3Mark Andrews}
2047977ce2dfcfe3a0fa2d638c3242841310fad3Mark Andrews
2047977ce2dfcfe3a0fa2d638c3242841310fad3Mark Andrewsstatic inline isc_boolean_t
2047977ce2dfcfe3a0fa2d638c3242841310fad3Mark Andrewschecknames_sshfp(ARGS_CHECKNAMES) {
2047977ce2dfcfe3a0fa2d638c3242841310fad3Mark Andrews
b0ba1a6059b6d6c4b3aa77d8bc84cc443b981e01Mukund Sivaraman REQUIRE(rdata->type == dns_rdatatype_sshfp);
2047977ce2dfcfe3a0fa2d638c3242841310fad3Mark Andrews
2047977ce2dfcfe3a0fa2d638c3242841310fad3Mark Andrews UNUSED(rdata);
2047977ce2dfcfe3a0fa2d638c3242841310fad3Mark Andrews UNUSED(owner);
2047977ce2dfcfe3a0fa2d638c3242841310fad3Mark Andrews UNUSED(bad);
2047977ce2dfcfe3a0fa2d638c3242841310fad3Mark Andrews
2047977ce2dfcfe3a0fa2d638c3242841310fad3Mark Andrews return (ISC_TRUE);
2047977ce2dfcfe3a0fa2d638c3242841310fad3Mark Andrews}
2047977ce2dfcfe3a0fa2d638c3242841310fad3Mark Andrews
3d17a3ba61a303d5c4d9867068d0fbe9f24d2988Mark Andrewsstatic inline int
3d17a3ba61a303d5c4d9867068d0fbe9f24d2988Mark Andrewscasecompare_sshfp(ARGS_COMPARE) {
3d17a3ba61a303d5c4d9867068d0fbe9f24d2988Mark Andrews return (compare_sshfp(rdata1, rdata2));
3d17a3ba61a303d5c4d9867068d0fbe9f24d2988Mark Andrews}
3d17a3ba61a303d5c4d9867068d0fbe9f24d2988Mark Andrews
89639a5e13cace9166bf14931b9e1ce9dc8c47a3Mark Andrews#endif /* RDATA_GENERIC_SSHFP_44_C */