All of lore.kernel.org
 help / color / mirror / Atom feed
From: Rahul Bedarkar <rahul.bedarkar@imgtec.com>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH 2/2] wget: fix static link with gnutls
Date: Wed, 9 Nov 2016 00:06:42 +0530	[thread overview]
Message-ID: <1478630202-1630-2-git-send-email-rahul.bedarkar@imgtec.com> (raw)
In-Reply-To: <1478630202-1630-1-git-send-email-rahul.bedarkar@imgtec.com>

When statically linking with gnutls, we get definition clash error for
base64_encode which is also defined by gnutls.

This commit adds patch to rename base64_{encode,decode} defined in wget.

Signed-off-by: Rahul Bedarkar <rahul.bedarkar@imgtec.com>
---
 .../0001-utils-rename-base64_-encode-decode.patch  | 134 +++++++++++++++++++++
 1 file changed, 134 insertions(+)
 create mode 100644 package/wget/0001-utils-rename-base64_-encode-decode.patch

diff --git a/package/wget/0001-utils-rename-base64_-encode-decode.patch b/package/wget/0001-utils-rename-base64_-encode-decode.patch
new file mode 100644
index 0000000..f219afa
--- /dev/null
+++ b/package/wget/0001-utils-rename-base64_-encode-decode.patch
@@ -0,0 +1,134 @@
+From 9e68787576fec304da23af26dca963a4cdea7765 Mon Sep 17 00:00:00 2001
+From: Rahul Bedarkar <rahul.bedarkar@imgtec.com>
+Date: Tue, 8 Nov 2016 23:42:53 +0530
+Subject: [PATCH] utils: rename base64_{encode,decode}
+
+When statically linking with gnutls, we get definition clash error for
+base64_encode which is also defined by gnutls.
+
+/home/rahul.bedarkar/buildroot/output/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/lib/libgnutls.a(base64.o): In function `base64_encode':
+base64.c:(.text+0x148): multiple definition of `base64_encode'
+utils.o:utils.c:(.text+0x4378): first defined here
+collect2: error: ld returned 1 exit status
+
+To prevent definition clash, rename base64_{encode,decode}
+
+Signed-off-by: Rahul Bedarkar <rahul.bedarkar@imgtec.com>
+---
+ src/http-ntlm.c | 6 +++---
+ src/http.c      | 4 ++--
+ src/utils.c     | 8 ++++----
+ src/utils.h     | 4 ++--
+ 4 files changed, 11 insertions(+), 11 deletions(-)
+
+diff --git a/src/http-ntlm.c b/src/http-ntlm.c
+index 56c40ae..87f5a37 100644
+--- a/src/http-ntlm.c
++++ b/src/http-ntlm.c
+@@ -122,7 +122,7 @@ ntlm_input (struct ntlmdata *ntlm, const char *header)
+ 
+       DEBUGP (("Received a type-2 NTLM message.\n"));
+ 
+-      size = base64_decode (header, buffer);
++      size = wget_base64_decode (header, buffer);
+       if (size < 0)
+         return false;           /* malformed base64 from server */
+ 
+@@ -411,7 +411,7 @@ ntlm_output (struct ntlmdata *ntlm, const char *user, const char *passwd,
+     size = 32 + hostlen + domlen;
+ 
+     base64 = (char *) alloca (BASE64_LENGTH (size) + 1);
+-    base64_encode (ntlmbuf, size, base64);
++    wget_base64_encode (ntlmbuf, size, base64);
+ 
+     output = concat_strings ("NTLM ", base64, (char *) 0);
+     break;
+@@ -584,7 +584,7 @@ ntlm_output (struct ntlmdata *ntlm, const char *user, const char *passwd,
+ 
+     /* convert the binary blob into base64 */
+     base64 = (char *) alloca (BASE64_LENGTH (size) + 1);
+-    base64_encode (ntlmbuf, size, base64);
++    wget_base64_encode (ntlmbuf, size, base64);
+ 
+     output = concat_strings ("NTLM ", base64, (char *) 0);
+ 
+diff --git a/src/http.c b/src/http.c
+index 7e60a07..368d30d 100644
+--- a/src/http.c
++++ b/src/http.c
+@@ -2818,7 +2818,7 @@ metalink_from_http (const struct response *resp, const struct http_stat *hs,
+           char *bin_hash = alloca (dig_hash_str_len * 3 / 4 + 1);
+           size_t hash_bin_len;
+ 
+-          hash_bin_len = base64_decode (dig_hash, bin_hash);
++          hash_bin_len = wget_base64_decode (dig_hash, bin_hash);
+ 
+           /* One slot for me, one for zero-termination.  */
+           mfile->checksums =
+@@ -4546,7 +4546,7 @@ basic_authentication_encode (const char *user, const char *passwd)
+   sprintf (t1, "%s:%s", user, passwd);
+ 
+   t2 = (char *)alloca (BASE64_LENGTH (len1) + 1);
+-  base64_encode (t1, len1, t2);
++  wget_base64_encode (t1, len1, t2);
+ 
+   return concat_strings ("Basic ", t2, (char *) 0);
+ }
+diff --git a/src/utils.c b/src/utils.c
+index b07da9f..355f0ce 100644
+--- a/src/utils.c
++++ b/src/utils.c
+@@ -2140,7 +2140,7 @@ xsleep (double seconds)
+    base64 data.  */
+ 
+ size_t
+-base64_encode (const void *data, size_t length, char *dest)
++wget_base64_encode (const void *data, size_t length, char *dest)
+ {
+   /* Conversion table.  */
+   static const char tbl[64] = {
+@@ -2208,7 +2208,7 @@ base64_encode (const void *data, size_t length, char *dest)
+    This function originates from Free Recode.  */
+ 
+ ssize_t
+-base64_decode (const char *base64, void *dest)
++wget_base64_decode (const char *base64, void *dest)
+ {
+   /* Table of base64 values for first 128 characters.  Note that this
+      assumes ASCII (but so does Wget in other places).  */
+@@ -2588,7 +2588,7 @@ wg_pubkey_pem_to_der (const char *pem, unsigned char **der, size_t *der_len)
+ 
+   base64data = xmalloc (BASE64_LENGTH(stripped_pem_count));
+ 
+-  size = base64_decode (stripped_pem, base64data);
++  size = wget_base64_decode (stripped_pem, base64data);
+ 
+   if (size < 0) {
+     xfree (base64data);           /* malformed base64 from server */
+@@ -2651,7 +2651,7 @@ wg_pin_peer_pubkey (const char *pinnedpubkey, const char *pubkey, size_t pubkeyl
+           end_pos[0] = '\0';
+ 
+         /* decode base64 pinnedpubkey, 8 is length of "sha256//" */
+-        decoded_hash_length = base64_decode (begin_pos + 8, expectedsha256sumdigest);
++        decoded_hash_length = wget_base64_decode (begin_pos + 8, expectedsha256sumdigest);
+         /* if valid base64, compare sha256 digests directly */
+         if (SHA256_DIGEST_SIZE == decoded_hash_length &&
+            !memcmp (sha256sumdigest, expectedsha256sumdigest, SHA256_DIGEST_SIZE)) {
+diff --git a/src/utils.h b/src/utils.h
+index f224b73..aaac730 100644
+--- a/src/utils.h
++++ b/src/utils.h
+@@ -140,8 +140,8 @@ void xsleep (double);
+ /* How many bytes it will take to store LEN bytes in base64.  */
+ #define BASE64_LENGTH(len) (4 * (((len) + 2) / 3))
+ 
+-size_t base64_encode (const void *, size_t, char *);
+-ssize_t base64_decode (const char *, void *);
++size_t wget_base64_encode (const void *, size_t, char *);
++ssize_t wget_base64_decode (const char *, void *);
+ 
+ #ifdef HAVE_LIBPCRE
+ void *compile_pcre_regex (const char *);
+-- 
+2.6.2
+
-- 
2.6.2

  reply	other threads:[~2016-11-08 18:36 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-08 18:36 [Buildroot] [PATCH 1/2] wget: fix ssl detection in static libs configuration Rahul Bedarkar
2016-11-08 18:36 ` Rahul Bedarkar [this message]
2016-11-11 21:51   ` [Buildroot] [PATCH 2/2] wget: fix static link with gnutls Thomas Petazzoni
2016-11-08 21:45 ` [Buildroot] [PATCH 1/2] wget: fix ssl detection in static libs configuration Arnout Vandecappelle
2016-11-11 21:12 ` Thomas Petazzoni

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1478630202-1630-2-git-send-email-rahul.bedarkar@imgtec.com \
    --to=rahul.bedarkar@imgtec.com \
    --cc=buildroot@busybox.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.