Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc-2-2
Commits
f1a8ab79
Commit
f1a8ab79
authored
Jul 19, 2011
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SRTP: remove dedicated gcrypt initialization, use VLC one
Signed-off-by:
Rémi Denis-Courmont
<
remi@remlab.net
>
parent
dc24a336
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
7 additions
and
45 deletions
+7
-45
libs/srtp/Makefile.am
libs/srtp/Makefile.am
+0
-5
libs/srtp/srtp.c
libs/srtp/srtp.c
+1
-38
libs/srtp/test-aes.c
libs/srtp/test-aes.c
+0
-2
modules/access/rtp/rtp.c
modules/access/rtp/rtp.c
+3
-0
modules/stream_out/rtp.c
modules/stream_out/rtp.c
+3
-0
No files found.
libs/srtp/Makefile.am
View file @
f1a8ab79
...
@@ -32,11 +32,6 @@ srtp_LDADD = libvlc_srtp.la
...
@@ -32,11 +32,6 @@ srtp_LDADD = libvlc_srtp.la
test_recv_LDADD
=
libvlc_srtp.la
test_recv_LDADD
=
libvlc_srtp.la
test_aes_LDADD
=
@GCRYPT_LIBS@
test_aes_LDADD
=
@GCRYPT_LIBS@
if
!HAVE_WIN32
libvlc_srtp_la_LIBADD
+=
-lpthread
test_aes_LDADD
+=
-lpthread
endif
lcov-run
:
lcov-run
:
rm
-Rf
*
.gcda lcov
rm
-Rf
*
.gcda lcov
$(MAKE)
$(AM_MAKEFLAGS)
check
$(MAKE)
$(AM_MAKEFLAGS)
check
...
...
libs/srtp/srtp.c
View file @
f1a8ab79
...
@@ -43,8 +43,6 @@
...
@@ -43,8 +43,6 @@
# include <winsock2.h>
# include <winsock2.h>
#else
#else
# include <netinet/in.h>
# include <netinet/in.h>
# include <pthread.h>
GCRY_THREAD_OPTION_PTHREAD_IMPL
;
#endif
#endif
#define debug( ... ) (void)0
#define debug( ... ) (void)0
...
@@ -86,41 +84,6 @@ static inline unsigned rcc_mode (const srtp_session_t *s)
...
@@ -86,41 +84,6 @@ static inline unsigned rcc_mode (const srtp_session_t *s)
return
(
s
->
flags
>>
4
)
&
3
;
return
(
s
->
flags
>>
4
)
&
3
;
}
}
static
bool
libgcrypt_usable
=
false
;
static
void
initonce_libgcrypt
(
void
)
{
#ifndef WIN32
gcry_control
(
GCRYCTL_SET_THREAD_CBS
,
&
gcry_threads_pthread
);
#endif
if
((
gcry_check_version
(
"1.1.94"
)
==
NULL
)
||
gcry_control
(
GCRYCTL_DISABLE_SECMEM
,
0
)
||
gcry_control
(
GCRYCTL_INITIALIZATION_FINISHED
,
0
))
return
;
libgcrypt_usable
=
true
;
}
static
int
init_libgcrypt
(
void
)
{
int
retval
;
#ifndef WIN32
static
pthread_once_t
once
=
PTHREAD_ONCE_INIT
;
pthread_once
(
&
once
,
initonce_libgcrypt
);
#else
# warning FIXME: This is not thread-safe.
if
(
!
libgcrypt_usable
)
initonce_libgcrypt
();
#endif
retval
=
libgcrypt_usable
?
0
:
-
1
;
return
retval
;
}
static
void
proto_destroy
(
srtp_proto_t
*
p
)
static
void
proto_destroy
(
srtp_proto_t
*
p
)
{
{
...
@@ -170,7 +133,7 @@ static int proto_create (srtp_proto_t *p, int gcipher, int gmd)
...
@@ -170,7 +133,7 @@ static int proto_create (srtp_proto_t *p, int gcipher, int gmd)
srtp_session_t
*
srtp_session_t
*
srtp_create
(
int
encr
,
int
auth
,
unsigned
tag_len
,
int
prf
,
unsigned
flags
)
srtp_create
(
int
encr
,
int
auth
,
unsigned
tag_len
,
int
prf
,
unsigned
flags
)
{
{
if
((
flags
&
~
SRTP_FLAGS_MASK
)
||
init_libgcrypt
()
)
if
((
flags
&
~
SRTP_FLAGS_MASK
))
return
NULL
;
return
NULL
;
int
cipher
,
md
;
int
cipher
,
md
;
...
...
libs/srtp/test-aes.c
View file @
f1a8ab79
...
@@ -143,8 +143,6 @@ static void test_keystream (void)
...
@@ -143,8 +143,6 @@ static void test_keystream (void)
static
void
srtp_test
(
void
)
static
void
srtp_test
(
void
)
{
{
if
(
init_libgcrypt
())
fatal
(
"Libgcrypt initialization error"
);
test_derivation
();
test_derivation
();
test_keystream
();
test_keystream
();
}
}
...
...
modules/access/rtp/rtp.c
View file @
f1a8ab79
...
@@ -37,6 +37,8 @@
...
@@ -37,6 +37,8 @@
#include "rtp.h"
#include "rtp.h"
#ifdef HAVE_SRTP
#ifdef HAVE_SRTP
# include <srtp.h>
# include <srtp.h>
# include <gcrypt.h>
# include <vlc_gcrypt.h>
#endif
#endif
#define RTP_CACHING_TEXT N_("RTP de-jitter buffer length (msec)")
#define RTP_CACHING_TEXT N_("RTP de-jitter buffer length (msec)")
...
@@ -285,6 +287,7 @@ static int Open (vlc_object_t *obj)
...
@@ -285,6 +287,7 @@ static int Open (vlc_object_t *obj)
char
*
key
=
var_CreateGetNonEmptyString
(
demux
,
"srtp-key"
);
char
*
key
=
var_CreateGetNonEmptyString
(
demux
,
"srtp-key"
);
if
(
key
)
if
(
key
)
{
{
vlc_gcrypt_init
();
p_sys
->
srtp
=
srtp_create
(
SRTP_ENCR_AES_CM
,
SRTP_AUTH_HMAC_SHA1
,
10
,
p_sys
->
srtp
=
srtp_create
(
SRTP_ENCR_AES_CM
,
SRTP_AUTH_HMAC_SHA1
,
10
,
SRTP_PRF_AES_CM
,
SRTP_RCC_MODE1
);
SRTP_PRF_AES_CM
,
SRTP_RCC_MODE1
);
if
(
p_sys
->
srtp
==
NULL
)
if
(
p_sys
->
srtp
==
NULL
)
...
...
modules/stream_out/rtp.c
View file @
f1a8ab79
...
@@ -42,6 +42,8 @@
...
@@ -42,6 +42,8 @@
#include <vlc_rand.h>
#include <vlc_rand.h>
#ifdef HAVE_SRTP
#ifdef HAVE_SRTP
# include <srtp.h>
# include <srtp.h>
# include <gcrypt.h>
# include <vlc_gcrypt.h>
#endif
#endif
#include "rtp.h"
#include "rtp.h"
...
@@ -995,6 +997,7 @@ static sout_stream_id_t *Add( sout_stream_t *p_stream, es_format_t *p_fmt )
...
@@ -995,6 +997,7 @@ static sout_stream_id_t *Add( sout_stream_t *p_stream, es_format_t *p_fmt )
char
*
key
=
var_GetNonEmptyString
(
p_stream
,
SOUT_CFG_PREFIX
"key"
);
char
*
key
=
var_GetNonEmptyString
(
p_stream
,
SOUT_CFG_PREFIX
"key"
);
if
(
key
)
if
(
key
)
{
{
vlc_gcrypt_init
();
id
->
srtp
=
srtp_create
(
SRTP_ENCR_AES_CM
,
SRTP_AUTH_HMAC_SHA1
,
10
,
id
->
srtp
=
srtp_create
(
SRTP_ENCR_AES_CM
,
SRTP_AUTH_HMAC_SHA1
,
10
,
SRTP_PRF_AES_CM
,
SRTP_RCC_MODE1
);
SRTP_PRF_AES_CM
,
SRTP_RCC_MODE1
);
if
(
id
->
srtp
==
NULL
)
if
(
id
->
srtp
==
NULL
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment