diff mbox

[099/131] gnutls: Add version 3.1.5

Message ID 655ca84eaca051b9a329d90ac75e25042a19a32e.1389702652.git.christian.braunersorensen@prevas.dk
State Accepted
Delegated to: Esben Haabendal
Headers show

Commit Message

christian.braunersorensen@prevas.dk Jan. 14, 2014, 12:34 p.m. UTC
From: Christian Sørensen <christian.braunersorensen@prevas.dk>

Signed-off-by: Christian Sørensen <christian.braunersorensen@prevas.dk>
---
 .../correct_rpl_gettimeofday_signature.patch       |  57 ++++++++++
 recipes/gnutls/gnutls-3.1.5/gnutls-openssl.patch   | 126 +++++++++++++++++++++
 recipes/gnutls/gnutls_3.1.5.oe                     |  21 ++++
 recipes/gnutls/gnutls_3.1.5.oe.sig                 |   2 +
 4 files changed, 206 insertions(+)
 create mode 100644 recipes/gnutls/gnutls-3.1.5/correct_rpl_gettimeofday_signature.patch
 create mode 100644 recipes/gnutls/gnutls-3.1.5/gnutls-openssl.patch
 create mode 100644 recipes/gnutls/gnutls_3.1.5.oe
 create mode 100644 recipes/gnutls/gnutls_3.1.5.oe.sig
diff mbox

Patch

