tkeyconf.c revision 40f53fa8d9c6a4fc38c0014495e7a42b08f52481
6d4886fa7430889a96dbf9b88a2a4eb6f9d04674Brian Wellington * Copyright (C) 1999, 2000 Internet Software Consortium.
6d4886fa7430889a96dbf9b88a2a4eb6f9d04674Brian Wellington * Permission to use, copy, modify, and distribute this software for any
6d4886fa7430889a96dbf9b88a2a4eb6f9d04674Brian Wellington * purpose with or without fee is hereby granted, provided that the above
6d4886fa7430889a96dbf9b88a2a4eb6f9d04674Brian Wellington * copyright notice and this permission notice appear in all copies.
6d4886fa7430889a96dbf9b88a2a4eb6f9d04674Brian Wellington * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
6d4886fa7430889a96dbf9b88a2a4eb6f9d04674Brian Wellington * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
6d4886fa7430889a96dbf9b88a2a4eb6f9d04674Brian Wellington * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
6d4886fa7430889a96dbf9b88a2a4eb6f9d04674Brian Wellington * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
6d4886fa7430889a96dbf9b88a2a4eb6f9d04674Brian Wellington * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
6d4886fa7430889a96dbf9b88a2a4eb6f9d04674Brian Wellington * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
6d4886fa7430889a96dbf9b88a2a4eb6f9d04674Brian Wellington * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
6d4886fa7430889a96dbf9b88a2a4eb6f9d04674Brian Wellington * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
6d4886fa7430889a96dbf9b88a2a4eb6f9d04674Brian Wellington/* $Id: tkeyconf.c,v 1.13 2000/08/01 01:22:59 tale Exp $ */
6d4886fa7430889a96dbf9b88a2a4eb6f9d04674Brian Wellington#include <isc/string.h> /* Required for HP/UX (and others?) */
6d4886fa7430889a96dbf9b88a2a4eb6f9d04674Brian Wellington#define RETERR(x) do { \
6d4886fa7430889a96dbf9b88a2a4eb6f9d04674Brian Wellingtondns_tkeyctx_fromconfig(dns_c_ctx_t *cfg, isc_mem_t *mctx, isc_entropy_t *ectx,
6d4886fa7430889a96dbf9b88a2a4eb6f9d04674Brian Wellington result = dns_tkeyctx_create(mctx, ectx, &tctx);
6d4886fa7430889a96dbf9b88a2a4eb6f9d04674Brian Wellington result = dns_c_ctx_gettkeydhkey(cfg, &s, &n);
6d4886fa7430889a96dbf9b88a2a4eb6f9d04674Brian Wellington isc_buffer_init(&namebuf, data, sizeof(data));
6d4886fa7430889a96dbf9b88a2a4eb6f9d04674Brian Wellington dns_name_fromtext(&keyname, &b, dns_rootname, ISC_FALSE, &namebuf);
6d4886fa7430889a96dbf9b88a2a4eb6f9d04674Brian Wellington RETERR(dst_key_fromfile(&keyname, n, DNS_KEYALG_DH,
6d4886fa7430889a96dbf9b88a2a4eb6f9d04674Brian Wellington tctx->domain = (dns_name_t *) isc_mem_get(mctx, sizeof(dns_name_t));
6d4886fa7430889a96dbf9b88a2a4eb6f9d04674Brian Wellington RETERR(dns_name_fromtext(&domain, &b, dns_rootname, ISC_FALSE,
6d4886fa7430889a96dbf9b88a2a4eb6f9d04674Brian Wellington RETERR(dns_name_dup(&domain, mctx, tctx->domain));