ds_43.c revision 0c27b3fe77ac1d5094ba3521e8142d9e7973133f
66bd3b3c6b171271c705b897823dcdcf29464698Michael Graff * Copyright (C) 2002, 2004, 2005, 2007, 2009-2016 Internet Systems Consortium, Inc. ("ISC")
66bd3b3c6b171271c705b897823dcdcf29464698Michael Graff * This Source Code Form is subject to the terms of the Mozilla Public
66bd3b3c6b171271c705b897823dcdcf29464698Michael Graff * License, v. 2.0. If a copy of the MPL was not distributed with this
66bd3b3c6b171271c705b897823dcdcf29464698Michael Graff * file, You can obtain one at http://mozilla.org/MPL/2.0/.
66bd3b3c6b171271c705b897823dcdcf29464698Michael Graff (DNS_RDATATYPEATTR_DNSSEC|DNS_RDATATYPEATTR_ATPARENT)
66bd3b3c6b171271c705b897823dcdcf29464698Michael Graff unsigned char c;
3ac63b472022ff92691d1fe69ac715a729671965Michael Graff RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_number,
29f28fe573d4b3b318b3b026d567c1eb86738015Michael Graff RETERR(uint16_tobuffer(token.value.as_ulong, target));
e51511aa3281f8dc384eb1283115c7f8d5c402aeMichael Graff RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string,
11efdeb076d65fa9f0c5fc067dc040e7c99dfba6Michael Graff RETTOK(dns_secalg_fromtext(&c, &token.value.as_textregion));
ad3a5c4b7e21af04d1b872f933c2e19e5c0a135bMichael Graff * Digest type.
31fab17bcdbe302592a6c0dc5374ef56333ee879Michael Graff RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string,
31fab17bcdbe302592a6c0dc5374ef56333ee879Michael Graff RETTOK(dns_dsdigest_fromtext(&c, &token.value.as_textregion));
64828244e04e86dfa40f0a4f0c05f27923da499dMichael Graff return (isc_hex_tobuffer(lexer, target, length));
fe14eafefa91fada7cea0a55b09196c01477406cBob Halley return (generic_fromtext_ds(rdclass, type, lexer, origin, options,
11efdeb076d65fa9f0c5fc067dc040e7c99dfba6Michael Graff unsigned int n;
213973a334f92d4aef4ef62b4538fc2e4d0e8082Michael Graff * Digest type.
ad3a5c4b7e21af04d1b872f933c2e19e5c0a135bMichael Graff if ((tctx->flags & DNS_STYLEFLAG_MULTILINE) != 0)
66bd3b3c6b171271c705b897823dcdcf29464698Michael Graff if ((tctx->flags & DNS_STYLEFLAG_NOCRYPTO) == 0) {
ff9bb3fc5453bbf310b67c560fbf04a5c0fb60daMichael Graff if ((tctx->flags & DNS_STYLEFLAG_MULTILINE) != 0)
11fcc67616fac1bc6a28b3d4fed24641137888e7Michael Graff return (generic_totext_ds(rdata, tctx, target));
fe14eafefa91fada7cea0a55b09196c01477406cBob Halley * Check digest lengths if we know them.
d43c2cc7bc4022701f141e299ea8f3fb1d0640c2Michael Graff * Only copy digest lengths if we know them.
66bd3b3c6b171271c705b897823dcdcf29464698Michael Graff * If there is extra data dns_rdata_fromwire() will
66bd3b3c6b171271c705b897823dcdcf29464698Michael Graff * detect that.
d43c2cc7bc4022701f141e299ea8f3fb1d0640c2Michael Graff return (mem_tobuffer(target, sr.base, sr.length));
11fcc67616fac1bc6a28b3d4fed24641137888e7Michael Graff return (generic_fromwire_ds(rdclass, type, source, dctx, options,
66bd3b3c6b171271c705b897823dcdcf29464698Michael Graff return (mem_tobuffer(target, sr.base, sr.length));
ad3a5c4b7e21af04d1b872f933c2e19e5c0a135bMichael Graffstatic inline int
a253e35c2451818fb39f9b808c7641adb5275fb3Michael Graff REQUIRE(ds->length == ISC_SHA256_DIGESTLENGTH);
4281fe4a80af7402613f0d5c3eeff8829a4ede1fMichael Graff REQUIRE(ds->length == ISC_SHA384_DIGESTLENGTH);
e883738546c7c73b761bce8a15e08661863d3ae1Michael Graff RETERR(uint8_tobuffer(ds->algorithm, target));
e883738546c7c73b761bce8a15e08661863d3ae1Michael Graff RETERR(uint8_tobuffer(ds->digest_type, target));
14b98cb34eda66c87ce41a207704a2c232280eafMichael Graff return (mem_tobuffer(target, ds->digest, ds->length));
e883738546c7c73b761bce8a15e08661863d3ae1Michael Graff return (generic_fromstruct_ds(rdclass, type, source, target));
4281fe4a80af7402613f0d5c3eeff8829a4ede1fMichael Graff REQUIRE(ds->common.rdclass == rdata->rdclass);
65f6d2e1c1fce0989c13c2efb44b8dd26cd977f3Michael Graff ds->digest = mem_maybedup(mctx, region.base, region.length);
65f6d2e1c1fce0989c13c2efb44b8dd26cd977f3Michael Graff return (generic_tostruct_ds(rdata, target, mctx));
65f6d2e1c1fce0989c13c2efb44b8dd26cd977f3Michael Graffstatic inline void
65f6d2e1c1fce0989c13c2efb44b8dd26cd977f3Michael Graff REQUIRE(ds->common.rdtype == dns_rdatatype_ds);
59e22acc4f79ff481f7bfa46ef0558957ae53cfcMichael Graffstatic inline int
2bcb48cfcae36398454c98e40c563e2cde748e07Michael Graff#endif /* RDATA_GENERIC_DS_43_C */