[vlc-commits] Move libs/srtp/* to modules/access/rtp/

Rémi Denis-Courmont git at videolan.org
Tue Aug 30 20:44:31 CEST 2011


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Tue Aug 30 20:02:50 2011 +0300| [b00db8ce608789faa8e37b48ead95f99a34ae13a] | committer: Rémi Denis-Courmont

Move libs/srtp/* to modules/access/rtp/

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=b00db8ce608789faa8e37b48ead95f99a34ae13a
---

 Makefile.am                                        |    3 -
 configure.ac                                       |    1 -
 libs/srtp/.gitignore                               |    2 -
 libs/srtp/Makefile.am                              |   48 ----------
 libs/srtp/recv.c                                   |   93 --------------------
 modules/access/rtp/.gitignore                      |    2 +
 modules/access/rtp/Modules.am                      |   40 ++++++++-
 .../access/rtp/srtp-test-aes.c                     |    0
 .../access/rtp/srtp-test-recv.c                    |    0
 {libs/srtp => modules/access/rtp}/srtp.c           |    0
 {libs/srtp => modules/access/rtp}/srtp.h           |    0
 modules/stream_out/Modules.am                      |    4 +-
 12 files changed, 39 insertions(+), 154 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 2598ba4..0138389 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -13,9 +13,6 @@ EXTRA_SUBDIRS = m4 \
 DIST_SUBDIRS = $(BASE_SUBDIRS) $(EXTRA_SUBDIRS)
 
 SUBDIRS = po compat src
-if HAVE_GCRYPT
-SUBDIRS += libs/srtp
-endif
 if BUILD_VLC
 SUBDIRS += bin
 endif
diff --git a/configure.ac b/configure.ac
index 277e6e5..781db98 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4259,7 +4259,6 @@ AC_SUBST(FILE_LIBVLC_DLL)
 AC_CONFIG_FILES([
   Makefile
   doc/Makefile
-  libs/srtp/Makefile
   modules/Makefile
   m4/Makefile
   po/Makefile.in
diff --git a/libs/srtp/.gitignore b/libs/srtp/.gitignore
deleted file mode 100644
index 717a5e6..0000000
--- a/libs/srtp/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-test-aes
-test-recv
diff --git a/libs/srtp/Makefile.am b/libs/srtp/Makefile.am
deleted file mode 100644
index b90bed1..0000000
--- a/libs/srtp/Makefile.am
+++ /dev/null
@@ -1,48 +0,0 @@
-# Secure RTP with libgcrypt
-# Copyright (C) 2007  Rémi Denis-Courmont
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2.1 of the License, or (at your option) any later version.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-
-AM_CPPFLAGS = @GCRYPT_CFLAGS@
-
-noinst_HEADERS = srtp.h
-
-EXTRA_PROGRAMS = srtp
-noinst_LTLIBRARIES = libvlc_srtp.la
-check_PROGRAMS = test-aes test-recv
-TESTS = $(check_PROGRAMS)
-
-libvlc_srtp_la_SOURCES = srtp.c
-libvlc_srtp_la_LIBADD = @GCRYPT_LIBS@
-
-srtp_SOURCES = recv.c
-srtp_LDADD = libvlc_srtp.la
-test_recv_LDADD = libvlc_srtp.la
-test_aes_LDADD = @GCRYPT_LIBS@
-
-lcov-run:
-	rm -Rf *.gcda lcov
-	$(MAKE) $(AM_MAKEFLAGS) check
-
-lcov-pre.out:
-	lcov -c -d . -o lcov.tmp
-
-lcov.out: lcov-pre.out
-	lcov -r lcov.tmp '*test*' > lcov.out
-
-lcov: lcov.out
-	genhtml lcov.out -o lcov
-
-.PHONY: lcov-run
diff --git a/libs/srtp/recv.c b/libs/srtp/recv.c
deleted file mode 100644
index 5abac52..0000000
--- a/libs/srtp/recv.c
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Secure RTP with libgcrypt
- * Copyright (C) 2007  Rémi Denis-Courmont
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
- */
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include <stdint.h>
-#include <stddef.h>
-#include "srtp.h"
-
-#include <stdio.h>
-#include <string.h>
-
-#include <unistd.h>
-#include <netinet/in.h>
-
-int main (void)
-{
-    int fd = socket (AF_INET, SOCK_DGRAM, 0);
-    struct sockaddr_in addr;
-    memset (&addr, 0, sizeof (addr));
-    addr.sin_family = AF_INET;
-#ifdef HAVE_SA_LEN
-    addr.sin_len = sizeof (addr);
-#endif
-    addr.sin_port = htons (10000);
-    addr.sin_addr.s_addr = htonl (0x7f000001);
-    if (bind (fd, (struct sockaddr *)&addr, sizeof (addr)))
-        return 1;
-
-    static const uint8_t key[16] =
-        "\x12\x34\x56\x78\x9A\xBC\xDE\xF0"
-        "\x12\x34\x56\x78\x9A\xBC\xDE\xF0";
-    static const uint8_t salt[14] =
-        "\x12\x34\x56\x78\x90" "\x12\x34\x56\x78\x90" "\x12\x34\x56\x78";
-
-    srtp_session_t *s = srtp_create (SRTP_ENCR_AES_CM, SRTP_AUTH_HMAC_SHA1, 10,
-                                     SRTP_PRF_AES_CM, 0);
-    if (s == NULL)
-        return 1;
-    if (srtp_setkey (s, key, 16, salt, 14))
-        goto error;
-
-    uint8_t buf[1500];
-    size_t len;
-#if 0
-    memset (buf, 0, sizeof (buf));
-    buf[0] = 2 << 6;
-    buf[1] = 1;
-    memcpy (buf + 2, &(uint16_t){ htons (9527) }, 2);
-    memcpy (buf + 8, "\xde\xad\xbe\xef", 4);
-    memcpy (buf + 4, &(uint32_t){ htonl (1) }, 4);
-    strcpy ((char *)buf + 12, "a\n");
-    len = 12 + strlen ((char *)buf + 12) + 1;
-#endif
-    for (;;)
-    {
-        len = read (fd, buf, sizeof (buf));
-        int val = srtp_recv (s, buf, &len);
-        if (val)
-        {
-            fprintf (stderr, "Cannot decrypt: %s\n", strerror (val));
-            continue;
-        }
-
-        puts ((char *)buf + 12);
-        //if (srtp_send (s, buf, &len, sizeof (buf)) || srtp_recv (s, buf, &len))
-        //    break;
-        puts ((char *)buf + 12);
-    }
-
-error:
-    srtp_destroy (s);
-    close (fd);
-    return 0;
-}
diff --git a/modules/access/rtp/.gitignore b/modules/access/rtp/.gitignore
new file mode 100644
index 0000000..c41c5cb
--- /dev/null
+++ b/modules/access/rtp/.gitignore
@@ -0,0 +1,2 @@
+srtp-test-aes
+srtp-test-recv
diff --git a/modules/access/rtp/Modules.am b/modules/access/rtp/Modules.am
index cbb4736..824cff2 100644
--- a/modules/access/rtp/Modules.am
+++ b/modules/access/rtp/Modules.am
@@ -11,10 +11,40 @@ librtp_plugin_la_CFLAGS = $(AM_CFLAGS)
 librtp_plugin_la_LIBADD = $(AM_LIBADD) $(SOCKET_LIBS)
 librtp_plugin_la_DEPENDENCIES =
 
