| 1301 | // --------------- PUBLIC METHODS ---------------- |
| 1302 | |
| 1303 | void JLSRTP::resetCryptoContext(unsigned int ssrc, std::string ipAddress, unsigned short port) |
| 1304 | { |
| 1305 | _id.ssrc = ssrc; |
| 1306 | _id.address = ipAddress; |
| 1307 | _id.port = port; |
| 1308 | _ROC = 0; |
| 1309 | _s_l = 0; |
| 1310 | _primary_crypto.cipher_algorithm = AES_CM_128; |
| 1311 | _primary_crypto.hmac_algorithm = HMAC_SHA1_80; |
| 1312 | _primary_crypto.MKI = 0; |
| 1313 | _primary_crypto.MKI_length = 0; |
| 1314 | _primary_crypto.active_MKI = 0; |
| 1315 | _primary_crypto.master_key.resize(JLSRTP_ENCRYPTION_KEY_LENGTH); |
| 1316 | _primary_crypto.master_key_counter = 0; |
| 1317 | _primary_crypto.n_e = _primary_crypto.master_key.size(); |
| 1318 | _primary_crypto.n_a = JLSRTP_AUTHENTICATION_KEY_LENGTH; |
| 1319 | _primary_crypto.master_salt.resize(JLSRTP_SALTING_KEY_LENGTH); |
| 1320 | _primary_crypto.master_key_derivation_rate = 0; |
| 1321 | _primary_crypto.master_mki_value = 0; |
| 1322 | _primary_crypto.n_s = _primary_crypto.master_salt.size(); |
| 1323 | _primary_crypto.tag = 0; |
| 1324 | _secondary_crypto.cipher_algorithm = AES_CM_128; |
| 1325 | _secondary_crypto.hmac_algorithm = HMAC_SHA1_80; |
| 1326 | _secondary_crypto.MKI = 0; |
| 1327 | _secondary_crypto.MKI_length = 0; |
| 1328 | _secondary_crypto.active_MKI = 0; |
| 1329 | _secondary_crypto.master_key.resize(JLSRTP_ENCRYPTION_KEY_LENGTH); |
| 1330 | _secondary_crypto.master_key_counter = 0; |
| 1331 | _secondary_crypto.n_e = _secondary_crypto.master_key.size(); |
| 1332 | _secondary_crypto.n_a = JLSRTP_AUTHENTICATION_KEY_LENGTH; |
| 1333 | _secondary_crypto.master_salt.resize(JLSRTP_SALTING_KEY_LENGTH); |
| 1334 | _secondary_crypto.master_key_derivation_rate = 0; |
| 1335 | _secondary_crypto.master_mki_value = 0; |
| 1336 | _secondary_crypto.n_s = _secondary_crypto.master_salt.size(); |
| 1337 | _secondary_crypto.tag = 0; |
| 1338 | _session_enc_key.resize(JLSRTP_ENCRYPTION_KEY_LENGTH); |
| 1339 | _session_salt_key.resize(JLSRTP_SALTING_KEY_LENGTH); |
| 1340 | _session_auth_key.resize(JLSRTP_AUTHENTICATION_KEY_LENGTH); |
| 1341 | _packetIV.resize(JLSRTP_SALTING_KEY_LENGTH); |
| 1342 | memset(_pseudorandomstate.ivec, 0, sizeof(_pseudorandomstate.ivec)); |
| 1343 | _pseudorandomstate.num = 0; |
| 1344 | memset(_pseudorandomstate.ecount, 0, sizeof(_pseudorandomstate.ecount)); |
| 1345 | memset(_cipherstate.ivec, 0, sizeof(_cipherstate.ivec)); |
| 1346 | _cipherstate.num = 0; |
| 1347 | memset(_cipherstate.ecount, 0, sizeof(_cipherstate.ecount)); |
| 1348 | _srtp_header_size = JLSRTP_SRTP_DEFAULT_HEADER_SIZE; |
| 1349 | _srtp_payload_size = 0; |
| 1350 | _active_crypto = PRIMARY_CRYPTO; |
| 1351 | } |
| 1352 | |
| 1353 | int JLSRTP::resetCipherState() |
| 1354 | { |