1 From 9e68787576fec304da23af26dca963a4cdea7765 Mon Sep 17 00:00:00 2001
2 From: Rahul Bedarkar <rahul.bedarkar@imgtec.com>
3 Date: Tue, 8 Nov 2016 23:42:53 +0530
4 Subject: [PATCH] utils: rename base64_{encode,decode}
6 When statically linking with gnutls, we get definition clash error for
7 base64_encode which is also defined by gnutls.
9 /home/rahul.bedarkar/buildroot/output/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/lib/libgnutls.a(base64.o): In function `base64_encode':
10 base64.c:(.text+0x148): multiple definition of `base64_encode'
11 utils.o:utils.c:(.text+0x4378): first defined here
12 collect2: error: ld returned 1 exit status
14 To prevent definition clash, rename base64_{encode,decode}
16 Signed-off-by: Rahul Bedarkar <rahul.bedarkar@imgtec.com>
18 src/http-ntlm.c | 6 +++---
20 src/utils.c | 8 ++++----
22 4 files changed, 11 insertions(+), 11 deletions(-)
24 diff --git a/src/http-ntlm.c b/src/http-ntlm.c
25 index 56c40ae..87f5a37 100644
28 @@ -122,7 +122,7 @@ ntlm_input (struct ntlmdata *ntlm, const char *header)
30 DEBUGP (("Received a type-2 NTLM message.\n"));
32 - size = base64_decode (header, buffer);
33 + size = wget_base64_decode (header, buffer);
35 return false; /* malformed base64 from server */
37 @@ -411,7 +411,7 @@ ntlm_output (struct ntlmdata *ntlm, const char *user, const char *passwd,
38 size = 32 + hostlen + domlen;
40 base64 = (char *) alloca (BASE64_LENGTH (size) + 1);
41 - base64_encode (ntlmbuf, size, base64);
42 + wget_base64_encode (ntlmbuf, size, base64);
44 output = concat_strings ("NTLM ", base64, (char *) 0);
46 @@ -584,7 +584,7 @@ ntlm_output (struct ntlmdata *ntlm, const char *user, const char *passwd,
48 /* convert the binary blob into base64 */
49 base64 = (char *) alloca (BASE64_LENGTH (size) + 1);
50 - base64_encode (ntlmbuf, size, base64);
51 + wget_base64_encode (ntlmbuf, size, base64);
53 output = concat_strings ("NTLM ", base64, (char *) 0);
55 diff --git a/src/http.c b/src/http.c
56 index 7e60a07..368d30d 100644
59 @@ -2818,7 +2818,7 @@ metalink_from_http (const struct response *resp, const struct http_stat *hs,
60 char *bin_hash = alloca (dig_hash_str_len * 3 / 4 + 1);
63 - hash_bin_len = base64_decode (dig_hash, bin_hash);
64 + hash_bin_len = wget_base64_decode (dig_hash, bin_hash);
66 /* One slot for me, one for zero-termination. */
68 @@ -4546,7 +4546,7 @@ basic_authentication_encode (const char *user, const char *passwd)
69 sprintf (t1, "%s:%s", user, passwd);
71 t2 = (char *)alloca (BASE64_LENGTH (len1) + 1);
72 - base64_encode (t1, len1, t2);
73 + wget_base64_encode (t1, len1, t2);
75 return concat_strings ("Basic ", t2, (char *) 0);
77 diff --git a/src/utils.c b/src/utils.c
78 index b07da9f..355f0ce 100644
81 @@ -2140,7 +2140,7 @@ xsleep (double seconds)
85 -base64_encode (const void *data, size_t length, char *dest)
86 +wget_base64_encode (const void *data, size_t length, char *dest)
88 /* Conversion table. */
89 static const char tbl[64] = {
90 @@ -2208,7 +2208,7 @@ base64_encode (const void *data, size_t length, char *dest)
91 This function originates from Free Recode. */
94 -base64_decode (const char *base64, void *dest)
95 +wget_base64_decode (const char *base64, void *dest)
97 /* Table of base64 values for first 128 characters. Note that this
98 assumes ASCII (but so does Wget in other places). */
99 @@ -2588,7 +2588,7 @@ wg_pubkey_pem_to_der (const char *pem, unsigned char **der, size_t *der_len)
101 base64data = xmalloc (BASE64_LENGTH(stripped_pem_count));
103 - size = base64_decode (stripped_pem, base64data);
104 + size = wget_base64_decode (stripped_pem, base64data);
107 xfree (base64data); /* malformed base64 from server */
108 @@ -2651,7 +2651,7 @@ wg_pin_peer_pubkey (const char *pinnedpubkey, const char *pubkey, size_t pubkeyl
111 /* decode base64 pinnedpubkey, 8 is length of "sha256//" */
112 - decoded_hash_length = base64_decode (begin_pos + 8, expectedsha256sumdigest);
113 + decoded_hash_length = wget_base64_decode (begin_pos + 8, expectedsha256sumdigest);
114 /* if valid base64, compare sha256 digests directly */
115 if (SHA256_DIGEST_SIZE == decoded_hash_length &&
116 !memcmp (sha256sumdigest, expectedsha256sumdigest, SHA256_DIGEST_SIZE)) {
117 diff --git a/src/utils.h b/src/utils.h
118 index f224b73..aaac730 100644
121 @@ -140,8 +140,8 @@ void xsleep (double);
122 /* How many bytes it will take to store LEN bytes in base64. */
123 #define BASE64_LENGTH(len) (4 * (((len) + 2) / 3))
125 -size_t base64_encode (const void *, size_t, char *);
126 -ssize_t base64_decode (const char *, void *);
127 +size_t wget_base64_encode (const void *, size_t, char *);
128 +ssize_t wget_base64_decode (const char *, void *);
131 void *compile_pcre_regex (const char *);