Lines Matching defs:tkey

176 remove_fromring(dns_tsigkey_t *tkey) {
177 if (tkey->generated) {
178 ISC_LIST_UNLINK(tkey->ring->lru, tkey, link);
179 tkey->ring->generated--;
181 (void)dns_rbt_deletename(tkey->ring->keys, &tkey->name, ISC_FALSE);
185 adjust_lru(dns_tsigkey_t *tkey) {
186 if (tkey->generated) {
187 RWLOCK(&tkey->ring->lock, isc_rwlocktype_write);
192 if (ISC_LINK_LINKED(tkey, link) &&
193 tkey->ring->lru.tail != tkey)
195 ISC_LIST_UNLINK(tkey->ring->lru, tkey, link);
196 ISC_LIST_APPEND(tkey->ring->lru, tkey, link);
198 RWUNLOCK(&tkey->ring->lock, isc_rwlocktype_write);
211 dns_tsigkey_t *tkey)
227 result = dns_rbt_addname(ring->keys, name, tkey);
228 if (result == ISC_R_SUCCESS && tkey->generated) {
233 ISC_LIST_APPEND(ring->lru, tkey, link);
249 dns_tsigkey_t *tkey;
259 tkey = (dns_tsigkey_t *) isc_mem_get(mctx, sizeof(dns_tsigkey_t));
260 if (tkey == NULL)
263 dns_name_init(&tkey->name, NULL);
264 ret = dns_name_dup(name, mctx, &tkey->name);
267 (void)dns_name_downcase(&tkey->name, &tkey->name, NULL);
271 tkey->algorithm = DNS_TSIG_HMACMD5_NAME;
279 tkey->algorithm = DNS_TSIG_HMACSHA1_NAME;
285 tkey->algorithm = DNS_TSIG_HMACSHA224_NAME;
292 tkey->algorithm = DNS_TSIG_HMACSHA256_NAME;
299 tkey->algorithm = DNS_TSIG_HMACSHA384_NAME;
306 tkey->algorithm = DNS_TSIG_HMACSHA512_NAME;
313 tkey->algorithm = DNS_TSIG_GSSAPI_NAME;
319 tkey->algorithm = DNS_TSIG_GSSAPIMS_NAME;
329 tkey->algorithm = isc_mem_get(mctx, sizeof(dns_name_t));
330 if (tkey->algorithm == NULL) {
334 dns_name_init(tkey->algorithm, NULL);
335 ret = dns_name_dup(algorithm, mctx, tkey->algorithm);
338 (void)dns_name_downcase(tkey->algorithm, tkey->algorithm,
343 tkey->creator = isc_mem_get(mctx, sizeof(dns_name_t));
344 if (tkey->creator == NULL) {
348 dns_name_init(tkey->creator, NULL);
349 ret = dns_name_dup(creator, mctx, tkey->creator);
351 isc_mem_put(mctx, tkey->creator, sizeof(dns_name_t));
355 tkey->creator = NULL;
357 tkey->key = NULL;
359 dst_key_attach(dstkey, &tkey->key);
360 tkey->ring = ring;
366 ret = isc_refcount_init(&tkey->refs, refs);
370 tkey->generated = generated;
371 tkey->inception = inception;
372 tkey->expire = expire;
373 tkey->mctx = NULL;
374 isc_mem_attach(mctx, &tkey->mctx);
375 ISC_LINK_INIT(tkey, link);
377 tkey->magic = TSIG_MAGIC;
380 ret = keyring_add(ring, name, tkey);
400 *key = tkey;
405 tkey->magic = 0;
407 isc_refcount_decrement(&tkey->refs, NULL);
408 isc_refcount_destroy(&tkey->refs);
410 if (tkey->key != NULL)
411 dst_key_free(&tkey->key);
412 if (tkey->creator != NULL) {
413 dns_name_free(tkey->creator, mctx);
414 isc_mem_put(mctx, tkey->creator, sizeof(dns_name_t));
417 if (algname_is_allocated(tkey->algorithm)) {
418 if (dns_name_dynamic(tkey->algorithm))
419 dns_name_free(tkey->algorithm, mctx);
420 isc_mem_put(mctx, tkey->algorithm, sizeof(dns_name_t));
423 dns_name_free(&tkey->name, mctx);
425 isc_mem_put(mctx, tkey, sizeof(dns_tsigkey_t));
443 dns_tsigkey_t *tkey;
465 tkey = node->data;
466 if (tkey != NULL) {
467 if (tkey->generated
468 && isc_refcount_current(&tkey->refs) == 1
469 && tkey->inception != tkey->expire
470 && tkey->expire < now) {
471 tsig_log(tkey, 2, "tsig expire: deleting");
474 remove_fromring(tkey);
587 dump_key(dns_tsigkey_t *tkey, FILE *fp) {
595 REQUIRE(tkey != NULL);
598 dns_name_format(&tkey->name, namestr, sizeof(namestr));
599 dns_name_format(tkey->creator, creatorstr, sizeof(creatorstr));
600 dns_name_format(tkey->algorithm, algorithmstr, sizeof(algorithmstr));
601 result = dst_key_dump(tkey->key, tkey->mctx, &buffer, &length);
604 tkey->inception, tkey->expire, algorithmstr,
607 isc_mem_put(tkey->mctx, buffer, length);
619 dns_tsigkey_t *tkey;
652 tkey = node->data;
653 if (tkey != NULL && tkey->generated && tkey->expire >= now)
654 dump_key(tkey, fp);
1959 dns_tsigkey_t *tkey)
1963 result = keyring_add(ring, name, tkey);
1965 isc_refcount_increment(&tkey->refs, NULL);