2N/A#ifndef DST_H
2N/A#define DST_H
2N/A
2N/A#ifndef HAS_DST_KEY
2N/Atypedef struct dst_key {
2N/A char *dk_key_name; /*%< name of the key */
2N/A int dk_key_size; /*%< this is the size of the key in bits */
2N/A int dk_proto; /*%< what protocols this key can be used for */
2N/A int dk_alg; /*%< algorithm number from key record */
2N/A u_int32_t dk_flags; /*%< and the flags of the public key */
2N/A u_int16_t dk_id; /*%< identifier of the key */
2N/A} DST_KEY;
2N/A#endif /* HAS_DST_KEY */
2N/A/*
2N/A * do not taint namespace
2N/A */
2N/A#define dst_bsafe_init __dst_bsafe_init
2N/A#define dst_buffer_to_key __dst_buffer_to_key
2N/A#define dst_check_algorithm __dst_check_algorithm
2N/A#define dst_compare_keys __dst_compare_keys
2N/A#define dst_cylink_init __dst_cylink_init
2N/A#define dst_dnskey_to_key __dst_dnskey_to_key
2N/A#define dst_eay_dss_init __dst_eay_dss_init
2N/A#define dst_free_key __dst_free_key
2N/A#define dst_generate_key __dst_generate_key
2N/A#define dst_hmac_md5_init __dst_hmac_md5_init
2N/A#define dst_init __dst_init
2N/A#define dst_key_to_buffer __dst_key_to_buffer
2N/A#define dst_key_to_dnskey __dst_key_to_dnskey
2N/A#define dst_read_key __dst_read_key
2N/A#define dst_rsaref_init __dst_rsaref_init
2N/A#define dst_s_build_filename __dst_s_build_filename
2N/A#define dst_s_calculate_bits __dst_s_calculate_bits
2N/A#define dst_s_conv_bignum_b64_to_u8 __dst_s_conv_bignum_b64_to_u8
2N/A#define dst_s_conv_bignum_u8_to_b64 __dst_s_conv_bignum_u8_to_b64
2N/A#define dst_s_dns_key_id __dst_s_dns_key_id
2N/A#define dst_s_dump __dst_s_dump
2N/A#define dst_s_filename_length __dst_s_filename_length
2N/A#define dst_s_fopen __dst_s_fopen
2N/A#define dst_s_get_int16 __dst_s_get_int16
2N/A#define dst_s_get_int32 __dst_s_get_int32
2N/A#define dst_s_id_calc __dst_s_id_calc
2N/A#define dst_s_put_int16 __dst_s_put_int16
2N/A#define dst_s_put_int32 __dst_s_put_int32
2N/A#define dst_s_quick_random __dst_s_quick_random
2N/A#define dst_s_quick_random_set __dst_s_quick_random_set
2N/A#define dst_s_random __dst_s_random
2N/A#define dst_s_semi_random __dst_s_semi_random
2N/A#define dst_s_verify_str __dst_s_verify_str
2N/A#define dst_sig_size __dst_sig_size
2N/A#define dst_sign_data __dst_sign_data
2N/A#define dst_verify_data __dst_verify_data
2N/A#define dst_write_key __dst_write_key
2N/A
2N/A/*
2N/A * DST Crypto API defintions
2N/A */
2N/Avoid dst_init(void);
2N/Aint dst_check_algorithm(const int);
2N/A
2N/A
2N/Aint dst_sign_data(const int, /*!< specifies INIT/UPDATE/FINAL/ALL */
2N/A DST_KEY *, /*!< the key to use */
2N/A void **, /*!< pointer to state structure */
2N/A const u_char *, /*!< data to be signed */
2N/A const int, /*!< length of input data */
2N/A u_char *, /*!< buffer to write signature to */
2N/A const int); /*!< size of output buffer */
2N/Aint dst_verify_data(const int, /*!< specifies INIT/UPDATE/FINAL/ALL */
2N/A DST_KEY *, /*!< the key to use */
2N/A void **, /*!< pointer to state structure */
2N/A const u_char *, /*!< data to be verified */
2N/A const int, /*!< length of input data */
2N/A const u_char *, /*!< buffer containing signature */
2N/A const int); /*!< length of signature */
2N/ADST_KEY *dst_read_key(const char *, /*!< name of key */
2N/A const u_int16_t, /*!< key tag identifier */
2N/A const int, /*!< key algorithm */
2N/A const int); /*!< Private/PublicKey wanted */
2N/Aint dst_write_key(const DST_KEY *, /*!< key to write out */
2N/A const int); /*!< Public/Private */
2N/ADST_KEY *dst_dnskey_to_key(const char *, /*!< KEY record name */
2N/A const u_char *, /*!< KEY RDATA */
2N/A const int); /*!< size of input buffer */
2N/Aint dst_key_to_dnskey(const DST_KEY *, /*!< key to translate */
2N/A u_char *, /*!< output buffer */
2N/A const int); /*!< size of out_storage */
2N/ADST_KEY *dst_buffer_to_key(const char *, /*!< name of the key */
2N/A const int, /*!< algorithm */
2N/A const int, /*!< dns flags */
2N/A const int, /*!< dns protocol */
2N/A const u_char *, /*!< key in dns wire fmt */
2N/A const int); /*!< size of key */
2N/Aint dst_key_to_buffer(DST_KEY *, u_char *, int);
2N/A
2N/ADST_KEY *dst_generate_key(const char *, /*!< name of new key */
2N/A const int, /*!< key algorithm to generate */
2N/A const int, /*!< size of new key */
2N/A const int, /*!< alg dependent parameter */
2N/A const int, /*!< key DNS flags */
2N/A const int); /*!< key DNS protocol */
2N/ADST_KEY *dst_free_key(DST_KEY *);
2N/Aint dst_compare_keys(const DST_KEY *, const DST_KEY *);
2N/A
2N/Aint dst_sig_size(DST_KEY *);
2N/A
2N/A
2N/A/* support for dns key tags/ids */
2N/Au_int16_t dst_s_dns_key_id(const u_char *, const int);
2N/Au_int16_t dst_s_id_calc(const u_char *, const int);
2N/A
2N/A/* Used by callers as well as by the library. */
2N/A#define RAW_KEY_SIZE 8192 /*%< large enough to store any key */
2N/A/* DST_API control flags */
2N/A/* These are used used in functions dst_sign_data and dst_verify_data */
2N/A#define SIG_MODE_INIT 1 /*%< initialize digest */
2N/A#define SIG_MODE_UPDATE 2 /*%< add data to digest */
2N/A#define SIG_MODE_FINAL 4 /*%< generate/verify signature */
2N/A#define SIG_MODE_ALL (SIG_MODE_INIT|SIG_MODE_UPDATE|SIG_MODE_FINAL)
2N/A
2N/A/* Flags for dst_read_private_key() */
2N/A#define DST_FORCE_READ 0x1000000
2N/A#define DST_CAN_SIGN 0x010F
2N/A#define DST_NO_AUTHEN 0x8000
2N/A#define DST_EXTEND_FLAG 0x1000
2N/A#define DST_STANDARD 0
2N/A#define DST_PRIVATE 0x2000000
2N/A#define DST_PUBLIC 0x4000000
2N/A#define DST_RAND_SEMI 1
2N/A#define DST_RAND_STD 2
2N/A#define DST_RAND_KEY 3
2N/A#define DST_RAND_DSS 4
2N/A
2N/A
2N/A/* DST algorithm codes */
2N/A#define KEY_RSA 1
2N/A#define KEY_DH 2
2N/A#define KEY_DSA 3
2N/A#define KEY_PRIVATE 254
2N/A#define KEY_EXPAND 255
2N/A#define KEY_HMAC_MD5 157
2N/A#define KEY_HMAC_SHA1 158
2N/A#define UNKNOWN_KEYALG 0
2N/A#define DST_MAX_ALGS KEY_HMAC_SHA1
2N/A
2N/A/* DST constants to locations in KEY record changes in new KEY record */
2N/A#define DST_FLAGS_SIZE 2
2N/A#define DST_KEY_PROT 2
2N/A#define DST_KEY_ALG 3
2N/A#define DST_EXT_FLAG 4
2N/A#define DST_KEY_START 4
2N/A
2N/A#ifndef SIGN_F_NOKEY
2N/A#define SIGN_F_NOKEY 0xC000
2N/A#endif
2N/A
2N/A/* error codes from dst routines */
2N/A#define SIGN_INIT_FAILURE (-23)
2N/A#define SIGN_UPDATE_FAILURE (-24)
2N/A#define SIGN_FINAL_FAILURE (-25)
2N/A#define VERIFY_INIT_FAILURE (-26)
2N/A#define VERIFY_UPDATE_FAILURE (-27)
2N/A#define VERIFY_FINAL_FAILURE (-28)
2N/A#define MISSING_KEY_OR_SIGNATURE (-30)
2N/A#define UNSUPPORTED_KEYALG (-31)
2N/A
2N/A#endif /* DST_H */
2N/A/*! \file */