diff --git a/recipes/gnutls/gnutls-3.1.5/correct_rpl_gettimeofday_signature.patch b/recipes/gnutls/gnutls-3.1.5/correct_rpl_gettimeofday_signature.patch
new file mode 100644
index 0000000..b8f0d72
--- /dev/null
+++ b/recipes/gnutls/gnutls-3.1.5/correct_rpl_gettimeofday_signature.patch
@@ -0,0 +1,57 @@ 
+Currently we fail on uclibc like below
+
+| In file included from /home/kraj/work/angstrom/sources/openembedded-core/build/tmp-uclibc/sysroots/qemuarm/usr/include/sys/procfs.h:32:0,
+|                  from /home/kraj/work/angstrom/sources/openembedded-core/build/tmp-uclibc/sysroots/qemuarm/usr/include/sys/ucontext.h:26,
+|                  from /home/kraj/work/angstrom/sources/openembedded-core/build/tmp-uclibc/sysroots/qemuarm/usr/include/signal.h:392,
+|                  from ../../gl/signal.h:52,
+|                  from ../../gl/sys/select.h:58,
+|                  from /home/kraj/work/angstrom/sources/openembedded-core/build/tmp-uclibc/sysroots/qemuarm/usr/include/sys/types.h:220,
+|                  from ../../gl/sys/types.h:28,
+|                  from ../../lib/includes/gnutls/gnutls.h:46,
+|                  from ex-cxx.cpp:3:
+| ../../gl/sys/time.h:396:66: error: conflicting declaration 'void* restrict'
+| ../../gl/sys/time.h:396:50: error: 'restrict' has a previous declaration as 'timeval* restrict'
+| make[4]: *** [ex-cxx.o] Error 1
+| make[4]: *** Waiting for unfinished jobs....
+
+
+GCC detects that we call 'restrict' as param name in function
+signatures and complains since both params are called 'restrict'
+therefore we use __restrict to denote the C99 keywork
+
+This only happens of uclibc since this code is not excercised with
+eglibc otherwise we will have same issue there too
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+
+Upstream-Status: Pending
+
+Index: gnutls-2.12.14/gl/sys_time.in.h
+===================================================================
+--- gnutls-2.12.14.orig/gl/sys_time.in.h	2012-01-15 10:54:39.517285351 -0800
++++ gnutls-2.12.14/gl/sys_time.in.h	2012-01-15 10:59:23.773299108 -0800
+@@ -82,20 +82,20 @@
+ #    define gettimeofday rpl_gettimeofday
+ #   endif
+ _GL_FUNCDECL_RPL (gettimeofday, int,
+-                  (struct timeval *restrict, void *restrict)
++                  (struct timeval *__restrict, void *__restrict)
+                   _GL_ARG_NONNULL ((1)));
+ _GL_CXXALIAS_RPL (gettimeofday, int,
+-                  (struct timeval *restrict, void *restrict));
++                  (struct timeval *__restrict, void *__restrict));
+ #  else
+ #   if !@HAVE_GETTIMEOFDAY@
+ _GL_FUNCDECL_SYS (gettimeofday, int,
+-                  (struct timeval *restrict, void *restrict)
++                  (struct timeval *__restrict, void *__restrict)
+                   _GL_ARG_NONNULL ((1)));
+ #   endif
+ /* Need to cast, because on glibc systems, by default, the second argument is
+                                                   struct timezone *.  */
+ _GL_CXXALIAS_SYS_CAST (gettimeofday, int,
+-                       (struct timeval *restrict, void *restrict));
++                       (struct timeval *__restrict, void *__restrict));
+ #  endif
+ _GL_CXXALIASWARN (gettimeofday);
+ # elif defined GNULIB_POSIXCHECK
diff --git a/recipes/gnutls/gnutls-3.1.5/gnutls-openssl.patch b/recipes/gnutls/gnutls-3.1.5/gnutls-openssl.patch
new file mode 100644
index 0000000..ea6f793
--- /dev/null
+++ b/recipes/gnutls/gnutls-3.1.5/gnutls-openssl.patch
@@ -0,0 +1,126 @@ 
+Upstream-Status: Backport
+
+Index: gnutls-1.6.0/extra/gnutls_openssl.c
+===================================================================
+--- gnutls-1.6.0.orig/extra/gnutls_openssl.c	2006-08-13 22:34:09.000000000 +0200
++++ gnutls-1.6.0/extra/gnutls_openssl.c	2006-12-12 15:07:59.002227000 +0100
+@@ -256,12 +256,17 @@
+   ssl->rfd = (gnutls_transport_ptr_t) - 1;
+   ssl->wfd = (gnutls_transport_ptr_t) - 1;
+ 
++  ssl->ssl_peek_buffer = NULL;
++  ssl->ssl_peek_buffer_size = ssl->ssl_peek_avail = 0;
++
+   return ssl;
+ }
+ 
+ void
+ SSL_free (SSL * ssl)
+ {
++  if (ssl->ssl_peek_buffer)
++    free(ssl->ssl_peek_buffer);
+   gnutls_certificate_free_credentials (ssl->gnutls_cred);
+   gnutls_deinit (ssl->gnutls_state);
+   free (ssl);
+@@ -285,6 +290,7 @@
+ SSL_set_fd (SSL * ssl, int fd)
+ {
+   gnutls_transport_set_ptr (ssl->gnutls_state, GNUTLS_INT_TO_POINTER (fd));
++  ssl->rfd = ssl->wfd = fd;
+   return 1;
+ }
+ 
+@@ -310,6 +316,17 @@
+   return 1;
+ }
+ 
++int SSL_get_rfd(SSL *ssl)
++{
++  return ssl->rfd;
++}
++
++int SSL_get_wfd(SSL *ssl)
++{
++  return ssl->wfd;
++}
++
++
+ void
+ SSL_set_bio (SSL * ssl, BIO * rbio, BIO * wbio)
+ {
+@@ -325,6 +342,8 @@
+ int
+ SSL_pending (SSL * ssl)
+ {
++  if (ssl->ssl_peek_avail)
++    return ssl->ssl_peek_avail;
+   return gnutls_record_check_pending (ssl->gnutls_state);
+ }
+ 
+@@ -480,11 +499,50 @@
+   return 1;
+ }
+ 
++int SSL_peek(SSL *ssl, void *buf, int len)
++{
++  if (len > ssl->ssl_peek_buffer_size) {
++    ssl->ssl_peek_buffer = realloc (ssl->ssl_peek_buffer, len);
++    ssl->ssl_peek_buffer_size = len;
++  }
++
++  if (ssl->ssl_peek_avail == 0) {
++
++    int ret;
++    
++    ret = gnutls_record_recv(ssl->gnutls_state, ssl->ssl_peek_buffer, len);
++    ssl->last_error = ret;
++    
++    if (ret > 0)
++      ssl->ssl_peek_avail += ret;
++  }
++
++  if (len > ssl->ssl_peek_avail)
++    len = ssl->ssl_peek_avail;
++
++  memcpy (buf, ssl->ssl_peek_buffer, len);
++
++  return len;
++}
++
+ int
+ SSL_read (SSL * ssl, void *buf, int len)
+ {
+   int ret;
+ 
++  if (ssl->ssl_peek_avail) {
++    int n = (ssl->ssl_peek_avail > len) ? len : ssl->ssl_peek_avail;
++
++    memcpy (buf, ssl->ssl_peek_buffer, n);
++
++    if (ssl->ssl_peek_avail > n)
++      memmove (ssl->ssl_peek_buffer, ssl->ssl_peek_buffer + n, ssl->ssl_peek_avail - n);
++
++    ssl->ssl_peek_avail -= n;
++
++    return n;
++  }
++
+   ret = gnutls_record_recv (ssl->gnutls_state, buf, len);
+   ssl->last_error = ret;
+ 
+Index: gnutls-1.6.0/includes/gnutls/openssl.h
+===================================================================
+--- gnutls-1.6.0.orig/extra/includes/gnutls/openssl.h	2006-03-08 11:44:58.000000000 +0100
++++ gnutls-1.6.0/extra/includes/gnutls/openssl.h	2006-12-12 15:07:26.032227000 +0100
+@@ -164,6 +164,11 @@
+ 
+     gnutls_transport_ptr_t rfd;
+     gnutls_transport_ptr_t wfd;
++
++    char *ssl_peek_buffer;
++    size_t ssl_peek_buffer_size;
++    size_t ssl_peek_avail;
++
+   };
+ 
+ #define rbio gnutls_state
diff --git a/recipes/gnutls/gnutls_3.1.5.oe b/recipes/gnutls/gnutls_3.1.5.oe
new file mode 100644
index 0000000..7d7bd9e
--- /dev/null
+++ b/recipes/gnutls/gnutls_3.1.5.oe
@@ -0,0 +1,21 @@ 
+require gnutls.inc
+
+DEPENDS += "libnettle-dev libnettle nettle-dev libhogweed libhogweed-dev"
+
+LICENSE = "GPLv3+ & LGPLv2.1+"
+LICENSE_${PN} = "LGPLv2.1+"
+LICENSE_${PN}-xx = "LGPLv2.1+"
+LICENSE_${PN}-bin = "GPLv3+"
+LICENSE_${PN}-extra = "GPLv3+"
+LICENSE_${PN}-openssl = "GPLv3+"
+
+require conf/fetch/gnu.conf
+SRC_URI += "${GNU_MIRROR}/gnutls/gnutls-${PV}.tar.xz"
+
+SRC_URI += "file://gnutls-openssl.patch"
+SRC_URI += "file://correct_rpl_gettimeofday_signature.patch"
+
+PARALLEL_MAKE = ""
+
+LIBRARY_VERSION = "28"
+LIBRARY_VERSION_${PN}-libgnutls-openssl = "27"
diff --git a/recipes/gnutls/gnutls_3.1.5.oe.sig b/recipes/gnutls/gnutls_3.1.5.oe.sig
new file mode 100644
index 0000000..f015d62
--- /dev/null
+++ b/recipes/gnutls/gnutls_3.1.5.oe.sig
@@ -0,0 +1,2 @@ 
+da39a3ee5e6b4b0d3255bfef95601890afd80709  gnutls-3.1.5.tar.bz2
+93efeab75cad6f656eae1123c10e3692db727bd5  gnutls-3.1.5.tar.xz