Lines Matching refs:skey
472 sctp_free_sharedkey(sctp_sharedkey_t *skey) in sctp_free_sharedkey() argument
474 if (skey == NULL) in sctp_free_sharedkey()
477 if (SCTP_DECREMENT_AND_CHECK_REFCOUNT(&skey->refcount)) { in sctp_free_sharedkey()
478 if (skey->key != NULL) in sctp_free_sharedkey()
479 sctp_free_key(skey->key); in sctp_free_sharedkey()
480 SCTP_FREE(skey, SCTP_M_AUTH_KY); in sctp_free_sharedkey()
487 sctp_sharedkey_t *skey; in sctp_find_sharedkey() local
489 LIST_FOREACH(skey, shared_keys, next) { in sctp_find_sharedkey()
490 if (skey->keyid == key_id) in sctp_find_sharedkey()
491 return (skey); in sctp_find_sharedkey()
500 sctp_sharedkey_t *skey; in sctp_insert_sharedkey() local
511 LIST_FOREACH(skey, shared_keys, next) { in sctp_insert_sharedkey()
512 if (new_skey->keyid < skey->keyid) { in sctp_insert_sharedkey()
514 LIST_INSERT_BEFORE(skey, new_skey, next); in sctp_insert_sharedkey()
516 } else if (new_skey->keyid == skey->keyid) { in sctp_insert_sharedkey()
519 if ((skey->deactivated) || (skey->refcount > 1)) { in sctp_insert_sharedkey()
528 LIST_INSERT_BEFORE(skey, new_skey, next); in sctp_insert_sharedkey()
529 LIST_REMOVE(skey, next); in sctp_insert_sharedkey()
530 sctp_free_sharedkey(skey); in sctp_insert_sharedkey()
533 if (LIST_NEXT(skey, next) == NULL) { in sctp_insert_sharedkey()
535 LIST_INSERT_AFTER(skey, new_skey, next); in sctp_insert_sharedkey()
546 sctp_sharedkey_t *skey; in sctp_auth_key_acquire() local
549 skey = sctp_find_sharedkey(&stcb->asoc.shared_keys, key_id); in sctp_auth_key_acquire()
552 if (skey) { in sctp_auth_key_acquire()
553 atomic_add_int(&skey->refcount, 1); in sctp_auth_key_acquire()
556 __func__, (void *)stcb, key_id, skey->refcount); in sctp_auth_key_acquire()
563 sctp_sharedkey_t *skey; in sctp_auth_key_release() local
566 skey = sctp_find_sharedkey(&stcb->asoc.shared_keys, key_id); in sctp_auth_key_release()
569 if (skey) { in sctp_auth_key_release()
572 __func__, (void *)stcb, key_id, skey->refcount); in sctp_auth_key_release()
575 if ((skey->refcount <= 2) && (skey->deactivated)) { in sctp_auth_key_release()
581 __func__, (void *)stcb, key_id, skey->refcount); in sctp_auth_key_release()
583 sctp_free_sharedkey(skey); in sctp_auth_key_release()
588 sctp_copy_sharedkey(const sctp_sharedkey_t *skey) in sctp_copy_sharedkey() argument
592 if (skey == NULL) in sctp_copy_sharedkey()
597 if (skey->key != NULL) in sctp_copy_sharedkey()
598 new_skey->key = sctp_set_key(skey->key->key, skey->key->keylen); in sctp_copy_sharedkey()
601 new_skey->keyid = skey->keyid; in sctp_copy_sharedkey()
608 sctp_sharedkey_t *skey, *new_skey; in sctp_copy_skeylist() local
613 LIST_FOREACH(skey, src, next) { in sctp_copy_skeylist()
614 new_skey = sctp_copy_sharedkey(skey); in sctp_copy_skeylist()
1185 sctp_sharedkey_t *skey; in sctp_delete_sharedkey() local
1195 skey = sctp_find_sharedkey(&stcb->asoc.shared_keys, keyid); in sctp_delete_sharedkey()
1196 if (skey == NULL) in sctp_delete_sharedkey()
1200 if (skey->refcount > 1) in sctp_delete_sharedkey()
1204 LIST_REMOVE(skey, next); in sctp_delete_sharedkey()
1205 sctp_free_sharedkey(skey); /* frees skey->key as well */ in sctp_delete_sharedkey()
1219 sctp_sharedkey_t *skey; in sctp_delete_sharedkey_ep() local
1229 skey = sctp_find_sharedkey(&inp->sctp_ep.shared_keys, keyid); in sctp_delete_sharedkey_ep()
1230 if (skey == NULL) in sctp_delete_sharedkey_ep()
1236 LIST_REMOVE(skey, next); in sctp_delete_sharedkey_ep()
1237 sctp_free_sharedkey(skey); /* frees skey->key as well */ in sctp_delete_sharedkey_ep()
1251 sctp_sharedkey_t *skey = NULL; in sctp_auth_setactivekey() local
1254 skey = sctp_find_sharedkey(&stcb->asoc.shared_keys, keyid); in sctp_auth_setactivekey()
1255 if (skey == NULL) { in sctp_auth_setactivekey()
1259 if ((skey->deactivated) && (skey->refcount > 1)) { in sctp_auth_setactivekey()
1267 skey->deactivated = 0; in sctp_auth_setactivekey()
1279 sctp_sharedkey_t *skey; in sctp_auth_setactivekey_ep() local
1282 skey = sctp_find_sharedkey(&inp->sctp_ep.shared_keys, keyid); in sctp_auth_setactivekey_ep()
1283 if (skey == NULL) { in sctp_auth_setactivekey_ep()
1298 sctp_sharedkey_t *skey; in sctp_deact_sharedkey() local
1308 skey = sctp_find_sharedkey(&stcb->asoc.shared_keys, keyid); in sctp_deact_sharedkey()
1309 if (skey == NULL) in sctp_deact_sharedkey()
1313 if (skey->refcount == 1) { in sctp_deact_sharedkey()
1320 skey->deactivated = 1; in sctp_deact_sharedkey()
1332 sctp_sharedkey_t *skey; in sctp_deact_sharedkey_ep() local
1342 skey = sctp_find_sharedkey(&inp->sctp_ep.shared_keys, keyid); in sctp_deact_sharedkey_ep()
1343 if (skey == NULL) in sctp_deact_sharedkey_ep()
1349 LIST_REMOVE(skey, next); in sctp_deact_sharedkey_ep()
1350 sctp_free_sharedkey(skey); /* frees skey->key as well */ in sctp_deact_sharedkey_ep()
1503 sctp_sharedkey_t *skey; in sctp_fill_hmac_digest_m() local
1520 skey = sctp_find_sharedkey(&stcb->asoc.shared_keys, keyid); in sctp_fill_hmac_digest_m()
1522 if (skey != NULL) in sctp_fill_hmac_digest_m()
1523 key = skey->key; in sctp_fill_hmac_digest_m()
1593 sctp_sharedkey_t *skey; in sctp_handle_auth() local
1646 skey = sctp_find_sharedkey(&stcb->asoc.shared_keys, in sctp_handle_auth()
1649 if (skey == NULL) { in sctp_handle_auth()
1666 stcb->asoc.authinfo.peer_random, skey->key); in sctp_handle_auth()