dst_parse.h File Reference

#include <isc/lang.h>
#include <dst/dst.h>

Go to the source code of this file.

Data Structures

struct  dst_private_element
struct  dst_private

Defines

#define DST_DST_PARSE_H   1
#define MAXFIELDSIZE   512
#define MAXFIELDS   12+6
#define TAG_SHIFT   4
#define TAG_ALG(tag)   ((unsigned int)(tag) >> TAG_SHIFT)
#define TAG(alg, off)   (((alg) << TAG_SHIFT) + (off))
#define RSA_NTAGS   11
#define TAG_RSA_MODULUS   ((DST_ALG_RSAMD5 << TAG_SHIFT) + 0)
#define TAG_RSA_PUBLICEXPONENT   ((DST_ALG_RSAMD5 << TAG_SHIFT) + 1)
#define TAG_RSA_PRIVATEEXPONENT   ((DST_ALG_RSAMD5 << TAG_SHIFT) + 2)
#define TAG_RSA_PRIME1   ((DST_ALG_RSAMD5 << TAG_SHIFT) + 3)
#define TAG_RSA_PRIME2   ((DST_ALG_RSAMD5 << TAG_SHIFT) + 4)
#define TAG_RSA_EXPONENT1   ((DST_ALG_RSAMD5 << TAG_SHIFT) + 5)
#define TAG_RSA_EXPONENT2   ((DST_ALG_RSAMD5 << TAG_SHIFT) + 6)
#define TAG_RSA_COEFFICIENT   ((DST_ALG_RSAMD5 << TAG_SHIFT) + 7)
#define TAG_RSA_ENGINE   ((DST_ALG_RSAMD5 << TAG_SHIFT) + 8)
#define TAG_RSA_LABEL   ((DST_ALG_RSAMD5 << TAG_SHIFT) + 9)
#define DH_NTAGS   4
#define TAG_DH_PRIME   ((DST_ALG_DH << TAG_SHIFT) + 0)
#define TAG_DH_GENERATOR   ((DST_ALG_DH << TAG_SHIFT) + 1)
#define TAG_DH_PRIVATE   ((DST_ALG_DH << TAG_SHIFT) + 2)
#define TAG_DH_PUBLIC   ((DST_ALG_DH << TAG_SHIFT) + 3)
#define DSA_NTAGS   5
#define TAG_DSA_PRIME   ((DST_ALG_DSA << TAG_SHIFT) + 0)
#define TAG_DSA_SUBPRIME   ((DST_ALG_DSA << TAG_SHIFT) + 1)
#define TAG_DSA_BASE   ((DST_ALG_DSA << TAG_SHIFT) + 2)
#define TAG_DSA_PRIVATE   ((DST_ALG_DSA << TAG_SHIFT) + 3)
#define TAG_DSA_PUBLIC   ((DST_ALG_DSA << TAG_SHIFT) + 4)
#define GOST_NTAGS   1
#define TAG_GOST_PRIVASN1   ((DST_ALG_ECCGOST << TAG_SHIFT) + 0)
#define TAG_GOST_PRIVRAW   ((DST_ALG_ECCGOST << TAG_SHIFT) + 1)
#define ECDSA_NTAGS   4
#define TAG_ECDSA_PRIVATEKEY   ((DST_ALG_ECDSA256 << TAG_SHIFT) + 0)
#define TAG_ECDSA_ENGINE   ((DST_ALG_ECDSA256 << TAG_SHIFT) + 1)
#define TAG_ECDSA_LABEL   ((DST_ALG_ECDSA256 << TAG_SHIFT) + 2)
#define OLD_HMACMD5_NTAGS   1
#define HMACMD5_NTAGS   2
#define TAG_HMACMD5_KEY   ((DST_ALG_HMACMD5 << TAG_SHIFT) + 0)
#define TAG_HMACMD5_BITS   ((DST_ALG_HMACMD5 << TAG_SHIFT) + 1)
#define HMACSHA1_NTAGS   2
#define TAG_HMACSHA1_KEY   ((DST_ALG_HMACSHA1 << TAG_SHIFT) + 0)
#define TAG_HMACSHA1_BITS   ((DST_ALG_HMACSHA1 << TAG_SHIFT) + 1)
#define HMACSHA224_NTAGS   2
#define TAG_HMACSHA224_KEY   ((DST_ALG_HMACSHA224 << TAG_SHIFT) + 0)
#define TAG_HMACSHA224_BITS   ((DST_ALG_HMACSHA224 << TAG_SHIFT) + 1)
#define HMACSHA256_NTAGS   2
#define TAG_HMACSHA256_KEY   ((DST_ALG_HMACSHA256 << TAG_SHIFT) + 0)
#define TAG_HMACSHA256_BITS   ((DST_ALG_HMACSHA256 << TAG_SHIFT) + 1)
#define HMACSHA384_NTAGS   2
#define TAG_HMACSHA384_KEY   ((DST_ALG_HMACSHA384 << TAG_SHIFT) + 0)
#define TAG_HMACSHA384_BITS   ((DST_ALG_HMACSHA384 << TAG_SHIFT) + 1)
#define HMACSHA512_NTAGS   2
#define TAG_HMACSHA512_KEY   ((DST_ALG_HMACSHA512 << TAG_SHIFT) + 0)
#define TAG_HMACSHA512_BITS   ((DST_ALG_HMACSHA512 << TAG_SHIFT) + 1)

