| 551 | } |
| 552 | |
| 553 | int JLSRTP::decryptVector(std::vector<unsigned char> &ciphertext_input, std::vector<unsigned char> &outvdata) |
| 554 | { |
| 555 | int retVal = 0; |
| 556 | |
| 557 | assert(!ciphertext_input.empty()); |
| 558 | if (!ciphertext_input.empty()) |
| 559 | { |
| 560 | switch (_active_crypto) |
| 561 | { |
| 562 | case PRIMARY_CRYPTO: |
| 563 | { |
| 564 | switch (_primary_crypto.cipher_algorithm) |
| 565 | { |
| 566 | case AES_CM_128: |
| 567 | { |
| 568 | outvdata.resize(ciphertext_input.size()); |
| 569 | resetCipherBlockOffset(); |
| 570 | resetCipherOutputBlock(); |
| 571 | resetCipherBlockCounter(); |
| 572 | AES_ctr128_session_EVPencrypt(ciphertext_input.data(), outvdata.data(), ciphertext_input.size(), _cipherstate.ivec, _cipherstate.ecount, &_cipherstate.num); |
| 573 | retVal = 0; |
| 574 | } |
| 575 | break; |
| 576 | |
| 577 | case NULL_CIPHER: |
| 578 | { |
| 579 | outvdata = ciphertext_input; |
| 580 | retVal = 0; |
| 581 | } |
| 582 | break; |
| 583 | |
| 584 | default: |
| 585 | { |
| 586 | retVal = -3; |
| 587 | } |
| 588 | break; |
| 589 | } |
| 590 | } |
| 591 | break; |
| 592 | |
| 593 | case SECONDARY_CRYPTO: |
| 594 | { |
| 595 | switch (_secondary_crypto.cipher_algorithm) |
| 596 | { |
| 597 | case AES_CM_128: |
| 598 | { |
| 599 | outvdata.resize(ciphertext_input.size()); |
| 600 | resetCipherBlockOffset(); |
| 601 | resetCipherOutputBlock(); |
| 602 | resetCipherBlockCounter(); |
| 603 | AES_ctr128_session_EVPencrypt(ciphertext_input.data(), outvdata.data(), ciphertext_input.size(), _cipherstate.ivec, _cipherstate.ecount, &_cipherstate.num); |
| 604 | retVal = 0; |
| 605 | } |
| 606 | break; |
| 607 | |
| 608 | case NULL_CIPHER: |
| 609 | { |
| 610 | outvdata = ciphertext_input; |