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
44f0d4ea
Commit
44f0d4ea
authored
13 years ago
by
Rafaël Carré
Browse files
Options
Downloads
Patches
Plain Diff
malloc/free -> new[]/delete[]
parent
fcc77198
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
+7
-12
7 additions, 12 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
8 additions
and
13 deletions
sflphone-common/src/audio/audiortp/AudioSrtpSession.cpp
+
7
−
12
View file @
44f0d4ea
...
@@ -208,24 +208,20 @@ std::string AudioSrtpSession::getBase64ConcatenatedKeys()
...
@@ -208,24 +208,20 @@ std::string AudioSrtpSession::getBase64ConcatenatedKeys()
void
AudioSrtpSession
::
unBase64ConcatenatedKeys
(
std
::
string
base64keys
)
void
AudioSrtpSession
::
unBase64ConcatenatedKeys
(
std
::
string
base64keys
)
{
{
_remoteMasterKeyLength
=
sfl
::
CryptoSuites
[
_remoteCryptoSuite
].
masterKeyLength
/
8
;
_remoteMasterKeyLength
=
sfl
::
CryptoSuites
[
_remoteCryptoSuite
].
masterKeyLength
/
8
;
_remoteMasterSaltLength
=
sfl
::
CryptoSuites
[
_remoteCryptoSuite
].
masterSaltLength
/
8
;
_remoteMasterSaltLength
=
sfl
::
CryptoSuites
[
_remoteCryptoSuite
].
masterSaltLength
/
8
;
// length of decoded data data
int
length
;
// pointer to binary data
// pointer to binary data
char
*
dataptr
=
(
char
*
)
base64keys
.
data
();
char
*
dataptr
=
(
char
*
)
base64keys
.
data
();
// decode concatenated binary keys
// decode concatenated binary keys
char
*
output
=
decodeBase64
(
(
unsigned
char
*
)
dataptr
,
strlen
(
dataptr
)
,
&
length
);
char
*
output
=
decodeBase64
(
(
unsigned
char
*
)
dataptr
,
strlen
(
dataptr
));
// copy master and slt respectively
// copy master and slt respectively
memcpy
(
(
void
*
)
_remoteMasterKey
,
(
void
*
)
output
,
_remoteMasterKeyLength
);
memcpy
(
(
void
*
)
_remoteMasterKey
,
(
void
*
)
output
,
_remoteMasterKeyLength
);
memcpy
(
(
void
*
)
_remoteMasterSalt
,
(
void
*
)
(
output
+
_remoteMasterKeyLength
),
_remoteMasterSaltLength
);
memcpy
(
(
void
*
)
_remoteMasterSalt
,
(
void
*
)
(
output
+
_remoteMasterKeyLength
),
_remoteMasterSaltLength
);
free
(
output
)
;
delete
[]
output
;
}
}
...
@@ -317,13 +313,10 @@ std::string AudioSrtpSession::encodeBase64 (unsigned char *input, int length)
...
@@ -317,13 +313,10 @@ std::string AudioSrtpSession::encodeBase64 (unsigned char *input, int length)
}
}
#pragma GCC diagnostic warning "-Wunused-value"
#pragma GCC diagnostic warning "-Wunused-value"
char
*
AudioSrtpSession
::
decodeBase64
(
unsigned
char
*
input
,
int
length
,
int
*
length_out
)
char
*
AudioSrtpSession
::
decodeBase64
(
unsigned
char
*
input
,
int
length
)
{
{
BIO
*
b64
,
*
bmem
;
BIO
*
b64
,
*
bmem
;
char
*
buffer
=
(
char
*
)
malloc
(
length
);
memset
(
buffer
,
0
,
length
);
// init decoder and read-only BIO buffer
// init decoder and read-only BIO buffer
b64
=
BIO_new
(
BIO_f_base64
());
b64
=
BIO_new
(
BIO_f_base64
());
BIO_set_flags
(
b64
,
BIO_FLAGS_BASE64_NO_NL
);
BIO_set_flags
(
b64
,
BIO_FLAGS_BASE64_NO_NL
);
...
@@ -334,12 +327,14 @@ char* AudioSrtpSession::decodeBase64 (unsigned char *input, int length, int *len
...
@@ -334,12 +327,14 @@ char* AudioSrtpSession::decodeBase64 (unsigned char *input, int length, int *len
// create encoder chain
// create encoder chain
bmem
=
BIO_push
(
b64
,
bmem
);
bmem
=
BIO_push
(
b64
,
bmem
);
*
length_out
=
BIO_read
(
bmem
,
buffer
,
length
);
char
*
buffer
=
new
char
[
length
];
memset
(
buffer
,
0
,
length
);
BIO_read
(
bmem
,
buffer
,
length
);
BIO_free_all
(
bmem
);
BIO_free_all
(
bmem
);
return
buffer
;
return
buffer
;
}
}
}
}
This diff is collapsed.
Click to expand it.
sflphone-common/src/audio/audiortp/AudioSrtpSession.h
+
1
−
1
View file @
44f0d4ea
...
@@ -160,7 +160,7 @@ class AudioSrtpSession : public AudioRtpSession
...
@@ -160,7 +160,7 @@ class AudioSrtpSession : public AudioRtpSession
/**
/**
* Decode base64 data
* Decode base64 data
*/
*/
char
*
decodeBase64
(
unsigned
char
*
input
,
int
length
,
int
*
length_out
);
char
*
decodeBase64
(
unsigned
char
*
input
,
int
length
);
/** Default local crypto suite is AES_CM_128_HMAC_SHA1_80*/
/** Default local crypto suite is AES_CM_128_HMAC_SHA1_80*/
int
_localCryptoSuite
;
int
_localCryptoSuite
;
...
...
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