Typedefs

typedef struct dst_private_element dst_private_element_t
typedef struct dst_private dst_private_t

Functions

ISC_LANG_BEGINDECLS void dst__privstruct_free (dst_private_t *priv, isc_mem_t *mctx)
isc_result_t dst__privstruct_parse (dst_key_t *key, unsigned int alg, isc_lex_t *lex, isc_mem_t *mctx, dst_private_t *priv)
isc_result_t dst__privstruct_writefile (const dst_key_t *key, const dst_private_t *priv, const char *directory)


Detailed Description

Definition in file dst_parse.h.


Define Documentation

#define DST_DST_PARSE_H   1

Definition at line 36 of file dst_parse.h.

#define MAXFIELDSIZE   512

Definition at line 42 of file dst_parse.h.

Referenced by dst__privstruct_free(), dst__privstruct_parse(), and dst__privstruct_writefile().

#define MAXFIELDS   12+6

Definition at line 48 of file dst_parse.h.

Referenced by dst__privstruct_parse().

#define TAG_SHIFT   4

Definition at line 50 of file dst_parse.h.

Referenced by check_ecdsa(), and check_rsa().

#define TAG_ALG ( tag   )     ((unsigned int)(tag) >> TAG_SHIFT)

Definition at line 51 of file dst_parse.h.

Referenced by find_value().

#define TAG ( alg,
off   )     (((alg) << TAG_SHIFT) + (off))

Definition at line 52 of file dst_parse.h.

Referenced by check_dh(), check_dsa(), check_ecdsa(), check_gost(), check_hmac_md5(), check_hmac_sha(), and check_rsa().

#define RSA_NTAGS   11

Definition at line 55 of file dst_parse.h.

Referenced by check_rsa().

#define TAG_RSA_MODULUS   ((DST_ALG_RSAMD5 << TAG_SHIFT) + 0)

Definition at line 56 of file dst_parse.h.

Referenced by check_rsa().

#define TAG_RSA_PUBLICEXPONENT   ((DST_ALG_RSAMD5 << TAG_SHIFT) + 1)

Definition at line 57 of file dst_parse.h.

Referenced by check_rsa().

#define TAG_RSA_PRIVATEEXPONENT   ((DST_ALG_RSAMD5 << TAG_SHIFT) + 2)

Definition at line 58 of file dst_parse.h.

Referenced by check_rsa().

#define TAG_RSA_PRIME1   ((DST_ALG_RSAMD5 << TAG_SHIFT) + 3)

Definition at line 59 of file dst_parse.h.

Referenced by check_rsa().

#define TAG_RSA_PRIME2   ((DST_ALG_RSAMD5 << TAG_SHIFT) + 4)

Definition at line 60 of file dst_parse.h.

Referenced by check_rsa().

#define TAG_RSA_EXPONENT1   ((DST_ALG_RSAMD5 << TAG_SHIFT) + 5)

