| 653 | } |
| 654 | |
| 655 | int |
| 656 | sctp_auth_add_hmacid(sctp_hmaclist_t *list, uint16_t hmac_id) |
| 657 | { |
| 658 | int i; |
| 659 | |
| 660 | if (list == NULL) |
| 661 | return (-1); |
| 662 | if (list->num_algo == list->max_algo) { |
| 663 | SCTPDBG(SCTP_DEBUG_AUTH1, |
| 664 | "SCTP: HMAC id list full, ignoring add %u\n", hmac_id); |
| 665 | return (-1); |
| 666 | } |
| 667 | if ((hmac_id != SCTP_AUTH_HMAC_ID_SHA1) && |
| 668 | (hmac_id != SCTP_AUTH_HMAC_ID_SHA256)) { |
| 669 | return (-1); |
| 670 | } |
| 671 | /* Now is it already in the list */ |
| 672 | for (i = 0; i < list->num_algo; i++) { |
| 673 | if (list->hmac[i] == hmac_id) { |
| 674 | /* already in list */ |
| 675 | return (-1); |
| 676 | } |
| 677 | } |
| 678 | SCTPDBG(SCTP_DEBUG_AUTH1, "SCTP: add HMAC id %u to list\n", hmac_id); |
| 679 | list->hmac[list->num_algo++] = hmac_id; |
| 680 | return (0); |
| 681 | } |
| 682 | |
| 683 | sctp_hmaclist_t * |
| 684 | sctp_copy_hmaclist(sctp_hmaclist_t *list) |
no outgoing calls
no test coverage detected