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
a2cfe12f
Commit
a2cfe12f
authored
13 years ago
by
Rafaël Carré
Browse files
Options
Downloads
Patches
Plain Diff
AudioSrtpSession: simplify base64 encoding
parent
52eb9695
No related branches found
Branches containing commit
No related tags found
Tags containing commit
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
+4
-16
4 additions, 16 deletions
sflphone-common/src/audio/audiortp/AudioSrtpSession.cpp
sflphone-common/src/audio/audiortp/AudioSrtpSession.h
+1
-1
1 addition, 1 deletion
sflphone-common/src/audio/audiortp/AudioSrtpSession.h
with
5 additions
and
17 deletions
sflphone-common/src/audio/audiortp/AudioSrtpSession.cpp
+
4
−
16
View file @
a2cfe12f
...
...
@@ -188,7 +188,6 @@ void AudioSrtpSession::initializeLocalMasterSalt (void)
std
::
string
AudioSrtpSession
::
getBase64ConcatenatedKeys
()
{
_debug
(
"AudioSrtp: Get base64 concatenated keys"
);
// compute concatenated master and salt length
...
...
@@ -203,14 +202,7 @@ std::string AudioSrtpSession::getBase64ConcatenatedKeys()
memcpy
(
(
void
*
)
(
concatKeys
+
_localMasterKeyLength
),
(
void
*
)
_localMasterSalt
,
_localMasterSaltLength
);
// encode concatenated keys in base64
char
*
output
=
encodeBase64
(
(
unsigned
char
*
)
concatKeys
,
concatLength
);
// init string containing encoded data
std
::
string
keys
(
output
);
free
(
output
);
return
keys
;
return
encodeBase64
(
(
unsigned
char
*
)
concatKeys
,
concatLength
);
}
...
...
@@ -296,14 +288,11 @@ void AudioSrtpSession::restoreCryptoContext(ost::CryptoContext *localContext, os
setOutQueueCryptoContext
(
localContext
);
}
char
*
AudioSrtpSession
::
encodeBase64
(
unsigned
char
*
input
,
int
length
)
std
::
string
AudioSrtpSession
::
encodeBase64
(
unsigned
char
*
input
,
int
length
)
{
BIO
*
b64
,
*
bmem
;
BUF_MEM
*
bptr
;
char
*
buffer
=
(
char
*
)
malloc
(
2
*
length
);
memset
(
buffer
,
0
,
2
*
length
);
// init decoder
b64
=
BIO_new
(
BIO_f_base64
());
BIO_set_flags
(
b64
,
BIO_FLAGS_BASE64_NO_NL
);
...
...
@@ -320,12 +309,11 @@ char* AudioSrtpSession::encodeBase64 (unsigned char *input, int length)
// get pointer to data
BIO_get_mem_ptr
(
b64
,
&
bptr
);
// copy result in output buffer (-1 since we do not want the EOF character)
strncpy
(
buffer
,
(
char
*
)
(
bptr
->
data
),
bptr
->
length
);
std
::
string
output
(
bptr
->
data
,
bptr
->
length
);
BIO_free_all
(
bmem
);
return
buffer
;
return
output
;
}
#pragma GCC diagnostic warning "-Wunused-value"
...
...
This diff is collapsed.
Click to expand it.
sflphone-common/src/audio/audiortp/AudioSrtpSession.h
+
1
−
1
View file @
a2cfe12f
...
...
@@ -155,7 +155,7 @@ class AudioSrtpSession : public AudioRtpSession
/**
* Encode input data as base64
*/
char
*
encodeBase64
(
unsigned
char
*
input
,
int
length
);
std
::
string
encodeBase64
(
unsigned
char
*
input
,
int
length
);
/**
* Decode base64 data
...
...
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