Definition at line 61 of file dst_parse.h.

Referenced by check_rsa().

#define TAG_RSA_EXPONENT2   ((DST_ALG_RSAMD5 << TAG_SHIFT) + 6)

Definition at line 62 of file dst_parse.h.

Referenced by check_rsa().

#define TAG_RSA_COEFFICIENT   ((DST_ALG_RSAMD5 << TAG_SHIFT) + 7)

Definition at line 63 of file dst_parse.h.

Referenced by check_rsa().

#define TAG_RSA_ENGINE   ((DST_ALG_RSAMD5 << TAG_SHIFT) + 8)

Definition at line 64 of file dst_parse.h.

Referenced by check_rsa().

#define TAG_RSA_LABEL   ((DST_ALG_RSAMD5 << TAG_SHIFT) + 9)

Definition at line 65 of file dst_parse.h.

Referenced by check_rsa().

#define DH_NTAGS   4

Definition at line 67 of file dst_parse.h.

Referenced by check_dh().

#define TAG_DH_PRIME   ((DST_ALG_DH << TAG_SHIFT) + 0)

Definition at line 68 of file dst_parse.h.

#define TAG_DH_GENERATOR   ((DST_ALG_DH << TAG_SHIFT) + 1)

Definition at line 69 of file dst_parse.h.

#define TAG_DH_PRIVATE   ((DST_ALG_DH << TAG_SHIFT) + 2)

Definition at line 70 of file dst_parse.h.

#define TAG_DH_PUBLIC   ((DST_ALG_DH << TAG_SHIFT) + 3)

Definition at line 71 of file dst_parse.h.

#define DSA_NTAGS   5

Definition at line 73 of file dst_parse.h.

Referenced by check_dsa().

#define TAG_DSA_PRIME   ((DST_ALG_DSA << TAG_SHIFT) + 0)

Definition at line 74 of file dst_parse.h.

#define TAG_DSA_SUBPRIME   ((DST_ALG_DSA << TAG_SHIFT) + 1)

Definition at line 75 of file dst_parse.h.

#define TAG_DSA_BASE   ((DST_ALG_DSA << TAG_SHIFT) + 2)

Definition at line 76 of file dst_parse.h.

#define TAG_DSA_PRIVATE   ((DST_ALG_DSA << TAG_SHIFT) + 3)

Definition at line 77 of file dst_parse.h.

#define TAG_DSA_PUBLIC   ((DST_ALG_DSA << TAG_SHIFT) + 4)

Definition at line 78 of file dst_parse.h.

#define GOST_NTAGS   1

Definition at line 80 of file dst_parse.h.

Referenced by check_gost().

#define TAG_GOST_PRIVASN1   ((DST_ALG_ECCGOST << TAG_SHIFT) + 0)

Definition at line 81 of file dst_parse.h.

#define TAG_GOST_PRIVRAW   ((DST_ALG_ECCGOST << TAG_SHIFT) + 1)

Definition at line 82 of file dst_parse.h.

#define ECDSA_NTAGS   4

Definition at line 84 of file dst_parse.h.

Referenced by check_ecdsa().

#define TAG_ECDSA_PRIVATEKEY   ((DST_ALG_ECDSA256 << TAG_SHIFT) + 0)

Definition at line 85 of file dst_parse.h.

Referenced by check_ecdsa().

#define TAG_ECDSA_ENGINE   ((DST_ALG_ECDSA256 << TAG_SHIFT) + 1)

Definition at line 86 of file dst_parse.h.

Referenced by check_ecdsa().

#define TAG_ECDSA_LABEL   ((DST_ALG_ECDSA256 << TAG_SHIFT) + 2)

Definition at line 87 of file dst_parse.h.

Referenced by check_ecdsa().

#define OLD_HMACMD5_NTAGS   1

Definition at line 89 of file dst_parse.h.

Referenced by check_hmac_md5().

#define HMACMD5_NTAGS   2

Definition at line 90 of file dst_parse.h.

Referenced by check_hmac_md5().

#define TAG_HMACMD5_KEY   ((DST_ALG_HMACMD5 << TAG_SHIFT) + 0)