+# Secure RTP library
+libvlc_srtp_la_SOURCES = srtp.c
+libvlc_srtp_la_CPPFLAGS =
+libvlc_srtp_la_CFLAGS = $(GCRYPT_CFLAGS)
+libvlc_srtp_la_LDFLAGS =
+libvlc_srtp_la_LIBADD = $(GCRYPT_LIBS)
+srtp_test_recv_CPPFLAGS =
+srtp_test_recv_LDADD = libvlc_srtp.la
+srtp_test_aes_CPPFLAGS =
+srtp_test_aes_LDADD = $(GCRYPT_LIBS)
+
 if HAVE_GCRYPT
-librtp_plugin_la_CFLAGS += -DHAVE_SRTP -I$(top_srcdir)/libs/srtp \
-	$(GCRYPT_CFLAGS)
-librtp_plugin_la_LIBADD += $(top_builddir)/libs/srtp/libvlc_srtp.la \
-	$(GCRYPT_LIBS)
-librtp_plugin_la_DEPENDENCIES += $(top_builddir)/libs/srtp/libvlc_srtp.la
+noinst_HEADERS = srtp.h
+noinst_LTLIBRARIES = libvlc_srtp.la
+
+check_PROGRAMS = srtp-test-aes srtp-test-recv
+TESTS = $(check_PROGRAMS)
+
+librtp_plugin_la_CFLAGS += -DHAVE_SRTP $(GCRYPT_CFLAGS)
+librtp_plugin_la_LIBADD += libvlc_srtp.la $(GCRYPT_LIBS)
+librtp_plugin_la_DEPENDENCIES += libvlc_srtp.la
 endif
