FreeBSD/sys/netinet/sctp_auth.c
/*-
 * delete a shared key from an association
 * ASSUMES TCB_LOCK is already held
 */
delete a shared key from an association
ASSUMES TCB_LOCK is already held
delete a shared key from an association ASSUMES TCB_LOCK is already held
int
sctp_delete_sharedkey(struct sctp_tcb *stcb, uint16_t keyid)
{
	sctp_sharedkey_t *skey;
	if (stcb == NULL)
		return (-1);
	if (keyid == stcb->asoc.authinfo.active_keyid)
		return (-1);
	skey = sctp_find_sharedkey(&stcb->asoc.shared_keys, keyid);
	if (skey == NULL)
		return (-1);
	if (skey->refcount > 1)
		return (-1);
	LIST_REMOVE(skey, next);
	sctp_free_sharedkey(skey);	
	sctp_clear_cachedkeys(stcb, keyid);
	return (0);
}
int sctp_delete_sharedkey ( struct sctp_tcb * stcb , uint16_t keyid ) { sctp_sharedkey_t * skey ; if ( stcb == NULL ) return ( -1 ) ; if ( keyid == stcb -> asoc . authinfo . active_keyid ) return ( -1 ) ; skey = sctp_find_sharedkey ( & stcb -> asoc . shared_keys , keyid ) ; if ( skey == NULL ) return ( -1 ) ; if ( skey -> refcount > 1 ) return ( -1 ) ; LIST_REMOVE ( skey , next ) ; sctp_free_sharedkey ( skey ) ; sctp_clear_cachedkeys ( stcb , keyid ) ; return ( 0 ) ; }
delete a shared key from an association
 ASSUMES TCB_LOCK is already held
delete a shared key from an association ASSUMES TCB_LOCK is already held
/* is the keyid the assoc active sending key */ /* does the key exist? */ /* are there other refcount holders on the key? */ /* remove it */ /* frees skey->key as well */ /* clear any cached keys */