FreeBSD/sys/netinet/sctp_auth.c
/*-
 * HMAC algos are listed in priority/preference order
 * find the best HMAC id to use for the peer based on local support
 */
HMAC algos are listed in priority/preference order
find the best HMAC id to use for the peer based on local support
HMAC algos are listed in priority / preference order find the best HMAC id to use for the peer based on local support
uint16_t
sctp_negotiate_hmacid(sctp_hmaclist_t * peer, sctp_hmaclist_t * local)
{
	int i, j;
	if ((local == NULL) || (peer == NULL))
		return (SCTP_AUTH_HMAC_ID_RSVD);
	for (i = 0; i < peer->num_algo; i++) {
		for (j = 0; j < local->num_algo; j++) {
			if (peer->hmac[i] == local->hmac[j]) {
				SCTPDBG(SCTP_DEBUG_AUTH1,
				    "SCTP: negotiated peer HMAC id %u\n",
				    peer->hmac[i]);
				return (peer->hmac[i]);
			}
		}
	}
	return (SCTP_AUTH_HMAC_ID_RSVD);
}
uint16_t sctp_negotiate_hmacid ( sctp_hmaclist_t * peer , sctp_hmaclist_t * local ) { int i , j ; if ( ( local == NULL ) || ( peer == NULL ) ) return ( SCTP_AUTH_HMAC_ID_RSVD ) ; for ( i = 0 ; i < peer -> num_algo ; i ++ ) { for ( j = 0 ; j < local -> num_algo ; j ++ ) { if ( peer -> hmac [ i ] == local -> hmac [ j ] ) { SCTPDBG ( SCTP_DEBUG_AUTH1 , " \n " , peer -> hmac [ i ] ) ; return ( peer -> hmac [ i ] ) ; } } } return ( SCTP_AUTH_HMAC_ID_RSVD ) ; }
HMAC algos are listed in priority/preference order
 find the best HMAC id to use for the peer based on local support
HMAC algos are listed in priority / preference order find the best HMAC id to use for the peer based on local support
/* found the "best" one */ /* didn't find one! */