Changeset View
Changeset View
Standalone View
Standalone View
contrib/ldns/tsig.c
Show First 20 Lines • Show All 190 Lines • ▼ Show 20 Lines | if (canonical_key_name_rdf == NULL) { | ||||
return LDNS_STATUS_MEM_ERR; | return LDNS_STATUS_MEM_ERR; | ||||
} | } | ||||
canonical_algorithm_rdf = ldns_rdf_clone(algorithm_rdf); | canonical_algorithm_rdf = ldns_rdf_clone(algorithm_rdf); | ||||
if (canonical_algorithm_rdf == NULL) { | if (canonical_algorithm_rdf == NULL) { | ||||
ldns_rdf_deep_free(canonical_key_name_rdf); | ldns_rdf_deep_free(canonical_key_name_rdf); | ||||
return LDNS_STATUS_MEM_ERR; | return LDNS_STATUS_MEM_ERR; | ||||
} | } | ||||
/* | /* | ||||
* prepare the digestable information | * prepare the digestible information | ||||
*/ | */ | ||||
data_buffer = ldns_buffer_new(LDNS_MAX_PACKETLEN); | data_buffer = ldns_buffer_new(LDNS_MAX_PACKETLEN); | ||||
if (!data_buffer) { | if (!data_buffer) { | ||||
status = LDNS_STATUS_MEM_ERR; | status = LDNS_STATUS_MEM_ERR; | ||||
goto clean; | goto clean; | ||||
} | } | ||||
/* if orig_mac is not NULL, add it too */ | /* if orig_mac is not NULL, add it too */ | ||||
if (orig_mac_rdf) { | if (orig_mac_rdf) { | ||||
▲ Show 20 Lines • Show All 136 Lines • ▼ Show 20 Lines | if (status != LDNS_STATUS_OK) { | ||||
return false; | return false; | ||||
} | } | ||||
/* Put back the values */ | /* Put back the values */ | ||||
ldns_pkt_set_tsig(pkt, orig_tsig); | ldns_pkt_set_tsig(pkt, orig_tsig); | ||||
ldns_pkt_set_id(pkt, pkt_id); | ldns_pkt_set_id(pkt, pkt_id); | ||||
ldns_rdf_deep_free(key_name_rdf); | ldns_rdf_deep_free(key_name_rdf); | ||||
if (ldns_rdf_compare(pkt_mac_rdf, my_mac_rdf) == 0) { | if( ldns_rdf_size(pkt_mac_rdf) != ldns_rdf_size(my_mac_rdf)) { | ||||
ldns_rdf_deep_free(my_mac_rdf); | |||||
return false; | |||||
} | |||||
/* use time insensitive memory compare */ | |||||
if( | |||||
#ifdef HAVE_CRYPTO_MEMCMP | |||||
CRYPTO_memcmp | |||||
#else | |||||
memcmp | |||||
#endif | |||||
(ldns_rdf_data(pkt_mac_rdf), ldns_rdf_data(my_mac_rdf), | |||||
ldns_rdf_size(my_mac_rdf)) == 0) { | |||||
ldns_rdf_deep_free(my_mac_rdf); | ldns_rdf_deep_free(my_mac_rdf); | ||||
return true; | return true; | ||||
} else { | } else { | ||||
ldns_rdf_deep_free(my_mac_rdf); | ldns_rdf_deep_free(my_mac_rdf); | ||||
return false; | return false; | ||||
} | } | ||||
} | } | ||||
#endif /* HAVE_SSL */ | #endif /* HAVE_SSL */ | ||||
▲ Show 20 Lines • Show All 122 Lines • Show Last 20 Lines |