tsec.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2009, 2010, 2012  Internet Systems Consortium, Inc. ("ISC")
00003  *
00004  * Permission to use, copy, modify, and/or distribute this software for any
00005  * purpose with or without fee is hereby granted, provided that the above
00006  * copyright notice and this permission notice appear in all copies.
00007  *
00008  * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
00009  * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
00010  * AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
00011  * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
00012  * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
00013  * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
00014  * PERFORMANCE OF THIS SOFTWARE.
00015  */
00016 
00017 /* $Id: tsec.h,v 1.6 2010/12/09 00:54:34 marka Exp $ */
00018 
00019 #ifndef DNS_TSEC_H
00020 #define DNS_TSEC_H 1
00021 
00022 /*****
00023  ***** Module Info
00024  *****/
00025 
00026 /*! \file
00027  *
00028  * \brief
00029  * The TSEC (Transaction Security) module is an abstraction layer for managing
00030  * DNS transaction mechanisms such as TSIG or SIG(0).  A TSEC structure is a
00031  * mechanism-independent object containing key information specific to the
00032  * mechanism, and is expected to be used as an argument to other modules
00033  * that use transaction security in a mechanism-independent manner.
00034  *
00035  * MP:
00036  *\li   A TSEC structure is expected to be thread-specific.  No inter-thread
00037  *      synchronization is ensured in multiple access to a single TSEC
00038  *      structure.
00039  *
00040  * Resources:
00041  *\li   TBS
00042  *
00043  * Security:
00044  *\li   This module does not handle any low-level data directly, and so no
00045  *      security issue specific to this module is anticipated.
00046  */
00047 
00048 #include <dns/types.h>
00049 
00050 #include <dst/dst.h>
00051 
00052 ISC_LANG_BEGINDECLS
00053 
00054 /***
00055  *** Types
00056  ***/
00057 
00058 /*%
00059  * Transaction security types.
00060  */
00061 typedef enum {
00062         dns_tsectype_none,
00063         dns_tsectype_tsig,
00064         dns_tsectype_sig0
00065 } dns_tsectype_t;
00066 
00067 isc_result_t
00068 dns_tsec_create(isc_mem_t *mctx, dns_tsectype_t type, dst_key_t *key,
00069                 dns_tsec_t **tsecp);
00070 /*%<
00071  * Create a TSEC structure and stores a type-dependent key structure in it.
00072  * For a TSIG key (type is dns_tsectype_tsig), dns_tsec_create() creates a
00073  * TSIG key structure from '*key' and keeps it in the structure.  For other
00074  * types, this function simply retains '*key' in the structure.  In either
00075  * case, the ownership of '*key' is transferred to the TSEC module; the caller
00076  * must not modify or destroy it after the call to dns_tsec_create().
00077  *
00078  * Requires:
00079  *
00080  *\li   'mctx' is a valid memory context.
00081  *
00082  *\li   'type' is a valid value of dns_tsectype_t (see above).
00083  *
00084  *\li   'key' is a valid key.
00085  *
00086  *\li   tsecp != NULL && *tsecp == NULL.
00087  *
00088  * Returns:
00089  *
00090  *\li   #ISC_R_SUCCESS                          On success.
00091  *
00092  *\li   Anything else                           Failure.
00093  */
00094 
00095 void
00096 dns_tsec_destroy(dns_tsec_t **tsecp);
00097 /*%<
00098  * Destroy the TSEC structure.  The stored key is also detached or destroyed.
00099  *
00100  * Requires
00101  *
00102  *\li   '*tsecp' is a valid TSEC structure.
00103  *
00104  * Ensures
00105  *
00106  *\li   *tsecp == NULL.
00107  *
00108  */
00109 
00110 dns_tsectype_t
00111 dns_tsec_gettype(dns_tsec_t *tsec);
00112 /*%<
00113  * Return the TSEC type of '*tsec'.
00114  *
00115  * Requires
00116  *
00117  *\li   'tsec' is a valid TSEC structure.
00118  *
00119  */
00120 
00121 void
00122 dns_tsec_getkey(dns_tsec_t *tsec, void *keyp);
00123 /*%<
00124  * Return the TSEC key of '*tsec' in '*keyp'.
00125  *
00126  * Requires
00127  *
00128  *\li   keyp != NULL
00129  *
00130  * Ensures
00131  *
00132  *\li   *tsecp points to a valid key structure depending on the TSEC type.
00133  */
00134 
00135 ISC_LANG_ENDDECLS
00136 
00137 #endif /* DNS_TSEC_H */

Generated on Tue Apr 28 17:40:57 2015 by Doxygen 1.5.4 for BIND9 Internals 9.11.0pre-alpha