Definition at line 91 of file dst_parse.h.

Referenced by check_hmac_md5(), hmacmd5_parse(), and hmacmd5_tofile().

#define TAG_HMACMD5_BITS   ((DST_ALG_HMACMD5 << TAG_SHIFT) + 1)

Definition at line 92 of file dst_parse.h.

Referenced by hmacmd5_parse(), and hmacmd5_tofile().

#define HMACSHA1_NTAGS   2

Definition at line 94 of file dst_parse.h.

Referenced by check_data().

#define TAG_HMACSHA1_KEY   ((DST_ALG_HMACSHA1 << TAG_SHIFT) + 0)

Definition at line 95 of file dst_parse.h.

Referenced by hmacsha1_parse(), and hmacsha1_tofile().

#define TAG_HMACSHA1_BITS   ((DST_ALG_HMACSHA1 << TAG_SHIFT) + 1)

Definition at line 96 of file dst_parse.h.

Referenced by hmacsha1_parse(), and hmacsha1_tofile().

#define HMACSHA224_NTAGS   2

Definition at line 98 of file dst_parse.h.

Referenced by check_data().

#define TAG_HMACSHA224_KEY   ((DST_ALG_HMACSHA224 << TAG_SHIFT) + 0)

Definition at line 99 of file dst_parse.h.

Referenced by hmacsha224_parse(), and hmacsha224_tofile().

#define TAG_HMACSHA224_BITS   ((DST_ALG_HMACSHA224 << TAG_SHIFT) + 1)

Definition at line 100 of file dst_parse.h.

Referenced by hmacsha224_parse(), and hmacsha224_tofile().

#define HMACSHA256_NTAGS   2

Definition at line 102 of file dst_parse.h.

Referenced by check_data().

#define TAG_HMACSHA256_KEY   ((DST_ALG_HMACSHA256 << TAG_SHIFT) + 0)

Definition at line 103 of file dst_parse.h.

Referenced by hmacsha256_parse(), and hmacsha256_tofile().

#define TAG_HMACSHA256_BITS   ((DST_ALG_HMACSHA256 << TAG_SHIFT) + 1)

Definition at line 104 of file dst_parse.h.

Referenced by hmacsha256_parse(), and hmacsha256_tofile().

#define HMACSHA384_NTAGS   2

Definition at line 106 of file dst_parse.h.

Referenced by check_data().

#define TAG_HMACSHA384_KEY   ((DST_ALG_HMACSHA384 << TAG_SHIFT) + 0)

Definition at line 107 of file dst_parse.h.

Referenced by hmacsha384_parse(), and hmacsha384_tofile().

#define TAG_HMACSHA384_BITS   ((DST_ALG_HMACSHA384 << TAG_SHIFT) + 1)

Definition at line 108 of file dst_parse.h.

Referenced by hmacsha384_parse(), and hmacsha384_tofile().

#define HMACSHA512_NTAGS   2

Definition at line 110 of file dst_parse.h.

Referenced by check_data().

#define TAG_HMACSHA512_KEY   ((DST_ALG_HMACSHA512 << TAG_SHIFT) + 0)

Definition at line 111 of file dst_parse.h.

Referenced by hmacsha512_parse(), and hmacsha512_tofile().

#define TAG_HMACSHA512_BITS   ((DST_ALG_HMACSHA512 << TAG_SHIFT) + 1)

Definition at line 112 of file dst_parse.h.

Referenced by hmacsha512_parse(), and hmacsha512_tofile().


Typedef Documentation

typedef struct dst_private_element dst_private_element_t

Definition at line 120 of file dst_parse.h.

typedef struct dst_private dst_private_t

Definition at line 127 of file dst_parse.h.


Function Documentation

ISC_LANG_BEGINDECLS void dst__privstruct_free ( dst_private_t priv,
isc_mem_t mctx 
)

Definition at line 389 of file dst_parse.c.

References dst_private_element::data, dst_private::elements, isc_mem_put, MAXFIELDSIZE, and dst_private::nelements.