+
+lcov-run:
+	rm -Rf *.gcda lcov
+	$(MAKE) $(AM_MAKEFLAGS) check
+
+lcov-pre.out:
+	lcov -c -d . -o lcov.tmp
+
+lcov.out: lcov-pre.out
+	lcov -r lcov.tmp '*test*' > lcov.out
+
+lcov: lcov.out
+	genhtml lcov.out -o lcov
+
+.PHONY: lcov-run
diff --git a/libs/srtp/test-aes.c b/modules/access/rtp/srtp-test-aes.c
similarity index 100%
rename from libs/srtp/test-aes.c
rename to modules/access/rtp/srtp-test-aes.c
diff --git a/libs/srtp/test-recv.c b/modules/access/rtp/srtp-test-recv.c
similarity index 100%
rename from libs/srtp/test-recv.c
rename to modules/access/rtp/srtp-test-recv.c
diff --git a/libs/srtp/srtp.c b/modules/access/rtp/srtp.c
similarity index 100%
rename from libs/srtp/srtp.c
rename to modules/access/rtp/srtp.c
diff --git a/libs/srtp/srtp.h b/modules/access/rtp/srtp.h
similarity index 100%
rename from libs/srtp/srtp.h
rename to modules/access/rtp/srtp.h
diff --git a/modules/stream_out/Modules.am b/modules/stream_out/Modules.am
index b1fa089..8c24a49 100644
--- a/modules/stream_out/Modules.am
+++ b/modules/stream_out/Modules.am
@@ -47,8 +47,8 @@ libstream_out_rtp_plugin_la_CFLAGS = $(AM_CFLAGS)
 libstream_out_rtp_plugin_la_LIBADD = $(AM_LIBADD) $(SOCKET_LIBS)
 libstream_out_rtp_plugin_la_DEPENDENCIES =
 if HAVE_GCRYPT
-SRTP_CFLAGS = -I$(top_srcdir)/libs/srtp
-SRTP_LIBS = $(top_builddir)/libs/srtp/libvlc_srtp.la
+SRTP_CFLAGS = -I$(top_srcdir)/modules/access/rtp
+SRTP_LIBS = $(top_builddir)/modules/access/rtp/libvlc_srtp.la
 libstream_out_rtp_plugin_la_CFLAGS += -DHAVE_SRTP $(SRTP_CFLAGS) \
 	$(GCRYPT_CFLAGS)
 libstream_out_rtp_plugin_la_LIBADD += $(SRTP_LIBS) $(GCRYPT_LIBS)



More information about the vlc-commits mailing list