Lines Matching refs:stcb

544 sctp_auth_key_acquire(struct sctp_tcb *stcb, uint16_t key_id)  in sctp_auth_key_acquire()  argument
549 skey = sctp_find_sharedkey(&stcb->asoc.shared_keys, key_id); in sctp_auth_key_acquire()
556 __func__, (void *)stcb, key_id, skey->refcount); in sctp_auth_key_acquire()
561 sctp_auth_key_release(struct sctp_tcb *stcb, uint16_t key_id, int so_locked) in sctp_auth_key_release() argument
566 skey = sctp_find_sharedkey(&stcb->asoc.shared_keys, key_id); in sctp_auth_key_release()
572 __func__, (void *)stcb, key_id, skey->refcount); in sctp_auth_key_release()
577 sctp_ulp_notify(SCTP_NOTIFY_AUTH_FREE_KEY, stcb, in sctp_auth_key_release()
581 __func__, (void *)stcb, key_id, skey->refcount); in sctp_auth_key_release()
1142 sctp_clear_cachedkeys(struct sctp_tcb *stcb, uint16_t keyid) in sctp_clear_cachedkeys() argument
1144 if (stcb == NULL) in sctp_clear_cachedkeys()
1147 if (keyid == stcb->asoc.authinfo.assoc_keyid) { in sctp_clear_cachedkeys()
1148 sctp_free_key(stcb->asoc.authinfo.assoc_key); in sctp_clear_cachedkeys()
1149 stcb->asoc.authinfo.assoc_key = NULL; in sctp_clear_cachedkeys()
1151 if (keyid == stcb->asoc.authinfo.recv_keyid) { in sctp_clear_cachedkeys()
1152 sctp_free_key(stcb->asoc.authinfo.recv_key); in sctp_clear_cachedkeys()
1153 stcb->asoc.authinfo.recv_key = NULL; in sctp_clear_cachedkeys()
1165 struct sctp_tcb *stcb; in sctp_clear_cachedkeys_ep() local
1171 LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) { in sctp_clear_cachedkeys_ep()
1172 SCTP_TCB_LOCK(stcb); in sctp_clear_cachedkeys_ep()
1173 sctp_clear_cachedkeys(stcb, keyid); in sctp_clear_cachedkeys_ep()
1174 SCTP_TCB_UNLOCK(stcb); in sctp_clear_cachedkeys_ep()
1183 sctp_delete_sharedkey(struct sctp_tcb *stcb, uint16_t keyid) in sctp_delete_sharedkey() argument
1187 if (stcb == NULL) in sctp_delete_sharedkey()
1191 if (keyid == stcb->asoc.authinfo.active_keyid) in sctp_delete_sharedkey()
1195 skey = sctp_find_sharedkey(&stcb->asoc.shared_keys, keyid); in sctp_delete_sharedkey()
1208 sctp_clear_cachedkeys(stcb, keyid); in sctp_delete_sharedkey()
1249 sctp_auth_setactivekey(struct sctp_tcb *stcb, uint16_t keyid) in sctp_auth_setactivekey() argument
1254 skey = sctp_find_sharedkey(&stcb->asoc.shared_keys, keyid); in sctp_auth_setactivekey()
1265 stcb->asoc.authinfo.active_keyid = keyid; in sctp_auth_setactivekey()
1296 sctp_deact_sharedkey(struct sctp_tcb *stcb, uint16_t keyid) in sctp_deact_sharedkey() argument
1300 if (stcb == NULL) in sctp_deact_sharedkey()
1304 if (keyid == stcb->asoc.authinfo.active_keyid) in sctp_deact_sharedkey()
1308 skey = sctp_find_sharedkey(&stcb->asoc.shared_keys, keyid); in sctp_deact_sharedkey()
1315 sctp_ulp_notify(SCTP_NOTIFY_AUTH_FREE_KEY, stcb, 0, &keyid, in sctp_deact_sharedkey()
1359 sctp_auth_get_cookie_params(struct sctp_tcb *stcb, struct mbuf *m, in sctp_auth_get_cookie_params() argument
1413 if (stcb->asoc.local_hmacs != NULL) in sctp_auth_get_cookie_params()
1414 sctp_free_hmaclist(stcb->asoc.local_hmacs); in sctp_auth_get_cookie_params()
1415 stcb->asoc.local_hmacs = sctp_alloc_hmaclist(num_hmacs); in sctp_auth_get_cookie_params()
1416 if (stcb->asoc.local_hmacs != NULL) { in sctp_auth_get_cookie_params()
1418 (void)sctp_auth_add_hmacid(stcb->asoc.local_hmacs, in sctp_auth_get_cookie_params()
1434 if (stcb->asoc.local_auth_chunks != NULL) in sctp_auth_get_cookie_params()
1435 sctp_clear_chunklist(stcb->asoc.local_auth_chunks); in sctp_auth_get_cookie_params()
1437 stcb->asoc.local_auth_chunks = sctp_alloc_chunklist(); in sctp_auth_get_cookie_params()
1440 stcb->asoc.local_auth_chunks); in sctp_auth_get_cookie_params()
1476 if (stcb->asoc.authinfo.random != NULL) in sctp_auth_get_cookie_params()
1477 sctp_free_key(stcb->asoc.authinfo.random); in sctp_auth_get_cookie_params()
1478 stcb->asoc.authinfo.random = new_key; in sctp_auth_get_cookie_params()
1479 stcb->asoc.authinfo.random_len = random_len; in sctp_auth_get_cookie_params()
1480 sctp_clear_cachedkeys(stcb, stcb->asoc.authinfo.assoc_keyid); in sctp_auth_get_cookie_params()
1481 sctp_clear_cachedkeys(stcb, stcb->asoc.authinfo.recv_keyid); in sctp_auth_get_cookie_params()
1484 stcb->asoc.peer_hmac_id = sctp_negotiate_hmacid(stcb->asoc.peer_hmacs, in sctp_auth_get_cookie_params()
1485 stcb->asoc.local_hmacs); in sctp_auth_get_cookie_params()
1489 stcb->asoc.authinfo.active_keyid = stcb->sctp_ep->sctp_ep.default_keyid; in sctp_auth_get_cookie_params()
1491 (void)sctp_copy_skeylist(&stcb->sctp_ep->sctp_ep.shared_keys, in sctp_auth_get_cookie_params()
1492 &stcb->asoc.shared_keys); in sctp_auth_get_cookie_params()
1500 struct sctp_auth_chunk *auth, struct sctp_tcb *stcb, uint16_t keyid) in sctp_fill_hmac_digest_m() argument
1506 if ((stcb == NULL) || (auth == NULL)) in sctp_fill_hmac_digest_m()
1510 digestlen = sctp_get_hmac_digest_len(stcb->asoc.peer_hmac_id); in sctp_fill_hmac_digest_m()
1514 if ((keyid != stcb->asoc.authinfo.assoc_keyid) || in sctp_fill_hmac_digest_m()
1515 (stcb->asoc.authinfo.assoc_key == NULL)) { in sctp_fill_hmac_digest_m()
1516 if (stcb->asoc.authinfo.assoc_key != NULL) { in sctp_fill_hmac_digest_m()
1518 sctp_free_key(stcb->asoc.authinfo.assoc_key); in sctp_fill_hmac_digest_m()
1520 skey = sctp_find_sharedkey(&stcb->asoc.shared_keys, keyid); in sctp_fill_hmac_digest_m()
1527 stcb->asoc.authinfo.assoc_key = in sctp_fill_hmac_digest_m()
1528 sctp_compute_hashkey(stcb->asoc.authinfo.random, in sctp_fill_hmac_digest_m()
1529 stcb->asoc.authinfo.peer_random, key); in sctp_fill_hmac_digest_m()
1530 stcb->asoc.authinfo.assoc_keyid = keyid; in sctp_fill_hmac_digest_m()
1532 stcb->asoc.authinfo.assoc_keyid); in sctp_fill_hmac_digest_m()
1535 sctp_print_key(stcb->asoc.authinfo.assoc_key, in sctp_fill_hmac_digest_m()
1544 (void)sctp_compute_hmac_m(stcb->asoc.peer_hmac_id, stcb->asoc.authinfo.assoc_key, in sctp_fill_hmac_digest_m()
1587 sctp_handle_auth(struct sctp_tcb *stcb, struct sctp_auth_chunk *auth, in sctp_handle_auth() argument
1614 if (!sctp_auth_is_supported_hmac(stcb->asoc.local_hmacs, hmac_id)) { in sctp_handle_auth()
1638 sctp_queue_op_err(stcb, op_err); in sctp_handle_auth()
1643 if ((stcb->asoc.authinfo.recv_key == NULL) || in sctp_handle_auth()
1644 (stcb->asoc.authinfo.recv_keyid != shared_key_id)) { in sctp_handle_auth()
1646 skey = sctp_find_sharedkey(&stcb->asoc.shared_keys, in sctp_handle_auth()
1657 if (stcb->asoc.authinfo.recv_keyid != shared_key_id) { in sctp_handle_auth()
1658 sctp_ulp_notify(SCTP_NOTIFY_AUTH_NEW_KEY, stcb, 0, in sctp_handle_auth()
1662 if (stcb->asoc.authinfo.recv_key != NULL) in sctp_handle_auth()
1663 sctp_free_key(stcb->asoc.authinfo.recv_key); in sctp_handle_auth()
1664 stcb->asoc.authinfo.recv_key = in sctp_handle_auth()
1665 sctp_compute_hashkey(stcb->asoc.authinfo.random, in sctp_handle_auth()
1666 stcb->asoc.authinfo.peer_random, skey->key); in sctp_handle_auth()
1667 stcb->asoc.authinfo.recv_keyid = shared_key_id; in sctp_handle_auth()
1670 sctp_print_key(stcb->asoc.authinfo.recv_key, "Recv Key"); in sctp_handle_auth()
1685 (void)sctp_compute_hmac_m(hmac_id, stcb->asoc.authinfo.recv_key, in sctp_handle_auth()
1702 sctp_notify_authentication(struct sctp_tcb *stcb, uint32_t indication, in sctp_notify_authentication() argument
1709 KASSERT(stcb != NULL, ("stcb == NULL")); in sctp_notify_authentication()
1710 SCTP_TCB_LOCK_ASSERT(stcb); in sctp_notify_authentication()
1711 SCTP_INP_READ_LOCK_ASSERT(stcb->sctp_ep); in sctp_notify_authentication()
1713 if (sctp_stcb_is_feature_off(stcb->sctp_ep, stcb, SCTP_PCB_FLAGS_AUTHEVNT)) in sctp_notify_authentication()
1732 auth->auth_altkeynumber = stcb->asoc.authinfo.recv_keyid; in sctp_notify_authentication()
1737 auth->auth_assoc_id = sctp_get_associd(stcb); in sctp_notify_authentication()
1743 control = sctp_build_readq_entry(stcb, stcb->asoc.primary_destination, in sctp_notify_authentication()
1744 0, 0, stcb->asoc.context, 0, 0, 0, m_notify); in sctp_notify_authentication()
1754 sctp_add_to_readq(stcb->sctp_ep, stcb, control, in sctp_notify_authentication()
1755 &stcb->sctp_socket->so_rcv, 1, in sctp_notify_authentication()
1908 sctp_initialize_auth_params(struct sctp_inpcb *inp, struct sctp_tcb *stcb) in sctp_initialize_auth_params() argument
1917 stcb->asoc.local_hmacs = sctp_copy_hmaclist(inp->sctp_ep.local_hmacs); in sctp_initialize_auth_params()
1918 if (stcb->asoc.local_hmacs != NULL) { in sctp_initialize_auth_params()
1919 hmacs_len = stcb->asoc.local_hmacs->num_algo * in sctp_initialize_auth_params()
1920 sizeof(stcb->asoc.local_hmacs->hmac[0]); in sctp_initialize_auth_params()
1923 stcb->asoc.local_auth_chunks = in sctp_initialize_auth_params()
1925 if (stcb->asoc.local_auth_chunks != NULL) { in sctp_initialize_auth_params()
1929 if (stcb->asoc.local_auth_chunks->chunks[i]) in sctp_initialize_auth_params()
1934 stcb->asoc.authinfo.active_keyid = inp->sctp_ep.default_keyid; in sctp_initialize_auth_params()
1938 &stcb->asoc.shared_keys); in sctp_initialize_auth_params()
1964 if (stcb->asoc.local_auth_chunks) { in sctp_initialize_auth_params()
1968 if (stcb->asoc.local_auth_chunks->chunks[i]) in sctp_initialize_auth_params()
1979 (void)sctp_serialize_hmaclist(stcb->asoc.local_hmacs, in sctp_initialize_auth_params()
1982 if (stcb->asoc.authinfo.random != NULL) in sctp_initialize_auth_params()
1983 sctp_free_key(stcb->asoc.authinfo.random); in sctp_initialize_auth_params()
1984 stcb->asoc.authinfo.random = new_key; in sctp_initialize_auth_params()
1985 stcb->asoc.authinfo.random_len = random_len; in sctp_initialize_auth_params()