summaryrefslogtreecommitdiffstats
path: root/meta/recipes-support/gnutls/gnutls-2.12.18/gnutls-openssl.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-support/gnutls/gnutls-2.12.18/gnutls-openssl.patch')
-rw-r--r--meta/recipes-support/gnutls/gnutls-2.12.18/gnutls-openssl.patch126
1 files changed, 126 insertions, 0 deletions
diff --git a/meta/recipes-support/gnutls/gnutls-2.12.18/gnutls-openssl.patch b/meta/recipes-support/gnutls/gnutls-2.12.18/gnutls-openssl.patch
new file mode 100644
index 0000000000..ef70674881
--- /dev/null
+++ b/meta/recipes-support/gnutls/gnutls-2.12.18/gnutls-openssl.patch
@@ -0,0 +1,126 @@
1Upstream-Status: Backport
2
3Index: gnutls-1.6.0/libextra/gnutls_openssl.c
4===================================================================
5--- gnutls-1.6.0.orig/libextra/gnutls_openssl.c 2006-08-13 22:34:09.000000000 +0200
6+++ gnutls-1.6.0/libextra/gnutls_openssl.c 2006-12-12 15:07:59.002227000 +0100
7@@ -256,12 +256,17 @@
8 ssl->rfd = (gnutls_transport_ptr_t) - 1;
9 ssl->wfd = (gnutls_transport_ptr_t) - 1;
10
11+ ssl->ssl_peek_buffer = NULL;
12+ ssl->ssl_peek_buffer_size = ssl->ssl_peek_avail = 0;
13+
14 return ssl;
15 }
16
17 void
18 SSL_free (SSL * ssl)
19 {
20+ if (ssl->ssl_peek_buffer)
21+ free(ssl->ssl_peek_buffer);
22 gnutls_certificate_free_credentials (ssl->gnutls_cred);
23 gnutls_deinit (ssl->gnutls_state);
24 free (ssl);
25@@ -285,6 +290,7 @@
26 SSL_set_fd (SSL * ssl, int fd)
27 {
28 gnutls_transport_set_ptr (ssl->gnutls_state, GNUTLS_INT_TO_POINTER (fd));
29+ ssl->rfd = ssl->wfd = fd;
30 return 1;
31 }
32
33@@ -310,6 +316,17 @@
34 return 1;
35 }
36
37+int SSL_get_rfd(SSL *ssl)
38+{
39+ return ssl->rfd;
40+}
41+
42+int SSL_get_wfd(SSL *ssl)
43+{
44+ return ssl->wfd;
45+}
46+
47+
48 void
49 SSL_set_bio (SSL * ssl, BIO * rbio, BIO * wbio)
50 {
51@@ -325,6 +342,8 @@
52 int
53 SSL_pending (SSL * ssl)
54 {
55+ if (ssl->ssl_peek_avail)
56+ return ssl->ssl_peek_avail;
57 return gnutls_record_check_pending (ssl->gnutls_state);
58 }
59
60@@ -480,11 +499,50 @@
61 return 1;
62 }
63
64+int SSL_peek(SSL *ssl, void *buf, int len)
65+{
66+ if (len > ssl->ssl_peek_buffer_size) {
67+ ssl->ssl_peek_buffer = realloc (ssl->ssl_peek_buffer, len);
68+ ssl->ssl_peek_buffer_size = len;
69+ }
70+
71+ if (ssl->ssl_peek_avail == 0) {
72+
73+ int ret;
74+
75+ ret = gnutls_record_recv(ssl->gnutls_state, ssl->ssl_peek_buffer, len);
76+ ssl->last_error = ret;
77+
78+ if (ret > 0)
79+ ssl->ssl_peek_avail += ret;
80+ }
81+
82+ if (len > ssl->ssl_peek_avail)
83+ len = ssl->ssl_peek_avail;
84+
85+ memcpy (buf, ssl->ssl_peek_buffer, len);
86+
87+ return len;
88+}
89+
90 int
91 SSL_read (SSL * ssl, void *buf, int len)
92 {
93 int ret;
94
95+ if (ssl->ssl_peek_avail) {
96+ int n = (ssl->ssl_peek_avail > len) ? len : ssl->ssl_peek_avail;
97+
98+ memcpy (buf, ssl->ssl_peek_buffer, n);
99+
100+ if (ssl->ssl_peek_avail > n)
101+ memmove (ssl->ssl_peek_buffer, ssl->ssl_peek_buffer + n, ssl->ssl_peek_avail - n);
102+
103+ ssl->ssl_peek_avail -= n;
104+
105+ return n;
106+ }
107+
108 ret = gnutls_record_recv (ssl->gnutls_state, buf, len);
109 ssl->last_error = ret;
110
111Index: gnutls-1.6.0/includes/gnutls/openssl.h
112===================================================================
113--- gnutls-1.6.0.orig/libextra/includes/gnutls/openssl.h 2006-03-08 11:44:58.000000000 +0100
114+++ gnutls-1.6.0/libextra/includes/gnutls/openssl.h 2006-12-12 15:07:26.032227000 +0100
115@@ -164,6 +164,11 @@
116
117 gnutls_transport_ptr_t rfd;
118 gnutls_transport_ptr_t wfd;
119+
120+ char *ssl_peek_buffer;
121+ size_t ssl_peek_buffer_size;
122+ size_t ssl_peek_avail;
123+
124 };
125
126 #define rbio gnutls_state