Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
jami-daemon
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
savoirfairelinux
jami-daemon
Commits
1d9808c4
Commit
1d9808c4
authored
13 years ago
by
Tristan Matthews
Browse files
Options
Downloads
Patches
Plain Diff
* #7131: cleanup in zrtpsession_callback
parent
32a89484
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
daemon/src/audio/audiortp/zrtp_session_callback.cpp
+67
-107
67 additions, 107 deletions
daemon/src/audio/audiortp/zrtp_session_callback.cpp
daemon/src/audio/audiortp/zrtp_session_callback.h
+6
-6
6 additions, 6 deletions
daemon/src/audio/audiortp/zrtp_session_callback.h
with
73 additions
and
113 deletions
daemon/src/audio/audiortp/zrtp_session_callback.cpp
+
67
−
107
View file @
1d9808c4
...
...
@@ -47,101 +47,94 @@ using namespace ost;
namespace
sfl
{
ZrtpSessionCallback
::
ZrtpSessionCallback
(
SIPCall
*
sipcall
)
:
_
sipcall
(
sipcall
)
sipcall
_
(
sipcall
)
{
using
std
::
pair
;
using
std
::
string
;
if
(
_
mapInitialized
)
{
if
(
mapInitialized
_
)
return
;
}
_info
(
"Zrtp: Initialize callbacks"
);
/**
* Information Map
*/
_infoMap
.
insert
(
pair
<
int32
,
string
*>
(
InfoHelloReceived
,
new
string
(
"Hello received, preparing a Commit"
)));
_infoMap
.
insert
(
pair
<
int32
,
string
*>
(
InfoCommitDHGenerated
,
new
string
(
"Commit: Generated a public DH key"
)));
_infoMap
.
insert
(
pair
<
int32
,
string
*>
(
InfoRespCommitReceived
,
new
string
(
"Responder: Commit received, preparing DHPart1"
)));
_infoMap
.
insert
(
pair
<
int32
,
string
*>
(
InfoDH1DHGenerated
,
new
string
(
"DH1Part: Generated a public DH key"
)));
_infoMap
.
insert
(
pair
<
int32
,
string
*>
(
InfoInitDH1Received
,
new
string
(
"Initiator: DHPart1 received, preparing DHPart2"
)));
_infoMap
.
insert
(
pair
<
int32
,
string
*>
(
InfoRespDH2Received
,
new
string
(
"Responder: DHPart2 received, preparing Confirm1"
)));
_infoMap
.
insert
(
pair
<
int32
,
string
*>
(
InfoInitConf1Received
,
new
string
(
"Initiator: Confirm1 received, preparing Confirm2"
)));
_infoMap
.
insert
(
pair
<
int32
,
string
*>
(
InfoRespConf2Received
,
new
string
(
"Responder: Confirm2 received, preparing Conf2Ack"
)));
_infoMap
.
insert
(
pair
<
int32
,
string
*>
(
InfoRSMatchFound
,
new
string
(
"At least one retained secrets matches - security OK"
)));
_infoMap
.
insert
(
pair
<
int32
,
string
*>
(
InfoSecureStateOn
,
new
string
(
"Entered secure state"
)));
_infoMap
.
insert
(
pair
<
int32
,
string
*>
(
InfoSecureStateOff
,
new
string
(
"No more security for this session"
)));
/**
* Warning Map
*/
_warningMap
.
insert
(
pair
<
int32
,
string
*>
(
WarningDHAESmismatch
,
// Information Map
infoMap_
.
insert
(
pair
<
int32
,
string
*>
(
InfoHelloReceived
,
new
string
(
"Hello received, preparing a Commit"
)));
infoMap_
.
insert
(
pair
<
int32
,
string
*>
(
InfoCommitDHGenerated
,
new
string
(
"Commit: Generated a public DH key"
)));
infoMap_
.
insert
(
pair
<
int32
,
string
*>
(
InfoRespCommitReceived
,
new
string
(
"Responder: Commit received, preparing DHPart1"
)));
infoMap_
.
insert
(
pair
<
int32
,
string
*>
(
InfoDH1DHGenerated
,
new
string
(
"DH1Part: Generated a public DH key"
)));
infoMap_
.
insert
(
pair
<
int32
,
string
*>
(
InfoInitDH1Received
,
new
string
(
"Initiator: DHPart1 received, preparing DHPart2"
)));
infoMap_
.
insert
(
pair
<
int32
,
string
*>
(
InfoRespDH2Received
,
new
string
(
"Responder: DHPart2 received, preparing Confirm1"
)));
infoMap_
.
insert
(
pair
<
int32
,
string
*>
(
InfoInitConf1Received
,
new
string
(
"Initiator: Confirm1 received, preparing Confirm2"
)));
infoMap_
.
insert
(
pair
<
int32
,
string
*>
(
InfoRespConf2Received
,
new
string
(
"Responder: Confirm2 received, preparing Conf2Ack"
)));
infoMap_
.
insert
(
pair
<
int32
,
string
*>
(
InfoRSMatchFound
,
new
string
(
"At least one retained secrets matches - security OK"
)));
infoMap_
.
insert
(
pair
<
int32
,
string
*>
(
InfoSecureStateOn
,
new
string
(
"Entered secure state"
)));
infoMap_
.
insert
(
pair
<
int32
,
string
*>
(
InfoSecureStateOff
,
new
string
(
"No more security for this session"
)));
// Warning Map
warningMap_
.
insert
(
pair
<
int32
,
string
*>
(
WarningDHAESmismatch
,
new
string
(
"Commit contains an AES256 cipher but does not offer a Diffie-Helman 4096"
)));
_
warningMap
.
insert
(
pair
<
int32
,
string
*>
(
WarningGoClearReceived
,
new
string
(
"Received a GoClear message"
)));
_
warningMap
.
insert
(
pair
<
int32
,
string
*>
(
WarningDHShort
,
warningMap
_
.
insert
(
pair
<
int32
,
string
*>
(
WarningGoClearReceived
,
new
string
(
"Received a GoClear message"
)));
warningMap
_
.
insert
(
pair
<
int32
,
string
*>
(
WarningDHShort
,
new
string
(
"Hello offers an AES256 cipher but does not offer a Diffie-Helman 4096"
)));
_
warningMap
.
insert
(
pair
<
int32
,
string
*>
(
WarningNoRSMatch
,
new
string
(
"No retained secret matches - verify SAS"
)));
_
warningMap
.
insert
(
pair
<
int32
,
string
*>
(
WarningCRCmismatch
,
new
string
(
"Internal ZRTP packet checksum mismatch - packet dropped"
)));
_
warningMap
.
insert
(
pair
<
int32
,
string
*>
(
WarningSRTPauthError
,
new
string
(
"Dropping packet because SRTP authentication failed!"
)));
_
warningMap
.
insert
(
pair
<
int32
,
string
*>
(
WarningSRTPreplayError
,
new
string
(
"Dropping packet because SRTP replay check failed!"
)));
_
severeMap
.
insert
(
pair
<
int32
,
string
*>
(
SevereHelloHMACFailed
,
new
string
(
"Hash HMAC check of Hello failed!"
)));
_
severeMap
.
insert
(
pair
<
int32
,
string
*>
(
SevereCommitHMACFailed
,
new
string
(
"Hash HMAC check of Commit failed!"
)));
_
severeMap
.
insert
(
pair
<
int32
,
string
*>
(
SevereDH1HMACFailed
,
new
string
(
"Hash HMAC check of DHPart1 failed!"
)));
_
severeMap
.
insert
(
pair
<
int32
,
string
*>
(
SevereDH2HMACFailed
,
new
string
(
"Hash HMAC check of DHPart2 failed!"
)));
_
severeMap
.
insert
(
pair
<
int32
,
string
*>
(
SevereCannotSend
,
new
string
(
"Cannot send data - connection or peer down?"
)));
_
severeMap
.
insert
(
pair
<
int32
,
string
*>
(
SevereProtocolError
,
new
string
(
"Internal protocol error occured!"
)));
_
severeMap
.
insert
(
pair
<
int32
,
string
*>
(
SevereNoTimer
,
new
string
(
"Cannot start a timer - internal resources exhausted?"
)));
_
severeMap
.
insert
(
pair
<
int32
,
string
*>
(
SevereTooMuchRetries
,
warningMap
_
.
insert
(
pair
<
int32
,
string
*>
(
WarningNoRSMatch
,
new
string
(
"No retained secret matches - verify SAS"
)));
warningMap
_
.
insert
(
pair
<
int32
,
string
*>
(
WarningCRCmismatch
,
new
string
(
"Internal ZRTP packet checksum mismatch - packet dropped"
)));
warningMap
_
.
insert
(
pair
<
int32
,
string
*>
(
WarningSRTPauthError
,
new
string
(
"Dropping packet because SRTP authentication failed!"
)));
warningMap
_
.
insert
(
pair
<
int32
,
string
*>
(
WarningSRTPreplayError
,
new
string
(
"Dropping packet because SRTP replay check failed!"
)));
severeMap
_
.
insert
(
pair
<
int32
,
string
*>
(
SevereHelloHMACFailed
,
new
string
(
"Hash HMAC check of Hello failed!"
)));
severeMap
_
.
insert
(
pair
<
int32
,
string
*>
(
SevereCommitHMACFailed
,
new
string
(
"Hash HMAC check of Commit failed!"
)));
severeMap
_
.
insert
(
pair
<
int32
,
string
*>
(
SevereDH1HMACFailed
,
new
string
(
"Hash HMAC check of DHPart1 failed!"
)));
severeMap
_
.
insert
(
pair
<
int32
,
string
*>
(
SevereDH2HMACFailed
,
new
string
(
"Hash HMAC check of DHPart2 failed!"
)));
severeMap
_
.
insert
(
pair
<
int32
,
string
*>
(
SevereCannotSend
,
new
string
(
"Cannot send data - connection or peer down?"
)));
severeMap
_
.
insert
(
pair
<
int32
,
string
*>
(
SevereProtocolError
,
new
string
(
"Internal protocol error occured!"
)));
severeMap
_
.
insert
(
pair
<
int32
,
string
*>
(
SevereNoTimer
,
new
string
(
"Cannot start a timer - internal resources exhausted?"
)));
severeMap
_
.
insert
(
pair
<
int32
,
string
*>
(
SevereTooMuchRetries
,
new
string
(
"Too much retries during ZRTP negotiation - connection or peer down?"
)));
/**
* Zrtp protocol related messages map
*/
_
zrtpMap
.
insert
(
pair
<
int32
,
string
*>
(
MalformedPacket
,
new
string
(
"Malformed packet (CRC OK, but wrong structure)"
)));
_
zrtpMap
.
insert
(
pair
<
int32
,
string
*>
(
CriticalSWError
,
new
string
(
"Critical software error"
)));
_
zrtpMap
.
insert
(
pair
<
int32
,
string
*>
(
UnsuppZRTPVersion
,
new
string
(
"Unsupported ZRTP version"
)));
_
zrtpMap
.
insert
(
pair
<
int32
,
string
*>
(
HelloCompMismatch
,
new
string
(
"Hello components mismatch"
)));
_
zrtpMap
.
insert
(
pair
<
int32
,
string
*>
(
UnsuppHashType
,
new
string
(
"Hash type not supported"
)));
_
zrtpMap
.
insert
(
pair
<
int32
,
string
*>
(
UnsuppCiphertype
,
new
string
(
"Cipher type not supported"
)));
_
zrtpMap
.
insert
(
pair
<
int32
,
string
*>
(
UnsuppPKExchange
,
new
string
(
"Public key exchange not supported"
)));
_
zrtpMap
.
insert
(
pair
<
int32
,
string
*>
(
UnsuppSRTPAuthTag
,
new
string
(
"SRTP auth. tag not supported"
)));
_
zrtpMap
.
insert
(
pair
<
int32
,
string
*>
(
UnsuppSASScheme
,
new
string
(
"SAS scheme not supported"
)));
_
zrtpMap
.
insert
(
pair
<
int32
,
string
*>
(
NoSharedSecret
,
new
string
(
"No shared secret available, DH mode required"
)));
_
zrtpMap
.
insert
(
pair
<
int32
,
string
*>
(
DHErrorWrongPV
,
new
string
(
"DH Error: bad pvi or pvr ( == 1, 0, or p-1)"
)));
_
zrtpMap
.
insert
(
pair
<
int32
,
string
*>
(
DHErrorWrongHVI
,
new
string
(
"DH Error: hvi != hashed data"
)));
_
zrtpMap
.
insert
(
pair
<
int32
,
string
*>
(
SASuntrustedMiTM
,
new
string
(
"Received relayed SAS from untrusted MiTM"
)));
_
zrtpMap
.
insert
(
pair
<
int32
,
string
*>
(
ConfirmHMACWrong
,
new
string
(
"Auth. Error: Bad Confirm pkt HMAC"
)));
_
zrtpMap
.
insert
(
pair
<
int32
,
string
*>
(
NonceReused
,
new
string
(
"Nonce reuse"
)));
_
zrtpMap
.
insert
(
pair
<
int32
,
string
*>
(
EqualZIDHello
,
new
string
(
"Equal ZIDs in Hello"
)));
_
zrtpMap
.
insert
(
pair
<
int32
,
string
*>
(
GoCleatNotAllowed
,
new
string
(
"GoClear packet received, but not allowed"
)));
_
mapInitialized
=
true
;
zrtpMap
_
.
insert
(
pair
<
int32
,
string
*>
(
MalformedPacket
,
new
string
(
"Malformed packet (CRC OK, but wrong structure)"
)));
zrtpMap
_
.
insert
(
pair
<
int32
,
string
*>
(
CriticalSWError
,
new
string
(
"Critical software error"
)));
zrtpMap
_
.
insert
(
pair
<
int32
,
string
*>
(
UnsuppZRTPVersion
,
new
string
(
"Unsupported ZRTP version"
)));
zrtpMap
_
.
insert
(
pair
<
int32
,
string
*>
(
HelloCompMismatch
,
new
string
(
"Hello components mismatch"
)));
zrtpMap
_
.
insert
(
pair
<
int32
,
string
*>
(
UnsuppHashType
,
new
string
(
"Hash type not supported"
)));
zrtpMap
_
.
insert
(
pair
<
int32
,
string
*>
(
UnsuppCiphertype
,
new
string
(
"Cipher type not supported"
)));
zrtpMap
_
.
insert
(
pair
<
int32
,
string
*>
(
UnsuppPKExchange
,
new
string
(
"Public key exchange not supported"
)));
zrtpMap
_
.
insert
(
pair
<
int32
,
string
*>
(
UnsuppSRTPAuthTag
,
new
string
(
"SRTP auth. tag not supported"
)));
zrtpMap
_
.
insert
(
pair
<
int32
,
string
*>
(
UnsuppSASScheme
,
new
string
(
"SAS scheme not supported"
)));
zrtpMap
_
.
insert
(
pair
<
int32
,
string
*>
(
NoSharedSecret
,
new
string
(
"No shared secret available, DH mode required"
)));
zrtpMap
_
.
insert
(
pair
<
int32
,
string
*>
(
DHErrorWrongPV
,
new
string
(
"DH Error: bad pvi or pvr ( == 1, 0, or p-1)"
)));
zrtpMap
_
.
insert
(
pair
<
int32
,
string
*>
(
DHErrorWrongHVI
,
new
string
(
"DH Error: hvi != hashed data"
)));
zrtpMap
_
.
insert
(
pair
<
int32
,
string
*>
(
SASuntrustedMiTM
,
new
string
(
"Received relayed SAS from untrusted MiTM"
)));
zrtpMap
_
.
insert
(
pair
<
int32
,
string
*>
(
ConfirmHMACWrong
,
new
string
(
"Auth. Error: Bad Confirm pkt HMAC"
)));
zrtpMap
_
.
insert
(
pair
<
int32
,
string
*>
(
NonceReused
,
new
string
(
"Nonce reuse"
)));
zrtpMap
_
.
insert
(
pair
<
int32
,
string
*>
(
EqualZIDHello
,
new
string
(
"Equal ZIDs in Hello"
)));
zrtpMap
_
.
insert
(
pair
<
int32
,
string
*>
(
GoCleatNotAllowed
,
new
string
(
"GoClear packet received, but not allowed"
)));
mapInitialized
_
=
true
;
}
void
ZrtpSessionCallback
::
secureOn
(
std
::
string
cipher
)
{
_debug
(
"Zrtp: Secure mode is on with cipher %s"
,
cipher
.
c_str
());
Manager
::
instance
().
getDbusManager
()
->
getCallManager
()
->
secureZrtpOn
(
_
sipcall
->
getCallId
(),
cipher
);
Manager
::
instance
().
getDbusManager
()
->
getCallManager
()
->
secureZrtpOn
(
sipcall
_
->
getCallId
(),
cipher
);
}
void
ZrtpSessionCallback
::
secureOff
()
{
_debug
(
"Zrtp: Secure mode is off"
);
Manager
::
instance
().
getDbusManager
()
->
getCallManager
()
->
secureZrtpOff
(
_
sipcall
->
getCallId
());
Manager
::
instance
().
getDbusManager
()
->
getCallManager
()
->
secureZrtpOff
(
sipcall
_
->
getCallId
());
}
void
ZrtpSessionCallback
::
showSAS
(
std
::
string
sas
,
bool
verified
)
{
_debug
(
"Zrtp: SAS is: %s"
,
sas
.
c_str
());
Manager
::
instance
().
getDbusManager
()
->
getCallManager
()
->
showSAS
(
_
sipcall
->
getCallId
(),
sas
,
verified
);
Manager
::
instance
().
getDbusManager
()
->
getCallManager
()
->
showSAS
(
sipcall
_
->
getCallId
(),
sas
,
verified
);
}
...
...
@@ -149,51 +142,19 @@ void
ZrtpSessionCallback
::
zrtpNotSuppOther
()
{
_debug
(
"Zrtp: Callee does not support ZRTP"
);
Manager
::
instance
().
getDbusManager
()
->
getCallManager
()
->
zrtpNotSuppOther
(
_
sipcall
->
getCallId
());
Manager
::
instance
().
getDbusManager
()
->
getCallManager
()
->
zrtpNotSuppOther
(
sipcall
_
->
getCallId
());
}
void
ZrtpSessionCallback
::
showMessage
(
GnuZrtpCodes
::
MessageSeverity
sev
,
int32_t
subCode
)
{
std
::
string
*
msg
;
if
(
sev
==
Info
)
{
msg
=
_infoMap
[
subCode
];
if
(
msg
!=
NULL
)
{
}
}
if
(
sev
==
Warning
)
{
msg
=
_warningMap
[
subCode
];
if
(
msg
!=
NULL
)
{
}
}
if
(
sev
==
Severe
)
{
msg
=
_severeMap
[
subCode
];
if
(
msg
!=
NULL
)
{
}
}
if
(
sev
==
ZrtpError
)
{
if
(
subCode
<
0
)
{
// received an error packet from peer
subCode
*=
-
1
;
_debug
(
"Received an error packet from peer:"
);
}
else
{
}
else
_debug
(
"Sent error packet to peer:"
);
}
msg
=
_zrtpMap
[
subCode
];
if
(
msg
!=
NULL
)
{
}
}
}
...
...
@@ -206,20 +167,19 @@ ZrtpSessionCallback::zrtpNegotiationFailed(MessageSeverity severity, int subCode
if
(
subCode
<
0
)
{
// received an error packet from peer
subCode
*=
-
1
;
_debug
(
"Zrtp: Received error packet: "
);
}
else
{
}
else
_debug
(
"Zrtp: Sent error packet: "
);
}
msg
=
_
zrtpMap
[
subCode
];
msg
=
zrtpMap
_
[
subCode
];
if
(
msg
!=
NULL
)
{
_debug
(
"%s"
,
msg
->
c_str
());
Manager
::
instance
().
getDbusManager
()
->
getCallManager
()
->
zrtpNegotiationFailed
(
_
sipcall
->
getCallId
(),
*
msg
,
"ZRTP"
);
Manager
::
instance
().
getDbusManager
()
->
getCallManager
()
->
zrtpNegotiationFailed
(
sipcall
_
->
getCallId
(),
*
msg
,
"ZRTP"
);
}
}
else
{
msg
=
_
severeMap
[
subCode
];
msg
=
severeMap
_
[
subCode
];
_debug
(
"%s"
,
msg
->
c_str
());
Manager
::
instance
().
getDbusManager
()
->
getCallManager
()
->
zrtpNegotiationFailed
(
_
sipcall
->
getCallId
(),
*
msg
,
"severe"
);
Manager
::
instance
().
getDbusManager
()
->
getCallManager
()
->
zrtpNegotiationFailed
(
sipcall
_
->
getCallId
(),
*
msg
,
"severe"
);
}
}
...
...
@@ -227,14 +187,14 @@ void
ZrtpSessionCallback
::
confirmGoClear
()
{
_debug
(
"Zrtp: Received go clear message. Until confirmation, ZRTP won't send any data"
);
Manager
::
instance
().
getDbusManager
()
->
getCallManager
()
->
zrtpNotSuppOther
(
_
sipcall
->
getCallId
());
Manager
::
instance
().
getDbusManager
()
->
getCallManager
()
->
zrtpNotSuppOther
(
sipcall
_
->
getCallId
());
}
std
::
map
<
int32
,
std
::
string
*>
ZrtpSessionCallback
::
_
infoMap
;
std
::
map
<
int32
,
std
::
string
*>
ZrtpSessionCallback
::
_
warningMap
;
std
::
map
<
int32
,
std
::
string
*>
ZrtpSessionCallback
::
_
severeMap
;
std
::
map
<
int32
,
std
::
string
*>
ZrtpSessionCallback
::
_
zrtpMap
;
std
::
map
<
int32
,
std
::
string
*>
ZrtpSessionCallback
::
infoMap
_
;
std
::
map
<
int32
,
std
::
string
*>
ZrtpSessionCallback
::
warningMap
_
;
std
::
map
<
int32
,
std
::
string
*>
ZrtpSessionCallback
::
severeMap
_
;
std
::
map
<
int32
,
std
::
string
*>
ZrtpSessionCallback
::
zrtpMap
_
;
bool
ZrtpSessionCallback
::
_
mapInitialized
=
false
;
bool
ZrtpSessionCallback
::
mapInitialized
_
=
false
;
}
This diff is collapsed.
Click to expand it.
daemon/src/audio/audiortp/zrtp_session_callback.h
+
6
−
6
View file @
1d9808c4
...
...
@@ -57,13 +57,13 @@ class ZrtpSessionCallback: public ZrtpUserCallback {
void
confirmGoClear
();
private:
SIPCall
*
_
sipcall
;
SIPCall
*
sipcall
_
;
/* FIXME: why are these strings dynamically allocated? */
static
std
::
map
<
int32
,
std
::
string
*>
_
infoMap
;
static
std
::
map
<
int32
,
std
::
string
*>
_
warningMap
;
static
std
::
map
<
int32
,
std
::
string
*>
_
severeMap
;
static
std
::
map
<
int32
,
std
::
string
*>
_
zrtpMap
;
static
bool
_
mapInitialized
;
static
std
::
map
<
int32
,
std
::
string
*>
infoMap
_
;
static
std
::
map
<
int32
,
std
::
string
*>
warningMap
_
;
static
std
::
map
<
int32
,
std
::
string
*>
severeMap
_
;
static
std
::
map
<
int32
,
std
::
string
*>
zrtpMap
_
;
static
bool
mapInitialized
_
;
};
}
#endif // __ZRTP_SESSION_CALLBACK_H__
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment