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

Function sctp_auth_add_hmacid

freebsd/netinet/sctp_auth.c:655–681  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

653}
654
655int
656sctp_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
683sctp_hmaclist_t *
684sctp_copy_hmaclist(sctp_hmaclist_t *list)

Callers 4

sctp_setoptFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected