tsec.c File Reference

#include <config.h>
#include <isc/mem.h>
#include <dns/tsec.h>
#include <dns/tsig.h>
#include <dns/result.h>
#include <dst/dst.h>

Go to the source code of this file.

Data Structures

struct  dns_tsec
 DNS Transaction Security object. We assume this is not shared by multiple threads, and so the structure does not contain a lock. More...

Defines

#define DNS_TSEC_MAGIC   ISC_MAGIC('T', 's', 'e', 'c')
#define DNS_TSEC_VALID(t)   ISC_MAGIC_VALID(t, DNS_TSEC_MAGIC)

Functions

isc_result_t dns_tsec_create (isc_mem_t *mctx, dns_tsectype_t type, dst_key_t *key, dns_tsec_t **tsecp)
 Create a TSEC structure and stores a type-dependent key structure in it. For a TSIG key (type is dns_tsectype_tsig), dns_tsec_create() creates a TSIG key structure from '*key' and keeps it in the structure. For other types, this function simply retains '*key' in the structure. In either case, the ownership of '*key' is transferred to the TSEC module; the caller must not modify or destroy it after the call to dns_tsec_create().
void dns_tsec_destroy (dns_tsec_t **tsecp)
 Destroy the TSEC structure. The stored key is also detached or destroyed.
dns_tsectype_t dns_tsec_gettype (dns_tsec_t *tsec)
 Return the TSEC type of '*tsec'.
void dns_tsec_getkey (dns_tsec_t *tsec, void *keyp)
 Return the TSEC key of '*tsec' in '*keyp'.


Define Documentation

#define DNS_TSEC_MAGIC   ISC_MAGIC('T', 's', 'e', 'c')

Definition at line 29 of file tsec.c.

Referenced by dns_tsec_create().

#define DNS_TSEC_VALID (  )     ISC_MAGIC_VALID(t, DNS_TSEC_MAGIC)

Definition at line 30 of file tsec.c.

Referenced by dns_tsec_destroy(), dns_tsec_getkey(), and dns_tsec_gettype().


Function Documentation

isc_result_t dns_tsec_create ( isc_mem_t mctx,
dns_tsectype_t  type,
dst_key_t key,
dns_tsec_t **  tsecp 
)

Create a TSEC structure and stores a type-dependent key structure in it. For a TSIG key (type is dns_tsectype_tsig), dns_tsec_create() creates a TSIG key structure from '*key' and keeps it in the structure. For other types, this function simply retains '*key' in the structure. In either case, the ownership of '*key' is transferred to the TSEC module; the caller must not modify or destroy it after the call to dns_tsec_create().

Requires:

Returns:

Definition at line 47 of file tsec.c.

References DNS_R_BADALG, DNS_TSEC_MAGIC, dns_tsectype_sig0, dns_tsectype_tsig, dns_tsig_hmacmd5_name, dns_tsig_hmacsha1_name, dns_tsig_hmacsha224_name, dns_tsig_hmacsha256_name, dns_tsig_hmacsha384_name, dns_tsig_hmacsha512_name, dns_tsigkey_createfromkey(), DST_ALG_HMACMD5, DST_ALG_HMACSHA1, DST_ALG_HMACSHA224, DST_ALG_HMACSHA256, DST_ALG_HMACSHA384, DST_ALG_HMACSHA512, dst_key_alg(), dst_key_name(), INSIST, ISC_FALSE, isc_mem_get, isc_mem_put, ISC_R_NOMEMORY, ISC_R_SUCCESS, dns_tsec::key, dns_tsec::magic, dns_tsec::mctx, REQUIRE, dns_tsec::tsigkey, tsigkey, dns_tsec::type, and dns_tsec::ukey.

void dns_tsec_destroy ( dns_tsec_t **  tsecp  ) 

Destroy the TSEC structure. The stored key is also detached or destroyed.

Requires

Ensures

Definition at line 114 of file tsec.c.

References DNS_TSEC_VALID, dns_tsectype_sig0, dns_tsectype_tsig, dns_tsigkey_detach(), dst_key_free(), INSIST, isc_mem_put, dns_tsec::key, dns_tsec::magic, dns_tsec::mctx, REQUIRE, dns_tsec::tsigkey, dns_tsec::type, and dns_tsec::ukey.

dns_tsectype_t dns_tsec_gettype ( dns_tsec_t tsec  ) 

Return the TSEC type of '*tsec'.

Requires

Definition at line 139 of file tsec.c.

References DNS_TSEC_VALID, REQUIRE, and dns_tsec::type.

Referenced by dns_client_startrequest(), and dns_client_startupdate().

void dns_tsec_getkey ( dns_tsec_t tsec,
void *  keyp 
)

Return the TSEC key of '*tsec' in '*keyp'.

Requires

Ensures

Definition at line 146 of file tsec.c.

References DNS_TSEC_VALID, dns_tsectype_sig0, dns_tsectype_tsig, dns_tsigkey_attach(), INSIST, dns_tsec::key, REQUIRE, dns_tsec::tsigkey, dns_tsec::type, and dns_tsec::ukey.

Referenced by dns_client_startrequest(), and dns_client_startupdate().


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