| 206 | } |
| 207 | |
| 208 | int |
| 209 | sctp_unpack_auth_chunks(const uint8_t *ptr, uint8_t num_chunks, |
| 210 | sctp_auth_chklist_t *list) |
| 211 | { |
| 212 | int i; |
| 213 | int size; |
| 214 | |
| 215 | if (list == NULL) |
| 216 | return (0); |
| 217 | |
| 218 | if (num_chunks <= 32) { |
| 219 | /* just pull them, one byte each */ |
| 220 | for (i = 0; i < num_chunks; i++) { |
| 221 | (void)sctp_auth_add_chunk(*ptr++, list); |
| 222 | } |
| 223 | size = num_chunks; |
| 224 | } else { |
| 225 | int index, offset; |
| 226 | |
| 227 | /* unpack from a 32 byte bitfield */ |
| 228 | for (index = 0; index < 32; index++) { |
| 229 | for (offset = 0; offset < 8; offset++) { |
| 230 | if (ptr[index] & (1 << offset)) { |
| 231 | (void)sctp_auth_add_chunk((index * 8) + offset, list); |
| 232 | } |
| 233 | } |
| 234 | } |
| 235 | size = 32; |
| 236 | } |
| 237 | return (size); |
| 238 | } |
| 239 | |
| 240 | /* |
| 241 | * allocate structure space for a key of length keylen |
nothing calls this directly
no test coverage detected