Referenced by dst__privstruct_parse(), hmacmd5_parse(), hmacsha1_parse(), hmacsha224_parse(), hmacsha256_parse(), hmacsha384_parse(), and hmacsha512_parse().

isc_result_t dst__privstruct_parse ( dst_key_t key,
unsigned int  alg,
isc_lex_t lex,
isc_mem_t mctx,
dst_private_t priv 
)

Definition at line 404 of file dst_parse.c.

References ALGORITHM_STR, isc_tokenvalue_t::as_ulong, isc_region::base, check_data(), dst_private_element::data, dns_time32_fromtext(), dst__privstruct_free(), DST_AS_STR, dst_key_alg(), dst_key_setnum(), dst_key_setprivateformat(), dst_key_settime(), DST_MAJOR_VERSION, DST_MINOR_VERSION, DST_R_INVALIDPRIVATEKEY, dst_private::elements, find_numericdata(), find_timedata(), find_value(), INSIST, isc_base64_tobuffer(), isc_buffer_init, isc_buffer_usedregion, ISC_FALSE, isc_lex_gettoken(), ISC_LEXOPT_EOL, ISC_LEXOPT_NUMBER, isc_mem_get, isc_mem_put, ISC_R_EOF, ISC_R_SUCCESS, isc_tokentype_eol, isc_tokentype_number, isc_tokentype_string, ISC_TRUE, isc_region::length, dst_private_element::length, MAXFIELDS, MAXFIELDSIZE, dst_private::nelements, NEXTTOKEN, NUMERIC_NTAGS, PRIVATE_KEY_STR, r, READLINE, REQUIRE, dst_private_element::tag, parse_map::tag, TIMING_NTAGS, token, isc_token::type, and isc_token::value.

Referenced by hmacmd5_parse(), hmacsha1_parse(), hmacsha224_parse(), hmacsha256_parse(), hmacsha384_parse(), and hmacsha512_parse().

isc_result_t dst__privstruct_writefile ( const dst_key_t key,
const dst_private_t priv,
const char *  directory 
)

Definition at line 611 of file dst_parse.c.

References ALGORITHM_STR, isc_region::base, buffer, check_data(), dst_private_element::data, dns_lctx, DNS_LOGCATEGORY_GENERAL, DNS_LOGMODULE_DNSSEC, dns_time32_totext(), DST_ALG_DH, DST_ALG_DSA, DST_ALG_ECCGOST, DST_ALG_ECDSA256, DST_ALG_ECDSA384, DST_ALG_HMACMD5, DST_ALG_HMACSHA1, DST_ALG_HMACSHA224, DST_ALG_HMACSHA256, DST_ALG_HMACSHA384, DST_ALG_HMACSHA512, DST_ALG_NSEC3DSA, DST_ALG_NSEC3RSASHA1, DST_ALG_RSAMD5, DST_ALG_RSASHA1, DST_ALG_RSASHA256, DST_ALG_RSASHA512, dst_key_alg(), dst_key_buildfilename(), dst_key_getnum(), dst_key_getprivateformat(), dst_key_gettime(), DST_MAJOR_VERSION, DST_MINOR_VERSION, DST_R_INVALIDPRIVATEKEY, DST_R_WRITEERROR, DST_TYPE_PRIVATE, dst_private::elements, find_tag(), isc_base64_totext(), isc_buffer_init, isc_buffer_usedregion, ISC_DIR_NAMEMAX, ISC_FALSE, isc_file_mode(), isc_fsaccess_add(), ISC_FSACCESS_OWNER, ISC_FSACCESS_READ, isc_fsaccess_set(), ISC_FSACCESS_WRITE, ISC_LOG_WARNING, isc_log_write(), ISC_R_SUCCESS, dst_private_element::length, isc_region::length, MAXFIELDSIZE, dst_private::nelements, NUMERIC_NTAGS, numerictags, PRIVATE_KEY_STR, r, REQUIRE, s, dst_private_element::tag, timetags, TIMING_NTAGS, and parse_map::value.

Referenced by hmacmd5_tofile(), hmacsha1_tofile(), hmacsha224_tofile(), hmacsha256_tofile(), hmacsha384_tofile(), and hmacsha512_tofile().


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