MCPcopy Create free account
hub / github.com/F-Stack/f-stack / sctp_negotiate_hmacid

Function sctp_negotiate_hmacid

freebsd/netinet/sctp_auth.c:721–742  ·  view source on GitHub ↗

- * HMAC algos are listed in priority/preference order * find the best HMAC id to use for the peer based on local support */

Source from the content-addressed store, hash-verified

719 * find the best HMAC id to use for the peer based on local support
720 */
721uint16_t
722sctp_negotiate_hmacid(sctp_hmaclist_t *peer, sctp_hmaclist_t *local)
723{
724 int i, j;
725
726 if ((local == NULL) || (peer == NULL))
727 return (SCTP_AUTH_HMAC_ID_RSVD);
728
729 for (i = 0; i < peer->num_algo; i++) {
730 for (j = 0; j < local->num_algo; j++) {
731 if (peer->hmac[i] == local->hmac[j]) {
732 /* found the "best" one */
733 SCTPDBG(SCTP_DEBUG_AUTH1,
734 "SCTP: negotiated peer HMAC id %u\n",
735 peer->hmac[i]);
736 return (peer->hmac[i]);
737 }
738 }
739 }
740 /* didn't find one! */
741 return (SCTP_AUTH_HMAC_ID_RSVD);
742}
743
744/*-
745 * serialize the HMAC algo list and return space used

Callers 2

sctp_process_init_ackFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected