ldns documentation

- Main Page
- Related Pages
- Data Structures
- Files

- File List
- Globals

Functions
tsig.c File Reference

Go to the source code of this file.

## Functions
char * | ldns_tsig_algorithm (ldns_tsig_credentials *tc)
char * | ldns_tsig_keyname (ldns_tsig_credentials *tc)
char * | ldns_tsig_keydata (ldns_tsig_credentials *tc)
char * | ldns_tsig_keyname_clone (ldns_tsig_credentials *tc)
char * | ldns_tsig_keydata_clone (ldns_tsig_credentials *tc)
bool | ldns_pkt_tsig_verify (ldns_pkt *pkt, uint8_t *wire, size_t wirelen, const char *key_name, const char *key_data, ldns_rdf *orig_mac_rdf)
| verifies the tsig rr for the given packet and key. More...
bool | ldns_pkt_tsig_verify_next (ldns_pkt *pkt, uint8_t *wire, size_t wirelen, const char *key_name, const char *key_data, ldns_rdf *orig_mac_rdf, int tsig_timers_only)
| verifies the tsig rr for the given packet and key. More...
ldns_status | ldns_pkt_tsig_sign (ldns_pkt *pkt, const char *key_name, const char *key_data, uint16_t fudge, const char *algorithm_name, ldns_rdf *query_mac)
| creates a tsig rr for the given packet and key. More...
ldns_status | ldns_pkt_tsig_sign_next (ldns_pkt *pkt, const char *key_name, const char *key_data, uint16_t fudge, const char *algorithm_name, ldns_rdf *query_mac, int tsig_timers_only)
| creates a tsig rr for the given packet and key. More...

## Function Documentation

char* ldns_tsig_algorithm | ( | ldns_tsig_credentials * | tc | ) |

Definition at line 22 of file tsig.c.

References ldns_tsig_credentials_struct::algorithm.

char* ldns_tsig_keyname | ( | ldns_tsig_credentials * | tc | ) |

Definition at line 28 of file tsig.c.

References ldns_tsig_credentials_struct::keyname.

char* ldns_tsig_keydata | ( | ldns_tsig_credentials * | tc | ) |

Definition at line 34 of file tsig.c.

References ldns_tsig_credentials_struct::keydata.

char* ldns_tsig_keyname_clone | ( | ldns_tsig_credentials * | tc | ) |

Definition at line 40 of file tsig.c.

References ldns_tsig_credentials_struct::keyname.

char* ldns_tsig_keydata_clone | ( | ldns_tsig_credentials * | tc | ) |

Definition at line 46 of file tsig.c.

References ldns_struct_buffer::_data, ldns_tsig_credentials_struct::keydata, LDNS_ANCOUNT, LDNS_ARCOUNT, LDNS_ARCOUNT_OFF, ldns_b64_pton(), ldns_buffer_free(), ldns_buffer_new(), ldns_dname2canonical(), LDNS_FREE, LDNS_HEADER_SIZE, LDNS_MAX_PACKETLEN, LDNS_NSCOUNT, LDNS_QDCOUNT, ldns_rdf2buffer_wire(), ldns_rdf2str(), ldns_rdf_clone(), ldns_rdf_deep_free(), ldns_rdf_new_frm_data(), LDNS_RDF_TYPE_INT16_DATA, LDNS_RR_CLASS_ANY, ldns_rr_free(), LDNS_SECTION_ADDITIONAL, LDNS_SECTION_ANSWER, LDNS_SECTION_AUTHORITY, LDNS_SECTION_QUESTION, LDNS_STATUS_CRYPTO_UNKNOWN_ALGO, LDNS_STATUS_INVALID_B64, LDNS_STATUS_MEM_ERR, LDNS_STATUS_NULL, LDNS_STATUS_OK, ldns_wire2rr(), and LDNS_XMALLOC.

bool ldns_pkt_tsig_verify | ( | ldns_pkt * | pkt,
|  | uint8_t * | wire,
|  | size_t | wire_size,
|  | const char * | key_name,
|  | const char * | key_data,
|  | ldns_rdf * | mac
| ) |  |

verifies the tsig rr for the given packet and key.

The wire must be given too because tsig does not sign normalized packets.

Parameters

  [in] | pkt | the packet to verify
  [in] | wire | needed to verify the mac
  [in] | wire_size | size of wire
  [in] | key_name | the name of the shared key
  [in] | key_data | the key in base 64 format
  [in] | mac | original mac

