| 561 | } |
| 562 | |
| 563 | void |
| 564 | sctp_auth_key_release(struct sctp_tcb *stcb, uint16_t key_id, int so_locked) |
| 565 | { |
| 566 | sctp_sharedkey_t *skey; |
| 567 | |
| 568 | /* find the shared key */ |
| 569 | skey = sctp_find_sharedkey(&stcb->asoc.shared_keys, key_id); |
| 570 | |
| 571 | /* decrement the ref count */ |
| 572 | if (skey) { |
| 573 | SCTPDBG(SCTP_DEBUG_AUTH2, |
| 574 | "%s: stcb %p key %u refcount release to %d\n", |
| 575 | __func__, (void *)stcb, key_id, skey->refcount); |
| 576 | |
| 577 | /* see if a notification should be generated */ |
| 578 | if ((skey->refcount <= 2) && (skey->deactivated)) { |
| 579 | /* notify ULP that key is no longer used */ |
| 580 | sctp_ulp_notify(SCTP_NOTIFY_AUTH_FREE_KEY, stcb, |
| 581 | key_id, 0, so_locked); |
| 582 | SCTPDBG(SCTP_DEBUG_AUTH2, |
| 583 | "%s: stcb %p key %u no longer used, %d\n", |
| 584 | __func__, (void *)stcb, key_id, skey->refcount); |
| 585 | } |
| 586 | sctp_free_sharedkey(skey); |
| 587 | } |
| 588 | } |
| 589 | |
| 590 | static sctp_sharedkey_t * |
| 591 | sctp_copy_sharedkey(const sctp_sharedkey_t *skey) |
no test coverage detected