| 505 | } |
| 506 | |
| 507 | srtp_err_status_t srtp_crypto_kernel_load_debug_module( |
| 508 | srtp_debug_module_t *new_dm) |
| 509 | { |
| 510 | srtp_kernel_debug_module_t *kdm, *new; |
| 511 | |
| 512 | /* defensive coding */ |
| 513 | if (new_dm == NULL || new_dm->name == NULL) { |
| 514 | return srtp_err_status_bad_param; |
| 515 | } |
| 516 | |
| 517 | /* walk down list, checking if this type is in the list already */ |
| 518 | kdm = crypto_kernel.debug_module_list; |
| 519 | while (kdm != NULL) { |
| 520 | if (strncmp(new_dm->name, kdm->mod->name, 64) == 0) { |
| 521 | return srtp_err_status_bad_param; |
| 522 | } |
| 523 | kdm = kdm->next; |
| 524 | } |
| 525 | |
| 526 | /* put new_dm at the head of the list */ |
| 527 | /* allocate memory */ |
| 528 | new = (srtp_kernel_debug_module_t *)srtp_crypto_alloc( |
| 529 | sizeof(srtp_kernel_debug_module_t)); |
| 530 | if (new == NULL) { |
| 531 | return srtp_err_status_alloc_fail; |
| 532 | } |
| 533 | |
| 534 | /* set fields */ |
| 535 | new->mod = new_dm; |
| 536 | new->next = crypto_kernel.debug_module_list; |
| 537 | |
| 538 | /* set head of list to new cipher type */ |
| 539 | crypto_kernel.debug_module_list = new; |
| 540 | |
| 541 | return srtp_err_status_ok; |
| 542 | } |
| 543 | |
| 544 | srtp_err_status_t srtp_crypto_kernel_set_debug_module(const char *name, int on) |
| 545 | { |
no test coverage detected