key_25.c revision caa55a655742e4e600bdb05a38e07f6896f32081
7d98a1783f222964bcde7d56dab77b822706204dBob Halley * Copyright (C) 1999-2001 Internet Software Consortium.
1687985cdfc3a4c330c5bdb02c131835f8756e3cBob Halley * Permission to use, copy, modify, and distribute this software for any
1687985cdfc3a4c330c5bdb02c131835f8756e3cBob Halley * purpose with or without fee is hereby granted, provided that the above
1687985cdfc3a4c330c5bdb02c131835f8756e3cBob Halley * copyright notice and this permission notice appear in all copies.
1687985cdfc3a4c330c5bdb02c131835f8756e3cBob Halley * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
1687985cdfc3a4c330c5bdb02c131835f8756e3cBob Halley * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
1687985cdfc3a4c330c5bdb02c131835f8756e3cBob Halley * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
1687985cdfc3a4c330c5bdb02c131835f8756e3cBob Halley * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
1687985cdfc3a4c330c5bdb02c131835f8756e3cBob Halley * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
1687985cdfc3a4c330c5bdb02c131835f8756e3cBob Halley * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
1687985cdfc3a4c330c5bdb02c131835f8756e3cBob Halley * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
1687985cdfc3a4c330c5bdb02c131835f8756e3cBob Halley * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
9c3531d72aeaad6c5f01efe6a1c82023e1379e4dDavid Lawrence/* $Id: key_25.c,v 1.39 2001/03/28 02:57:26 bwelling Exp $ */
1687985cdfc3a4c330c5bdb02c131835f8756e3cBob Halley * Reviewed: Wed Mar 15 16:47:10 PST 2000 by halley.
1687985cdfc3a4c330c5bdb02c131835f8756e3cBob Halley/* RFC 2535 */
1687985cdfc3a4c330c5bdb02c131835f8756e3cBob Halley#define RRTYPE_KEY_ATTRIBUTES (DNS_RDATATYPEATTR_DNSSEC)
8327c62a49a2487d29a37acbed6b602e629fc0eeAndreas Gustafsson RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string,
878d3073b13833ee1a50dfeabf8e400b6fdfc754Brian Wellington RETTOK(dns_keyflags_fromtext(&flags, &token.value.as_textregion));
1687985cdfc3a4c330c5bdb02c131835f8756e3cBob Halley /* protocol */
1687985cdfc3a4c330c5bdb02c131835f8756e3cBob Halley RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string,
7193a1762e428cfba06907e51fa9e4bce3b5569aAndreas Gustafsson RETTOK(dns_secproto_fromtext(&proto, &token.value.as_textregion));
1687985cdfc3a4c330c5bdb02c131835f8756e3cBob Halley /* algorithm */
1687985cdfc3a4c330c5bdb02c131835f8756e3cBob Halley RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string,
1687985cdfc3a4c330c5bdb02c131835f8756e3cBob Halley RETTOK(dns_secalg_fromtext(&alg, &token.value.as_textregion));
8582a1e113c13886ccbd1b534d6c240315767be6Bob Halley /* No Key? */
edcd1247ad7e81bb8b430e610d9718f64c70f05dDavid Lawrence return (isc_base64_tobuffer(lexer, target, -1));
e02c696ea586f8dcc7c6145cc0f143f887960cd4Andreas Gustafsson /* protocol */
e02c696ea586f8dcc7c6145cc0f143f887960cd4Andreas Gustafsson /* algorithm */
44fee668021c7ceef4ee1c848031d883a508b359James Brister if ((tctx->flags & DNS_STYLEFLAG_MULTILINE) != 0)
11d435aa4cf77e035445978f7e3776a3589715fdAndreas Gustafsson RETERR(str_totext(tctx->linebreak, target));
11d435aa4cf77e035445978f7e3776a3589715fdAndreas Gustafsson RETERR(isc_base64_totext(&sr, tctx->width - 2,
11d435aa4cf77e035445978f7e3776a3589715fdAndreas Gustafsson if ((tctx->flags & DNS_STYLEFLAG_COMMENT) != 0)
11d435aa4cf77e035445978f7e3776a3589715fdAndreas Gustafsson RETERR(str_totext(tctx->linebreak, target));
11d435aa4cf77e035445978f7e3776a3589715fdAndreas Gustafsson else if ((tctx->flags & DNS_STYLEFLAG_MULTILINE) != 0)
11d435aa4cf77e035445978f7e3776a3589715fdAndreas Gustafsson if ((tctx->flags & DNS_STYLEFLAG_MULTILINE) != 0)
a0f6cda5fd9f2fcc4154bb63628f849b639a40caAndreas Gustafsson if ((tctx->flags & DNS_STYLEFLAG_COMMENT) != 0) {
a0f6cda5fd9f2fcc4154bb63628f849b639a40caAndreas Gustafsson RETERR(str_totext(" ; key id = ", target));
a0f6cda5fd9f2fcc4154bb63628f849b639a40caAndreas Gustafsson sprintf(buf, "%u", dst_region_computeid(&tmpr, algorithm));
7193a1762e428cfba06907e51fa9e4bce3b5569aAndreas Gustafsson return (mem_tobuffer(target, sr.base, sr.length));
1687985cdfc3a4c330c5bdb02c131835f8756e3cBob Halley return (mem_tobuffer(target, sr.base, sr.length));
5542df09597c479be604da0ece8271cbc6fd9c4aDavid Lawrencestatic inline int
static inline isc_result_t
static inline isc_result_t
return (ISC_R_UNEXPECTEDEND);
return (ISC_R_UNEXPECTEDEND);
return (ISC_R_UNEXPECTEDEND);
return (ISC_R_NOMEMORY);
return (ISC_R_SUCCESS);
static inline isc_result_t
return (ISC_R_SUCCESS);
static inline isc_result_t
isc_region_t r;