- * HMAC algos are listed in priority/preference order * find the best HMAC id to use for the peer based on local support */
| 719 | * find the best HMAC id to use for the peer based on local support |
| 720 | */ |
| 721 | uint16_t |
| 722 | sctp_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 |
no outgoing calls
no test coverage detected