Lines Matching defs:ta
118 struct trust_anchor* ta = (struct trust_anchor*)elem;
119 if(!ta) return;
120 if(ta->autr) {
121 autr_point_delete(ta);
124 lock_basic_destroy(&ta->lock);
125 free(ta->name);
126 p = ta->keylist;
133 assembled_rrset_delete(ta->ds_rrset);
134 assembled_rrset_delete(ta->dnskey_rrset);
135 free(ta);
227 struct trust_anchor* ta = (struct trust_anchor*)malloc(
229 if(!ta)
231 memset(ta, 0, sizeof(*ta));
232 ta->node.key = ta;
233 ta->name = memdup(name, namelen);
234 if(!ta->name) {
235 free(ta);
238 ta->namelabs = namelabs;
239 ta->namelen = namelen;
240 ta->dclass = dclass;
241 lock_basic_init(&ta->lock);
250 rbtree_insert(anchors->tree, &ta->node);
255 return ta;
260 anchor_find_key(struct trust_anchor* ta, uint8_t* rdata, size_t rdata_len,
264 for(k = ta->keylist; k; k = k->next) {
308 struct trust_anchor* ta;
317 ta = anchor_find(anchors, name, namelabs, namelen, dclass);
318 if(!ta) {
319 ta = anchor_new_ta(anchors, name, namelabs, namelen, dclass, 1);
320 if(!ta)
322 lock_basic_lock(&ta->lock);
325 lock_basic_unlock(&ta->lock);
326 return ta;
329 if(anchor_find_key(ta, rdata, rdata_len, type)) {
330 lock_basic_unlock(&ta->lock);
331 return ta;
335 lock_basic_unlock(&ta->lock);
340 ta->numDS++;
341 else ta->numDNSKEY++;
342 k->next = ta->keylist;
343 ta->keylist = k;
344 lock_basic_unlock(&ta->lock);
345 return ta;
360 struct trust_anchor* ta;
361 if(!(ta=anchor_store_new_key(anchors, rr,
371 return ta;
383 struct trust_anchor* ta;
390 ta = anchor_store_new_key(anchors, nm, LDNS_RR_TYPE_DS,
393 return ta;
400 struct trust_anchor* ta;
411 if(!(ta=anchor_store_new_rr(anchors, rr, len, dname_len))) {
415 return ta;
430 struct trust_anchor* ta = NULL, *tanew;
467 if(onlyone && ta && ta != tanew) {
475 ta = tanew;
480 if(!onlyone && !ta) return (struct trust_anchor*)1;
481 return ta;
850 * @param ta: trust anchor.
856 assemble_it(struct trust_anchor* ta, size_t num, uint16_t type)
866 pkey->rk.dname = memdup(ta->name, ta->namelen);
872 pkey->rk.dname_len = ta->namelen;
874 pkey->rk.rrset_class = htons(ta->dclass);
912 for(tk = ta->keylist; tk; tk = tk->next) {
927 * @param ta: trust anchor
931 anchors_assemble(struct trust_anchor* ta)
933 if(ta->numDS > 0) {
934 ta->ds_rrset = assemble_it(ta, ta->numDS, LDNS_RR_TYPE_DS);
935 if(!ta->ds_rrset)
938 if(ta->numDNSKEY > 0) {
939 ta->dnskey_rrset = assemble_it(ta, ta->numDNSKEY,
941 if(!ta->dnskey_rrset)
949 * @param ta: trust anchor
953 anchors_ds_unsupported(struct trust_anchor* ta)
956 for(i=0; i<ta->numDS; i++) {
957 if(!ds_digest_algo_is_supported(ta->ds_rrset, i) ||
958 !ds_key_algo_is_supported(ta->ds_rrset, i))
966 * @param ta: trust anchor
970 anchors_dnskey_unsupported(struct trust_anchor* ta)
973 for(i=0; i<ta->numDNSKEY; i++) {
974 if(!dnskey_algo_is_supported(ta->dnskey_rrset, i))
988 struct trust_anchor* ta;
992 ta=(struct trust_anchor*)rbtree_first(anchors->tree);
993 while((rbnode_type*)ta != RBTREE_NULL) {
994 next = (struct trust_anchor*)rbtree_next(&ta->node);
995 lock_basic_lock(&ta->lock);
996 if(ta->autr || (ta->numDS == 0 && ta->numDNSKEY == 0)) {
997 lock_basic_unlock(&ta->lock);
998 ta = next; /* skip */
1001 if(!anchors_assemble(ta)) {
1003 lock_basic_unlock(&ta->lock);
1007 nods = anchors_ds_unsupported(ta);
1008 nokey = anchors_dnskey_unsupported(ta);
1012 ta->name, LDNS_RR_TYPE_DS, ta->dclass);
1017 ta->name, LDNS_RR_TYPE_DNSKEY, ta->dclass);
1019 if(nods == ta->numDS && nokey == ta->numDNSKEY) {
1021 dname_str(ta->name, b);
1031 (void)rbtree_delete(anchors->tree, &ta->node);
1032 lock_basic_unlock(&ta->lock);
1033 anchors_delfunc(&ta->node, NULL);
1034 ta = next;
1037 lock_basic_unlock(&ta->lock);
1038 ta = next;
1171 struct trust_anchor *ta;
1175 RBTREE_FOR(ta, struct trust_anchor*, anchors->tree) {
1176 s += sizeof(*ta) + ta->namelen;
1201 /* no other contents in new ta, because it is insecure point */
1212 struct trust_anchor* ta;
1218 if(!(ta=(struct trust_anchor*)rbtree_search(anchors->tree, &key))) {
1224 lock_basic_lock(&ta->lock);
1226 if(ta->keylist || ta->autr || ta->numDS || ta->numDNSKEY) {
1228 lock_basic_unlock(&ta->lock);
1234 (void)rbtree_delete(anchors->tree, &ta->node);
1239 lock_basic_unlock(&ta->lock);
1240 anchors_delfunc(&ta->node, NULL);
1255 anchor_list_keytags(struct trust_anchor* ta, uint16_t* list, size_t num)
1258 if(ta->numDS == 0 && ta->numDNSKEY == 0)
1260 if(ta->numDS != 0 && ta->ds_rrset) {
1262 ta->ds_rrset->entry.data;
1265 list[ret++] = ds_get_keytag(ta->ds_rrset, i);
1268 if(ta->numDNSKEY != 0 && ta->dnskey_rrset) {
1270 ta->dnskey_rrset->entry.data;
1273 list[ret++] = dnskey_calc_keytag(ta->dnskey_rrset, i);