|
@@ -262,41 +262,67 @@ void DtlsSrtpTransport::postHandshake() {
|
|
serverSalt = clientSalt + SRTP_SALT_LEN;
|
|
serverSalt = clientSalt + SRTP_SALT_LEN;
|
|
#endif
|
|
#endif
|
|
|
|
|
|
- unsigned char clientSessionKey[SRTP_AES_ICM_128_KEY_LEN_WSALT];
|
|
|
|
std::memcpy(clientSessionKey, clientKey, SRTP_AES_128_KEY_LEN);
|
|
std::memcpy(clientSessionKey, clientKey, SRTP_AES_128_KEY_LEN);
|
|
std::memcpy(clientSessionKey + SRTP_AES_128_KEY_LEN, clientSalt, SRTP_SALT_LEN);
|
|
std::memcpy(clientSessionKey + SRTP_AES_128_KEY_LEN, clientSalt, SRTP_SALT_LEN);
|
|
|
|
|
|
- unsigned char serverSessionKey[SRTP_AES_ICM_128_KEY_LEN_WSALT];
|
|
|
|
std::memcpy(serverSessionKey, serverKey, SRTP_AES_128_KEY_LEN);
|
|
std::memcpy(serverSessionKey, serverKey, SRTP_AES_128_KEY_LEN);
|
|
std::memcpy(serverSessionKey + SRTP_AES_128_KEY_LEN, serverSalt, SRTP_SALT_LEN);
|
|
std::memcpy(serverSessionKey + SRTP_AES_128_KEY_LEN, serverSalt, SRTP_SALT_LEN);
|
|
|
|
|
|
- srtp_policy_t inbound = {};
|
|
|
|
- srtp_crypto_policy_set_aes_cm_128_hmac_sha1_80(&inbound.rtp);
|
|
|
|
- srtp_crypto_policy_set_aes_cm_128_hmac_sha1_80(&inbound.rtcp);
|
|
|
|
- inbound.ssrc.type = ssrc_any_inbound;
|
|
|
|
- inbound.ssrc.value = 0;
|
|
|
|
- inbound.key = mIsClient ? serverSessionKey : clientSessionKey;
|
|
|
|
- inbound.next = nullptr;
|
|
|
|
-
|
|
|
|
- if (srtp_err_status_t err = srtp_add_stream(mSrtpIn, &inbound))
|
|
|
|
- throw std::runtime_error("SRTP add inbound stream failed, status=" +
|
|
|
|
- to_string(static_cast<int>(err)));
|
|
|
|
-
|
|
|
|
- srtp_policy_t outbound = {};
|
|
|
|
- srtp_crypto_policy_set_aes_cm_128_hmac_sha1_80(&outbound.rtp);
|
|
|
|
- srtp_crypto_policy_set_aes_cm_128_hmac_sha1_80(&outbound.rtcp);
|
|
|
|
- outbound.ssrc.type = ssrc_any_outbound;
|
|
|
|
- outbound.ssrc.value = 0;
|
|
|
|
- outbound.key = mIsClient ? clientSessionKey : serverSessionKey;
|
|
|
|
- outbound.next = nullptr;
|
|
|
|
-
|
|
|
|
- if (srtp_err_status_t err = srtp_add_stream(mSrtpOut, &outbound))
|
|
|
|
- throw std::runtime_error("SRTP add outbound stream failed, status=" +
|
|
|
|
- to_string(static_cast<int>(err)));
|
|
|
|
|
|
+// srtp_policy_t inbound = {};
|
|
|
|
+// srtp_crypto_policy_set_aes_cm_128_hmac_sha1_80(&inbound.rtp);
|
|
|
|
+// srtp_crypto_policy_set_aes_cm_128_hmac_sha1_80(&inbound.rtcp);
|
|
|
|
+// inbound.ssrc.type = ssrc_any_inbound;
|
|
|
|
+// inbound.ssrc.value = 0;
|
|
|
|
+// inbound.key = mIsClient ? serverSessionKey : clientSessionKey;
|
|
|
|
+// inbound.next = nullptr;
|
|
|
|
+//
|
|
|
|
+// if (srtp_err_status_t err = srtp_add_stream(mSrtpIn, &inbound))
|
|
|
|
+// throw std::runtime_error("SRTP add inbound stream failed, status=" +
|
|
|
|
+// to_string(static_cast<int>(err)));
|
|
|
|
+//
|
|
|
|
+// srtp_policy_t outbound = {};
|
|
|
|
+// srtp_crypto_policy_set_aes_cm_128_hmac_sha1_80(&outbound.rtp);
|
|
|
|
+// srtp_crypto_policy_set_aes_cm_128_hmac_sha1_80(&outbound.rtcp);
|
|
|
|
+// outbound.ssrc.type = ssrc_any_outbound;
|
|
|
|
+// outbound.ssrc.value = 0;
|
|
|
|
+// outbound.key = mIsClient ? clientSessionKey : serverSessionKey;
|
|
|
|
+// outbound.next = nullptr;
|
|
|
|
+//
|
|
|
|
+// if (srtp_err_status_t err = srtp_add_stream(mSrtpOut, &outbound))
|
|
|
|
+// throw std::runtime_error("SRTP add outbound stream failed, status=" +
|
|
|
|
+// to_string(static_cast<int>(err)));
|
|
|
|
|
|
mInitDone = true;
|
|
mInitDone = true;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+void DtlsSrtpTransport::addSSRC(uint32_t ssrc) {
|
|
|
|
+ srtp_policy_t inbound = {};
|
|
|
|
+ srtp_crypto_policy_set_aes_cm_128_hmac_sha1_80(&inbound.rtp);
|
|
|
|
+ srtp_crypto_policy_set_aes_cm_128_hmac_sha1_80(&inbound.rtcp);
|
|
|
|
+ inbound.ssrc.type = ssrc_specific;
|
|
|
|
+ inbound.ssrc.value = ssrc;
|
|
|
|
+ inbound.key = mIsClient ? serverSessionKey : clientSessionKey;
|
|
|
|
+ inbound.next = nullptr;
|
|
|
|
+
|
|
|
|
+ if (srtp_err_status_t err = srtp_add_stream(mSrtpIn, &inbound))
|
|
|
|
+ throw std::runtime_error("SRTP add inbound stream failed, status=" +
|
|
|
|
+ to_string(static_cast<int>(err)));
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ srtp_policy_t outbound = {};
|
|
|
|
+ srtp_crypto_policy_set_aes_cm_128_hmac_sha1_80(&outbound.rtp);
|
|
|
|
+ srtp_crypto_policy_set_aes_cm_128_hmac_sha1_80(&outbound.rtcp);
|
|
|
|
+ outbound.ssrc.type = ssrc_specific;
|
|
|
|
+ outbound.ssrc.value = ssrc;
|
|
|
|
+ outbound.key = mIsClient ? clientSessionKey : serverSessionKey;
|
|
|
|
+ outbound.next = nullptr;
|
|
|
|
+
|
|
|
|
+ if (srtp_err_status_t err = srtp_add_stream(mSrtpOut, &outbound))
|
|
|
|
+ throw std::runtime_error("SRTP add outbound stream failed, status=" +
|
|
|
|
+ to_string(static_cast<int>(err)));
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+
|
|
} // namespace rtc
|
|
} // namespace rtc
|
|
|
|
|
|
#endif
|
|
#endif
|