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
e2fc783e
Commit
e2fc783e
authored
15 years ago
by
Alexandre Savard
Browse files
Options
Downloads
Patches
Plain Diff
[#1722] Use differnt crypto context for input and output in SRTP session
parent
81f3524d
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
sflphone-common/src/audio/audiortp/AudioSrtpSession.cpp
+35
-10
35 additions, 10 deletions
sflphone-common/src/audio/audiortp/AudioSrtpSession.cpp
sflphone-common/src/audio/audiortp/AudioSrtpSession.h
+6
-2
6 additions, 2 deletions
sflphone-common/src/audio/audiortp/AudioSrtpSession.h
with
41 additions
and
12 deletions
sflphone-common/src/audio/audiortp/AudioSrtpSession.cpp
+
35
−
10
View file @
e2fc783e
...
@@ -25,6 +25,12 @@
...
@@ -25,6 +25,12 @@
#include
<cstring>
#include
<cstring>
#include
<cerrno>
#include
<cerrno>
static
uint8
mk
[]
=
{
0x00
,
0x01
,
0x02
,
0x03
,
0x04
,
0x05
,
0x06
,
0x07
,
0x08
,
0x09
,
0x0a
,
0x0b
,
0x0c
,
0x0d
,
0x0e
,
0x0f
};
static
uint8
ms
[]
=
{
0x10
,
0x11
,
0x12
,
0x13
,
0x14
,
0x15
,
0x16
,
0x17
,
0x18
,
0x19
,
0x1a
,
0x1b
,
0x1c
,
0x1d
};
namespace
sfl
namespace
sfl
{
{
...
@@ -35,18 +41,19 @@ AudioSrtpSession::AudioSrtpSession (ManagerImpl * manager, SIPCall * sipcall) :
...
@@ -35,18 +41,19 @@ AudioSrtpSession::AudioSrtpSession (ManagerImpl * manager, SIPCall * sipcall) :
_debug
(
"AudioSrtpSession initialized"
);
_debug
(
"AudioSrtpSession initialized"
);
initializeMasterKey
();
initializeMasterKey
();
initializeMasterSalt
();
initializeMasterSalt
();
initializeCryptoContext
();
initializeInputCryptoContext
();
txCryptoCtx
->
deriveSrtpKeys
(
0
);
initializeOutputCryptoContext
();
outputCryptoCtx
->
deriveSrtpKeys
(
0
);
setInQueueCryptoContext
(
t
x
CryptoCtx
);
setInQueueCryptoContext
(
inpu
tCryptoCtx
);
setOutQueueCryptoContext
(
t
x
CryptoCtx
);
setOutQueueCryptoContext
(
outpu
tCryptoCtx
);
}
}
void
AudioSrtpSession
::
initializeMasterKey
(
void
)
void
AudioSrtpSession
::
initializeMasterKey
(
void
)
{
{
_masterKey
=
{
0x00
,
0x01
,
0x02
,
0x03
,
0x04
,
0x05
,
0x06
,
0x07
,
for
(
int
i
=
0
;
i
<
16
;
i
++
)
0x08
,
0x09
,
0x0a
,
0x0b
,
0x0c
,
0x0d
,
0x0e
,
0x0f
}
;
_masterKey
[
i
]
=
mk
[
i
]
;
return
;
return
;
}
}
...
@@ -54,17 +61,35 @@ void AudioSrtpSession::initializeMasterKey(void)
...
@@ -54,17 +61,35 @@ void AudioSrtpSession::initializeMasterKey(void)
void
AudioSrtpSession
::
initializeMasterSalt
(
void
)
void
AudioSrtpSession
::
initializeMasterSalt
(
void
)
{
{
_masterSalt
=
{
0x10
,
0x11
,
0x12
,
0x13
,
0x14
,
0x15
,
0x16
,
0x17
,
for
(
int
i
=
0
;
i
<
16
;
i
++
)
0x18
,
0x19
,
0x1a
,
0x1b
,
0x1c
,
0x1d
}
;
_masterSalt
[
i
]
=
ms
[
i
]
;
return
;
return
;
}
}
void
AudioSrtpSession
::
initializeCryptoContext
(
void
)
void
AudioSrtpSession
::
initializeInputCryptoContext
(
void
)
{
inputCryptoCtx
=
new
ost
::
CryptoContext
(
0x12345678
,
0
,
// roc,
0L
,
// keydr,
SrtpEncryptionAESCM
,
// encryption algo
SrtpAuthenticationSha1Hmac
,
// authtication algo
_masterKey
,
// Master Key
128
/
8
,
// Master Key length
_masterSalt
,
// Master Salt
112
/
8
,
// Master Salt length
128
/
8
,
// encryption keyl
160
/
8
,
// authentication key len
112
/
8
,
// session salt len
80
/
8
);
// authentication tag len
}
void
AudioSrtpSession
::
initializeOutputCryptoContext
(
void
)
{
{
t
x
CryptoCtx
=
new
ost
::
CryptoContext
(
0x12345678
,
outpu
tCryptoCtx
=
new
ost
::
CryptoContext
(
0x12345678
,
0
,
// roc,
0
,
// roc,
0L
,
// keydr,
0L
,
// keydr,
SrtpEncryptionAESCM
,
// encryption algo
SrtpEncryptionAESCM
,
// encryption algo
...
...
This diff is collapsed.
Click to expand it.
sflphone-common/src/audio/audiortp/AudioSrtpSession.h
+
6
−
2
View file @
e2fc783e
...
@@ -47,13 +47,17 @@ namespace sfl {
...
@@ -47,13 +47,17 @@ namespace sfl {
void
initializeMasterSalt
(
void
);
void
initializeMasterSalt
(
void
);
void
initializeCryptoContext
(
void
);
void
initializeInputCryptoContext
(
void
);
void
initializeOutputCryptoContext
(
void
);
uint8
_masterKey
[
16
];
uint8
_masterKey
[
16
];
uint8
_masterSalt
[
14
];
uint8
_masterSalt
[
14
];
ost
::
CryptoContext
*
txCryptoCtx
;
ost
::
CryptoContext
*
inputCryptoCtx
;
ost
::
CryptoContext
*
outputCryptoCtx
;
};
};
}
}
...
...
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