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

Method resetPseudoRandomState

src/jlsrtp.cpp:41–64  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

39}
40
41int JLSRTP::resetPseudoRandomState(std::vector<unsigned char> iv)
42{
43 unsigned int ivSize = 0;
44
45 ivSize = iv.size();
46 assert(ivSize == JLSRTP_SALTING_KEY_LENGTH);
47 if (ivSize == JLSRTP_SALTING_KEY_LENGTH)
48 {
49 // aes_ctr128_encrypt() requires 'num' and 'ecount' to be set to zero on the first call
50 _pseudorandomstate.num = 0;
51 memset(_pseudorandomstate.ecount, 0, sizeof(_pseudorandomstate.ecount));
52
53 // Clear BOTH high-order bytes [0..13] for 'IV' AND low-order bytes [14..15] for 'counter'
54 memset(_pseudorandomstate.ivec, 0, AES_BLOCK_SIZE);
55 // Copy 'IV' into high-order bytes [0..13] -- low-order bytes [14..15] remain zero
56 memcpy(_pseudorandomstate.ivec, iv.data(), iv.size());
57
58 return 0;
59 }
60 else
61 {
62 return -1;
63 }
64}
65
66int JLSRTP::pseudorandomFunction(std::vector<unsigned char> iv, int n, std::vector<unsigned char> &output)
67{

Callers

nothing calls this directly

Calls 1

sizeMethod · 0.80

Tested by

no test coverage detected