Skip to content
Snippets Groups Projects
Commit 2d8c322e authored by Alexandre Savard's avatar Alexandre Savard
Browse files

Merge branch 'fix_srtp' of git+ssh://git.sflphone.org/var/repos/sflphone/git/sflphone into fix_srtp

parents 5ff70fb5 2f0896cf
No related branches found
No related tags found
No related merge requests found
......@@ -158,7 +158,7 @@ std::vector<std::string> AudioSrtpSession::getLocalCryptoInfo()
// cryptographic context tagged 1, 2, 3...
std::string tag = "1";
std::string crypto_suite = sfl::CryptoSuites[localCryptoSuite_].name;
std::string crypto_suite(sfl::CryptoSuites[localCryptoSuite_].name);
// srtp keys formated as the following as the following
// inline:keyParameters|keylifetime|MasterKeyIdentifier
......@@ -311,13 +311,13 @@ void AudioSrtpSession::restoreCryptoContext(ost::CryptoContext *localContext,
if (remoteCryptoCtx_ != remoteContext) {
removeInQueueCryptoContext(remoteCryptoCtx_);
remoteCryptoCtx_ = remoteContext;
setInQueueCryptoContext(remoteCryptoCtx_);
}
if (localCryptoCtx_ != localContext) {
removeOutQueueCryptoContext(localCryptoCtx_);
localCryptoCtx_ = localContext;
setOutQueueCryptoContext(localCryptoCtx_);
}
setInQueueCryptoContext(remoteCryptoCtx_);
setOutQueueCryptoContext(localCryptoCtx_);
}
}
......@@ -173,8 +173,7 @@ std::vector<CryptoAttribute *> SdesNegotiator::parse()
bool SdesNegotiator::negotiate()
{
std::vector<CryptoAttribute *> cryptoAttributeVector = parse();
std::vector<CryptoAttribute *> cryptoAttributeVector(parse());
std::vector<CryptoAttribute *>::iterator iter_offer = cryptoAttributeVector.begin();
std::vector<CryptoSuiteDefinition>::const_iterator iter_local = localCapabilities_.begin();
......@@ -193,7 +192,7 @@ bool SdesNegotiator::negotiate()
cryptoSuite_ = (*iter_offer)->getCryptoSuite();
srtpKeyMethod_ = (*iter_offer)->getSrtpKeyMethod();
srtpKeyInfo_ = (*iter_offer)->getSrtpKeyInfo();
authTagLength_ = cryptoSuite_.substr(cryptoSuite_.size()-2, 2);
authTagLength_ = cryptoSuite_.substr(cryptoSuite_.size() - 2, 2);
}
++iter_local;
......
......@@ -401,8 +401,6 @@ void Sdp::setMediaTransportInfoFromRemoteSdp()
void Sdp::getRemoteSdpCryptoFromOffer(const pjmedia_sdp_session* remote_sdp, CryptoOffer& crypto_offer)
{
CryptoOffer remoteOffer;
for (unsigned i = 0; i < remote_sdp->media_count; ++i) {
pjmedia_sdp_media *media = remote_sdp->media[i];
......
......@@ -38,6 +38,7 @@
#include "sip_utils.h"
#include "sipvoiplink.h"
#include "array_size.h"
#include "manager.h"
#include "logger.h"
......@@ -1329,9 +1330,6 @@ void sdp_create_offer_cb(pjsip_inv_session *inv, pjmedia_sdp_session **p_offer)
// This callback is called after SDP offer/answer session has completed.
void sdp_media_update_cb(pjsip_inv_session *inv, pj_status_t status)
{
const pjmedia_sdp_session *remote_sdp;
const pjmedia_sdp_session *local_sdp;
SIPCall *call = static_cast<SIPCall *>(inv->mod_data[mod_ua_.id]);
if (call == NULL) {
......@@ -1355,17 +1353,19 @@ void sdp_media_update_cb(pjsip_inv_session *inv, pj_status_t status)
Sdp *sdpSession = call->getLocalSDP();
// Get active session sessions
const pjmedia_sdp_session *remote_sdp;
pjmedia_sdp_neg_get_active_remote(inv->neg, &remote_sdp);
const pjmedia_sdp_session *local_sdp;
pjmedia_sdp_neg_get_active_local(inv->neg, &local_sdp);
// Print SDP session
char buffer[1000];
memset(buffer, 0, sizeof buffer);
pjmedia_sdp_print(remote_sdp, buffer, 1000);
pjmedia_sdp_print(remote_sdp, buffer, sizeof buffer);
DEBUG("SDP: Remote active SDP Session:\n%s", buffer);
memset(buffer, 0, 1000);
pjmedia_sdp_print(local_sdp, buffer, 1000);
memset(buffer, 0, sizeof buffer);
pjmedia_sdp_print(local_sdp, buffer, sizeof buffer);
DEBUG("SDP: Local active SDP Session:\n%s", buffer);
// Set active SDP sessions
......@@ -1385,9 +1385,9 @@ void sdp_media_update_cb(pjsip_inv_session *inv, pj_status_t status)
bool nego_success = false;
if (!crypto_offer.empty()) {
std::vector<sfl::CryptoSuiteDefinition>localCapabilities;
std::vector<sfl::CryptoSuiteDefinition> localCapabilities;
for (int i = 0; i < 3; i++)
for (size_t i = 0; i < ARRAYSIZE(sfl::CryptoSuites); ++i)
localCapabilities.push_back(sfl::CryptoSuites[i]);
sfl::SdesNegotiator sdesnego(localCapabilities, crypto_offer);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment