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

Method resetCipherState

src/jlsrtp.cpp:1353–1376  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1351}
1352
1353int JLSRTP::resetCipherState()
1354{
1355 unsigned int ivSize = 0;
1356
1357 ivSize = _packetIV.size();
1358 assert(ivSize == JLSRTP_SALTING_KEY_LENGTH);
1359 if (ivSize == JLSRTP_SALTING_KEY_LENGTH)
1360 {
1361 // aes_ctr128_encrypt() requires 'num' and 'ecount' to be set to zero on the first call
1362 resetCipherBlockOffset();
1363 resetCipherOutputBlock();
1364
1365 // Clear BOTH high-order bytes [0..13] for 'IV' AND low-order bytes [14..15] for 'counter'
1366 memset(_cipherstate.ivec, 0, AES_BLOCK_SIZE);
1367 // Copy 'IV' into high-order bytes [0..13] -- low-order bytes [14..15] remain zero
1368 memcpy(_cipherstate.ivec, _packetIV.data(), _packetIV.size());
1369
1370 return 0;
1371 }
1372 else
1373 {
1374 return -1;
1375 }
1376}
1377
1378int JLSRTP::deriveSessionEncryptionKey()
1379{

Callers 1

executeActionMethod · 0.80

Calls 1

sizeMethod · 0.80

Tested by

no test coverage detected