OpenDNSSEC-signer
1.4.8.2
|
#include "config.h"
#include "shared/allocator.h"
#include "shared/status.h"
#include "wire/buffer.h"
#include <ldns/ldns.h>
Go to the source code of this file.
Data Structures | |
struct | tsig_lookup_table_struct |
struct | tsig_key_struct |
struct | tsig_algo_struct |
struct | tsig_struct |
struct | tsig_rr_struct |
Macros | |
#define | TSIG_ERROR_BADSIG 16 |
#define | TSIG_ERROR_BADKEY 17 |
#define | TSIG_ERROR_BADTIME 18 |
#define | TSIG_HMAC_MD5 157 |
#define | TSIG_HMAC_SHA1 158 |
#define | TSIG_HMAC_SHA256 159 |
Typedefs | |
typedef enum tsig_status_enum | tsig_status |
typedef struct tsig_lookup_table_struct | tsig_lookup_table |
typedef struct tsig_key_struct | tsig_key_type |
typedef struct tsig_algo_struct | tsig_algo_type |
typedef struct tsig_struct | tsig_type |
typedef struct tsig_rr_struct | tsig_rr_type |
Enumerations | |
enum | tsig_status_enum { TSIG_NOT_PRESENT, TSIG_OK, TSIG_ERROR } |
#define TSIG_ERROR_BADKEY 17 |
Definition at line 45 of file tsig.h.
Referenced by tsig_rr_lookup(), and tsig_strerror().
#define TSIG_ERROR_BADSIG 16 |
#define TSIG_ERROR_BADTIME 18 |
Definition at line 46 of file tsig.h.
Referenced by tsig_rr_lookup(), and tsig_strerror().
typedef struct tsig_algo_struct tsig_algo_type |
typedef struct tsig_key_struct tsig_key_type |
typedef struct tsig_lookup_table_struct tsig_lookup_table |
typedef struct tsig_rr_struct tsig_rr_type |
typedef enum tsig_status_enum tsig_status |
typedef struct tsig_struct tsig_type |
enum tsig_status_enum |
void tsig_cleanup | ( | tsig_type * | tsig, |
allocator_type * | allocator | ||
) |
Clean up TSIG.
[in] | tsig | TSIG |
[in] | allocator | memory allocator |
Clean up TSIG.
Definition at line 902 of file tsig.c.
References tsig_struct::algorithm, allocator_deallocate(), tsig_struct::name, tsig_struct::next, tsig_struct::secret, and tsig_cleanup().
Referenced by dnsin_cleanup(), dnsout_cleanup(), tsig_cleanup(), and tsig_create().
tsig_type* tsig_create | ( | allocator_type * | allocator, |
char * | name, | ||
char * | algo, | ||
char * | secret | ||
) |
Create new TSIG.
[in] | allocator | memory allocator |
[in] | name | tsig name |
[in] | algo | tsig algorithm |
[in] | secret | tsig secret |
Create new TSIG.
Definition at line 235 of file tsig.c.
References tsig_struct::algorithm, allocator_alloc(), allocator_strdup(), tsig_struct::key, tsig_struct::name, tsig_struct::next, ods_log_error(), tsig_struct::secret, tsig_cleanup(), and tsig_key_create().
void tsig_handler_add_algo | ( | tsig_algo_type * | algo | ) |
Add algorithm to TSIG handler.
[in] | algo | tsig algorithm |
Add algorithm to TSIG handler.
Definition at line 108 of file tsig.c.
References tsig_algo_table_struct::algorithm, allocator_alloc(), tsig_algo_struct::max_digest_size, and tsig_algo_table_struct::next.
void tsig_handler_add_key | ( | tsig_key_type * | key | ) |
Add key to TSIG handler.
[in] | key | tsig key |
Add key to TSIG handler.
Definition at line 86 of file tsig.c.
References allocator_alloc(), tsig_key_table_struct::key, and tsig_key_table_struct::next.
Referenced by tsig_key_create().
void tsig_handler_cleanup | ( | void | ) |
Clean up TSIG handler.
Definition at line 156 of file tsig.c.
References tsig_algo_table_struct::algorithm, allocator_deallocate(), tsig_key_struct::data, tsig_key_struct::dname, tsig_key_table_struct::key, tsig_key_table_struct::next, tsig_algo_table_struct::next, and tsig_algo_struct::wf_name.
Referenced by engine_start().
ods_status tsig_handler_init | ( | allocator_type * | allocator | ) |
Initialize TSIG handler.
[in] | allocator | memory allocator |
Initialize TSIG handler.
Definition at line 133 of file tsig.c.
References ods_log_debug(), ODS_STATUS_ERR, and ODS_STATUS_OK.
Referenced by engine_wakeup_workers().
tsig_algo_type* tsig_lookup_algo | ( | const char * | name | ) |
Lookup TSIG algorithm by name.
[in] | name | algorithm name |
Lookup TSIG algorithm by name.
Definition at line 289 of file tsig.c.
References tsig_algo_table_struct::algorithm, tsig_algo_table_struct::next, ods_strlowercmp(), and tsig_algo_struct::txt_name.
Referenced by notify_create(), and xfrd_acl_sockaddr_to().
Lookup TSIG by key name.
[in] | tsig | TSIG list |
[in] | naem | TSIG name |
Lookup TSIG by key name.
Definition at line 267 of file tsig.c.
References tsig_struct::name, tsig_struct::next, and ods_strlowercmp().
Referenced by acl_create().
void tsig_rr_append | ( | tsig_rr_type * | trr, |
buffer_type * | buffer | ||
) |
Append TSIG RR.
[in] | trr | TSIG RR |
[in] | buffer | packet buffer |
Append TSIG RR.
Definition at line 721 of file tsig.c.
References tsig_rr_struct::algo_name, buffer_position(), buffer_skip(), buffer_write(), buffer_write_rdf(), buffer_write_u16(), buffer_write_u16_at(), buffer_write_u32(), buffer_write_u8(), tsig_rr_struct::error_code, tsig_rr_struct::key_name, tsig_rr_struct::mac_data, tsig_rr_struct::mac_size, tsig_rr_struct::original_query_id, tsig_rr_struct::other_data, tsig_rr_struct::other_size, tsig_rr_struct::signed_time_fudge, tsig_rr_struct::signed_time_high, and tsig_rr_struct::signed_time_low.
Referenced by notify_create(), query_add_optional(), and xfrd_acl_sockaddr_to().
void tsig_rr_cleanup | ( | tsig_rr_type * | trr | ) |
Cleanup TSIG RR
[in] | trr | TSIG RR |
Cleanup TSIG RR.
Definition at line 884 of file tsig.c.
References tsig_rr_struct::allocator, allocator_deallocate(), and tsig_rr_free().
Referenced by notify_cleanup(), query_cleanup(), and xfrd_cleanup().
tsig_rr_type* tsig_rr_create | ( | allocator_type * | allocator | ) |
Create new TSIG RR.
[in] | allocator | memory allocator |
Create new TSIG RR.
Definition at line 306 of file tsig.c.
References tsig_rr_struct::algo_name, tsig_rr_struct::allocator, allocator_alloc(), tsig_rr_struct::key_name, tsig_rr_struct::mac_data, ods_log_error(), tsig_rr_struct::other_data, and tsig_rr_reset().
Referenced by notify_create(), query_create(), and xfrd_create().
void tsig_rr_error | ( | tsig_rr_type * | trr | ) |
Reply with error TSIG RR.
[in] | trr | TSIG RR |
Reply with error TSIG RR.
Definition at line 792 of file tsig.c.
References tsig_rr_struct::mac_data, and tsig_rr_struct::mac_size.
Referenced by query_add_optional().
int tsig_rr_find | ( | tsig_rr_type * | trr, |
buffer_type * | buffer | ||
) |
Find TSIG RR.
[in] | trr | TSIG RR |
[in] | buffer | packet buffer |
Find TSIG RR.
Definition at line 478 of file tsig.c.
References buffer_pkt_ancount(), buffer_pkt_arcount(), BUFFER_PKT_HEADER_SIZE, buffer_pkt_nscount(), buffer_pkt_qdcount(), buffer_position(), buffer_set_position(), buffer_skip_rr(), ods_log_assert, tsig_rr_struct::status, TSIG_NOT_PRESENT, and tsig_rr_parse().
Referenced by xfrd_acl_sockaddr_to().
void tsig_rr_free | ( | tsig_rr_type * | trr | ) |
Free TSIG RR.
[in] | trr | TSIG RR |
Free TSIG RR.
Definition at line 862 of file tsig.c.
References tsig_rr_struct::algo_name, tsig_rr_struct::allocator, allocator_deallocate(), tsig_rr_struct::key_name, tsig_rr_struct::mac_data, and tsig_rr_struct::other_data.
Referenced by tsig_rr_cleanup(), and tsig_rr_reset().
int tsig_rr_lookup | ( | tsig_rr_type * | trr | ) |
Lookup TSIG RR.
[in] | trr | TSIG RR |
Lookup TSIG RR.
Definition at line 511 of file tsig.c.
References tsig_rr_struct::algo, tsig_rr_struct::algo_name, tsig_algo_table_struct::algorithm, tsig_rr_struct::allocator, allocator_alloc(), tsig_key_struct::dname, tsig_rr_struct::error_code, tsig_key_table_struct::key, tsig_rr_struct::key, tsig_rr_struct::key_name, tsig_key_table_struct::next, tsig_algo_table_struct::next, ods_log_assert, ods_log_debug(), tsig_rr_struct::other_data, tsig_rr_struct::other_size, tsig_rr_struct::prior_mac_size, tsig_rr_struct::response_count, tsig_rr_struct::signed_time_fudge, tsig_rr_struct::signed_time_high, tsig_rr_struct::signed_time_low, tsig_rr_struct::status, time_now(), TSIG_ERROR_BADKEY, TSIG_ERROR_BADTIME, TSIG_OK, and tsig_algo_struct::wf_name.
Referenced by query_prepare().
int tsig_rr_parse | ( | tsig_rr_type * | trr, |
buffer_type * | buffer | ||
) |
Parse TSIG RR.
[in] | trr | TSIG RR |
[in] | buffer | packet buffer |
Parse TSIG RR.
Definition at line 364 of file tsig.c.
References tsig_rr_struct::algo_name, tsig_rr_struct::allocator, allocator_alloc_init(), buffer_available(), buffer_current(), buffer_position(), buffer_read_u16(), buffer_read_u32(), buffer_set_position(), buffer_skip(), buffer_skip_dname(), tsig_rr_struct::error_code, tsig_rr_struct::key_name, tsig_rr_struct::mac_data, tsig_rr_struct::mac_size, ods_log_assert, ods_log_debug(), tsig_rr_struct::original_query_id, tsig_rr_struct::other_data, tsig_rr_struct::other_size, tsig_rr_struct::position, tsig_rr_struct::signed_time_fudge, tsig_rr_struct::signed_time_high, tsig_rr_struct::signed_time_low, tsig_rr_struct::status, TSIG_ERROR, TSIG_NOT_PRESENT, and TSIG_OK.
Referenced by query_prepare(), and tsig_rr_find().
void tsig_rr_prepare | ( | tsig_rr_type * | trr | ) |
Prepare TSIG RR.
[in] | trr | TSIG RR |
Prepare TSIG RR.
Definition at line 580 of file tsig.c.
References tsig_rr_struct::algo, tsig_rr_struct::allocator, allocator_alloc(), tsig_rr_struct::context, tsig_algo_struct::hmac_create, tsig_algo_struct::hmac_init, tsig_algo_struct::hmac_update, tsig_rr_struct::key, tsig_algo_struct::max_digest_size, ods_log_assert, tsig_rr_struct::prior_mac_data, tsig_rr_struct::prior_mac_size, and tsig_rr_struct::update_since_last_prepare.
Referenced by notify_create(), query_add_optional(), query_prepare(), and xfrd_acl_sockaddr_to().
size_t tsig_rr_reserved_space | ( | tsig_rr_type * | trr | ) |
Definition at line 763 of file tsig.c.
References tsig_rr_struct::algo_name, tsig_rr_struct::key_name, tsig_rr_struct::other_size, tsig_rr_struct::status, and TSIG_NOT_PRESENT.
Referenced by query_prepare(), and query_reset().
void tsig_rr_reset | ( | tsig_rr_type * | trr, |
tsig_algo_type * | algo, | ||
tsig_key_type * | key | ||
) |
Reset TSIG RR.
[in] | trr | TSIG RR |
[in] | algo | tsig algorithm |
[in] | key | tsig key |
Reset TSIG RR.
Definition at line 333 of file tsig.c.
References tsig_rr_struct::algo, tsig_rr_struct::context, tsig_rr_struct::error_code, tsig_key_table_struct::key, tsig_rr_struct::key, tsig_rr_struct::mac_size, tsig_rr_struct::original_query_id, tsig_rr_struct::other_size, tsig_rr_struct::position, tsig_rr_struct::prior_mac_data, tsig_rr_struct::prior_mac_size, tsig_rr_struct::response_count, tsig_rr_struct::signed_time_fudge, tsig_rr_struct::signed_time_high, tsig_rr_struct::signed_time_low, tsig_rr_struct::status, TSIG_NOT_PRESENT, tsig_rr_free(), and tsig_rr_struct::update_since_last_prepare.
Referenced by notify_create(), query_reset(), tsig_rr_create(), and xfrd_acl_sockaddr_to().
void tsig_rr_sign | ( | tsig_rr_type * | trr | ) |
Sign TSIG RR.
[in] | trr | TSIG RR |
Sign TSIG RR.
Definition at line 677 of file tsig.c.
References tsig_rr_struct::algo, tsig_rr_struct::context, tsig_algo_struct::hmac_final, tsig_rr_struct::mac_data, tsig_rr_struct::mac_size, ods_log_assert, tsig_rr_struct::prior_mac_data, tsig_rr_struct::prior_mac_size, tsig_rr_struct::response_count, tsig_rr_struct::signed_time_fudge, tsig_rr_struct::signed_time_high, tsig_rr_struct::signed_time_low, time_now(), and TSIG_SIGNED_TIME_FUDGE.
Referenced by notify_create(), query_add_optional(), and xfrd_acl_sockaddr_to().
void tsig_rr_update | ( | tsig_rr_type * | trr, |
buffer_type * | buffer, | ||
size_t | length | ||
) |
Update TSIG RR.
[in] | trr | TSIG RR |
[in] | buffer | packet buffer |
[in] | length | number of octets of buffer to add to the TSIG hash, replacing the buffer's id with the original query idfrom TSIG. |
Update TSIG RR.
Definition at line 605 of file tsig.c.
References tsig_rr_struct::algo, tsig_rr_struct::algo_name, buffer_at(), buffer_limit(), buffer_pkt_qr(), tsig_rr_struct::context, tsig_rr_struct::error_code, tsig_algo_struct::hmac_update, tsig_rr_struct::key_name, ods_log_assert, tsig_rr_struct::original_query_id, tsig_rr_struct::other_data, tsig_rr_struct::other_size, tsig_rr_struct::response_count, tsig_rr_struct::signed_time_fudge, tsig_rr_struct::signed_time_high, tsig_rr_struct::signed_time_low, and tsig_rr_struct::update_since_last_prepare.
Referenced by notify_create(), query_add_optional(), query_prepare(), and xfrd_acl_sockaddr_to().
int tsig_rr_verify | ( | tsig_rr_type * | trr | ) |
Verify TSIG RR.
[in] | trr | TSIG RR |
Verify TSIG RR.
Definition at line 699 of file tsig.c.
References tsig_rr_struct::algo, tsig_rr_struct::context, tsig_rr_struct::error_code, tsig_algo_struct::hmac_final, tsig_rr_struct::mac_data, tsig_rr_struct::mac_size, ods_log_assert, tsig_rr_struct::prior_mac_data, tsig_rr_struct::prior_mac_size, tsig_rr_struct::response_count, and TSIG_ERROR_BADSIG.
Referenced by query_prepare(), and xfrd_acl_sockaddr_to().
const char* tsig_status2str | ( | tsig_status | status | ) |
Get human readable TSIG error code.
[in] | status | TSIG status |
Print TSIG status.
Definition at line 810 of file tsig.c.
References TSIG_ERROR, TSIG_NOT_PRESENT, and TSIG_OK.
Referenced by acl_create(), and query_process().
const char* tsig_strerror | ( | uint16_t | error | ) |
Get human readable TSIG error code.
[in] | error | TSIG error code |
Get human readable TSIG error code.
Definition at line 829 of file tsig.c.
References TSIG_ERROR_BADKEY, TSIG_ERROR_BADSIG, and TSIG_ERROR_BADTIME.
Referenced by xfrd_acl_sockaddr_to().