MCPcopy Create free account
hub / github.com/SIPp/sipp / encryptVector

Method encryptVector

src/jlsrtp.cpp:467–551  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

465}
466
467int JLSRTP::encryptVector(std::vector<unsigned char> &invdata, std::vector<unsigned char> &ciphertext_output)
468{
469 int retVal = 0;
470
471 assert(!invdata.empty());
472 if (!invdata.empty())
473 {
474 switch (_active_crypto)
475 {
476 case PRIMARY_CRYPTO:
477 {
478 switch (_primary_crypto.cipher_algorithm)
479 {
480 case AES_CM_128:
481 {
482 ciphertext_output.resize(invdata.size());
483 resetCipherBlockOffset();
484 resetCipherOutputBlock();
485 resetCipherBlockCounter();
486 AES_ctr128_session_EVPencrypt(invdata.data(), ciphertext_output.data(), invdata.size(), _cipherstate.ivec, _cipherstate.ecount, &_cipherstate.num);
487 retVal = 0;
488 }
489 break;
490
491 case NULL_CIPHER:
492 {
493 ciphertext_output = invdata;
494 retVal = 0;
495 }
496 break;
497
498 default:
499 {
500 retVal = -3;
501 }
502 break;
503 }
504 }
505 break;
506
507 case SECONDARY_CRYPTO:
508 {
509 switch (_secondary_crypto.cipher_algorithm)
510 {
511 case AES_CM_128:
512 {
513 ciphertext_output.resize(invdata.size());
514 resetCipherBlockOffset();
515 resetCipherOutputBlock();
516 resetCipherBlockCounter();
517 AES_ctr128_session_EVPencrypt(invdata.data(), ciphertext_output.data(), invdata.size(), _cipherstate.ivec, _cipherstate.ecount, &_cipherstate.num);
518 retVal = 0;
519 }
520 break;
521
522 case NULL_CIPHER:
523 {
524 ciphertext_output = invdata;

Callers

nothing calls this directly

Calls 2

emptyMethod · 0.80
sizeMethod · 0.80

Tested by

no test coverage detected