Lines Matching refs:tkey

161 	dns_tsigkey_t *tkey = node;
163 return dns_name_equal(tkey->name, key);
172 rm_hashmap(dns_tsigkey_t *tkey) {
173 REQUIRE(VALID_TSIGKEY(tkey));
174 REQUIRE(VALID_TSIGKEYRING(tkey->ring));
176 (void)isc_hashmap_delete(tkey->ring->keys, dns_name_hash(tkey->name),
177 match_ptr, tkey);
178 dns_tsigkey_detach(&tkey);
182 rm_lru(dns_tsigkey_t *tkey) {
183 REQUIRE(VALID_TSIGKEY(tkey));
184 REQUIRE(VALID_TSIGKEYRING(tkey->ring));
186 if (tkey->generated && ISC_LINK_LINKED(tkey, link)) {
187 ISC_LIST_UNLINK(tkey->ring->lru, tkey, link);
188 tkey->ring->generated--;
189 dns_tsigkey_unref(tkey);
194 adjust_lru(dns_tsigkey_t *tkey) {
195 if (tkey->generated) {
196 RWLOCK(&tkey->ring->lock, isc_rwlocktype_write);
201 if (ISC_LINK_LINKED(tkey, link) && tkey->ring->lru.tail != tkey)
203 ISC_LIST_UNLINK(tkey->ring->lru, tkey, link);
204 ISC_LIST_APPEND(tkey->ring->lru, tkey, link);
206 RWUNLOCK(&tkey->ring->lock, isc_rwlocktype_write);
238 dns_tsigkey_t *tkey = NULL;
245 tkey = isc_mem_get(mctx, sizeof(dns_tsigkey_t));
246 *tkey = (dns_tsigkey_t){
254 tkey->name = dns_fixedname_initname(&tkey->fn);
255 dns_name_copy(name, tkey->name);
256 (void)dns_name_downcase(tkey->name, tkey->name, NULL);
268 tkey->algorithm = namefromalg(algorithm);
271 tkey->creator = isc_mem_get(mctx, sizeof(dns_name_t));
272 dns_name_init(tkey->creator, NULL);
273 dns_name_dup(creator, mctx, tkey->creator);
277 dst_key_attach(dstkey, &tkey->key);
280 isc_refcount_init(&tkey->references, 1);
281 isc_mem_attach(mctx, &tkey->mctx);
297 tkey->magic = TSIG_MAGIC;
299 if (tkey->restored) {
300 tsig_log(tkey, ISC_LOG_DEBUG(3), "restored from file");
301 } else if (tkey->generated) {
302 tsig_log(tkey, ISC_LOG_DEBUG(3), "generated");
304 tsig_log(tkey, ISC_LOG_DEBUG(3), "statically configured");
307 SET_IF_NOT_NULL(keyp, tkey);
311 isc_mem_put(mctx, tkey, sizeof(dns_tsigkey_t));
326 dns_tsigkey_t *tkey = NULL;
327 isc_hashmap_iter_current(it, (void **)&tkey);
328 rm_lru(tkey);
329 dns_tsigkey_detach(&tkey);
375 dns_tsigkey_t *tkey = NULL;
428 ring->mctx, &tkey);
430 result = dns_tsigkeyring_add(ring, tkey);
432 dns_tsigkey_detach(&tkey);
440 dump_key(dns_tsigkey_t *tkey, FILE *fp) {
448 REQUIRE(tkey != NULL);
451 dns_name_format(tkey->name, namestr, sizeof(namestr));
452 dns_name_format(tkey->creator, creatorstr, sizeof(creatorstr));
453 dns_name_format(tkey->algorithm, algorithmstr, sizeof(algorithmstr));
454 result = dst_key_dump(tkey->key, tkey->mctx, &buffer, &length);
457 tkey->inception, tkey->expire, algorithmstr, length,
461 isc_mem_put(tkey->mctx, buffer, length);
479 dns_tsigkey_t *tkey = NULL;
480 isc_hashmap_iter_current(it, (void **)&tkey);
482 if (tkey->generated && tkey->expire >= now) {
483 dump_key(tkey, fp);
606 if (msg->tkey != 1) {
1608 dns_tsigkeyring_add(dns_tsigkeyring_t *ring, dns_tsigkey_t *tkey) {
1611 REQUIRE(VALID_TSIGKEY(tkey));
1613 REQUIRE(tkey->ring == NULL);
1616 result = isc_hashmap_add(ring->keys, dns_name_hash(tkey->name),
1617 tkey_match, tkey->name, tkey, NULL);
1619 dns_tsigkey_ref(tkey);
1620 tkey->ring = ring;
1628 if (tkey->generated) {
1629 ISC_LIST_APPEND(ring->lru, tkey, link);
1630 dns_tsigkey_ref(tkey);
1638 tkey->ring = ring;