kumquat-buildroot/package/wget/0001-utils-rename-base64_-encode-decode.patch
Rahul Bedarkar 7afacefb9c wget: fix static link with gnutls
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>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2016-11-11 22:33:26 +01:00

135 lines
5.1 KiB
Diff

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