Returns
  true if tsig is correct, false if not, or if tsig is not set

Definition at line 276 of file tsig.c.

References ldns_pkt_tsig_verify_next().

bool ldns_pkt_tsig_verify_next | ( | ldns_pkt * | pkt,
|  | uint8_t * | wire,
|  | size_t | wire_size,
|  | const char * | key_name,
|  | const char * | key_data,
|  | ldns_rdf * | mac,
|  | int | tsig_timers_only
| ) |  |

verifies the tsig rr for the given packet and key.

The wire must be given too because tsig does not sign normalized packets.

Parameters

  [in] | pkt | the packet to verify
  [in] | wire | needed to verify the mac
  [in] | wire_size | size of wire
  [in] | key_name | the name of the shared key
  [in] | key_data | the key in base 64 format
  [in] | mac | original mac
  [in] | tsig_timers_only | must be zero for the first packet and positive for subsequent packets. If zero, all digest components are used to verify the _mac. If non-zero, only the TSIG timers are used to verify the mac.

Returns
  true if tsig is correct, false if not, or if tsig is not set

Definition at line 283 of file tsig.c.

References LDNS_FREE, ldns_pkt_id(), ldns_pkt_set_id(), ldns_pkt_set_tsig(), ldns_pkt_tsig(), ldns_rdf2native_int16(), ldns_rdf_compare(), ldns_rdf_deep_free(), ldns_rdf_new_frm_str(), LDNS_RDF_TYPE_DNAME, ldns_rr_rd_count(), ldns_rr_rdf(), and LDNS_STATUS_OK.

ldns_status ldns_pkt_tsig_sign | ( | ldns_pkt * | pkt,
|  | const char * | key_name,
|  | const char * | key_data,
|  | uint16_t | fudge,
|  | const char * | algorithm_name,
|  | ldns_rdf * | query_mac
| ) |  |

creates a tsig rr for the given packet and key.

Parameters

  [in] | pkt | the packet to sign
  [in] | key_name | the name of the shared key
  [in] | key_data | the key in base 64 format
  [in] | fudge | seconds of error permitted in time signed
  [in] | algorithm_name | the name of the algorithm used
  [in] | query_mac | is added to the digest if not NULL (so NULL is for signing queries, not NULL is for signing answers)

Returns
  status (OK if success)

Definition at line 352 of file tsig.c.

References ldns_pkt_tsig_sign_next().

ldns_status ldns_pkt_tsig_sign_next | ( | ldns_pkt * | pkt,
|  | const char * | key_name,
|  | const char * | key_data,
|  | uint16_t | fudge,
|  | const char * | algorithm_name,
|  | ldns_rdf * | query_mac,
|  | int | tsig_timers_only
| ) |  |

creates a tsig rr for the given packet and key.

Parameters

  [in] | pkt | the packet to sign
  [in] | key_name | the name of the shared key
  [in] | key_data | the key in base 64 format
  [in] | fudge | seconds of error permitted in time signed
  [in] | algorithm_name | the name of the algorithm used
  [in] | query_mac | is added to the digest if not NULL (so NULL is for signing queries, not NULL is for signing answers)
  [in] | tsig_timers_only | must be zero for the first packet and positive for subsequent packets. If zero, all digest components are used to create the query_mac. If non-zero, only the TSIG timers are used to create the query_mac.

Returns
  status (OK if success)

Definition at line 359 of file tsig.c.

References LDNS_FREE, ldns_native2rdf_int16(), ldns_native2rdf_int16_data(), ldns_pkt2wire(), ldns_pkt_id(), ldns_pkt_set_tsig(), ldns_rdf_free(), ldns_rdf_new(), ldns_rdf_new_frm_str(), LDNS_RDF_TYPE_DNAME, LDNS_RDF_TYPE_INT16, LDNS_RDF_TYPE_TSIGTIME, LDNS_RR_CLASS_ANY, ldns_rr_new(), ldns_rr_push_rdf(), ldns_rr_set_class(), ldns_rr_set_owner(), ldns_rr_set_ttl(), ldns_rr_set_type(), LDNS_RR_TYPE_TSIG, LDNS_STATUS_ERR, LDNS_STATUS_INTERNAL_ERR, LDNS_STATUS_MEM_ERR, LDNS_STATUS_OK, and LDNS_XMALLOC.