test_recv_LDADD = libvlc_srtp.la
test_aes_LDADD = @GCRYPT_LIBS@
-if !HAVE_WIN32
-libvlc_srtp_la_LIBADD += -lpthread
-test_aes_LDADD += -lpthread
-endif
-
lcov-run:
rm -Rf *.gcda lcov
$(MAKE) $(AM_MAKEFLAGS) check
# include <winsock2.h>
#else
# include <netinet/in.h>
-# include <pthread.h>
-GCRY_THREAD_OPTION_PTHREAD_IMPL;
#endif
#define debug( ... ) (void)0
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)
{
srtp_session_t *
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;
int cipher, md;
#include "rtp.h"
#ifdef HAVE_SRTP
# include <srtp.h>
+# include <gcrypt.h>
+# include <vlc_gcrypt.h>
#endif
#define RTP_CACHING_TEXT N_("RTP de-jitter buffer length (msec)")
char *key = var_CreateGetNonEmptyString (demux, "srtp-key");
if (key)
{
+ vlc_gcrypt_init ();
p_sys->srtp = srtp_create (SRTP_ENCR_AES_CM, SRTP_AUTH_HMAC_SHA1, 10,
SRTP_PRF_AES_CM, SRTP_RCC_MODE1);
if (p_sys->srtp == NULL)
#include <vlc_rand.h>
#ifdef HAVE_SRTP
# include <srtp.h>
+# include <gcrypt.h>
+# include <vlc_gcrypt.h>
#endif
#include "rtp.h"
char *key = var_GetNonEmptyString (p_stream, SOUT_CFG_PREFIX"key");
if (key)
{
+ vlc_gcrypt_init ();
id->srtp = srtp_create (SRTP_ENCR_AES_CM, SRTP_AUTH_HMAC_SHA1, 10,
SRTP_PRF_AES_CM, SRTP_RCC_MODE1);
if (id->srtp == NULL)