aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2013-12-24 11:28:30 +0000
committerChristian Grothoff <christian@grothoff.org>2013-12-24 11:28:30 +0000
commita372d23b4ee68d578a7482f6b2b17018bbe53b5e (patch)
treed9c30d3a78b74a689a51a66c33e20b22a62e2606
parent324e9852db193ead4a319fc4099baf2b0b8c456d (diff)
downloadlibmicrohttpd-a372d23b4ee68d578a7482f6b2b17018bbe53b5e.tar.gz
libmicrohttpd-a372d23b4ee68d578a7482f6b2b17018bbe53b5e.zip
-hide symbols
-rw-r--r--ChangeLog4
-rw-r--r--src/include/platform.h9
-rw-r--r--src/microhttpd/base64.c9
-rw-r--r--src/microhttpd/base64.h3
-rw-r--r--src/microhttpd/connection.c5
-rw-r--r--src/microhttpd/connection_https.c11
-rw-r--r--src/microhttpd/daemon.c2
-rw-r--r--src/microhttpd/internal.c5
-rw-r--r--src/microhttpd/internal.h2
-rw-r--r--src/microhttpd/md5.c34
-rw-r--r--src/microhttpd/md5.h11
-rw-r--r--src/microhttpd/reason_phrase.c6
12 files changed, 65 insertions, 36 deletions
diff --git a/ChangeLog b/ChangeLog
index aa26648b..20873778 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
1Tue Dec 24 12:27:39 CET 2013
2 Adding explicit annotations to hide symbols that are not for
3 export in the C code (gcc 4.0 or higher only). -CG
4
1Sun Dec 22 14:54:30 CET 2013 5Sun Dec 22 14:54:30 CET 2013
2 Adding a few lines to avoid warnings from picky compilers. -CG 6 Adding a few lines to avoid warnings from picky compilers. -CG
3 7
diff --git a/src/include/platform.h b/src/include/platform.h
index befebbbe..bcf36ac6 100644
--- a/src/include/platform.h
+++ b/src/include/platform.h
@@ -111,5 +111,14 @@
111 111
112#include <plibc.h> 112#include <plibc.h>
113 113
114#define GCC_VERSION (__GNUC__ * 10000 \
115 + __GNUC_MINOR__ * 100 \
116 + __GNUC_PATCHLEVEL__)
117#if GCC_VERSION > 40000
118#define HIDDEN_SYMBOL __attribute__ ((visibility ("hidden")))
119#else
120#define HIDDEN_SYMBOL
121#endif
122
114 123
115#endif 124#endif
diff --git a/src/microhttpd/base64.c b/src/microhttpd/base64.c
index d14317b3..3e390b8b 100644
--- a/src/microhttpd/base64.c
+++ b/src/microhttpd/base64.c
@@ -26,14 +26,15 @@ static const char base64_digits[] =
26 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; 26 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
27 27
28 28
29char * 29HIDDEN_SYMBOL
30BASE64Decode(const char* src) 30char *
31BASE64Decode(const char* src)
31{ 32{
32 size_t in_len = strlen (src); 33 size_t in_len = strlen (src);
33 char* dest; 34 char* dest;
34 char* result; 35 char* result;
35 36
36 if (in_len % 4) 37 if (in_len % 4)
37 { 38 {
38 /* Wrong base64 string length */ 39 /* Wrong base64 string length */
39 return NULL; 40 return NULL;
diff --git a/src/microhttpd/base64.h b/src/microhttpd/base64.h
index 831adf97..34948c07 100644
--- a/src/microhttpd/base64.h
+++ b/src/microhttpd/base64.h
@@ -11,7 +11,8 @@
11 11
12#include "platform.h" 12#include "platform.h"
13 13
14char * 14HIDDEN_SYMBOL
15char *
15BASE64Decode(const char* src); 16BASE64Decode(const char* src);
16 17
17#endif /* !BASE64_H */ 18#endif /* !BASE64_H */
diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c
index 69ea54e5..07022692 100644
--- a/src/microhttpd/connection.c
+++ b/src/microhttpd/connection.c
@@ -1850,6 +1850,7 @@ update_last_activity (struct MHD_Connection *connection)
1850 * @return always #MHD_YES (we should continue to process the 1850 * @return always #MHD_YES (we should continue to process the
1851 * connection) 1851 * connection)
1852 */ 1852 */
1853HIDDEN_SYMBOL
1853int 1854int
1854MHD_connection_handle_read (struct MHD_Connection *connection) 1855MHD_connection_handle_read (struct MHD_Connection *connection)
1855{ 1856{
@@ -1912,6 +1913,7 @@ MHD_connection_handle_read (struct MHD_Connection *connection)
1912 * @return always #MHD_YES (we should continue to process the 1913 * @return always #MHD_YES (we should continue to process the
1913 * connection) 1914 * connection)
1914 */ 1915 */
1916HIDDEN_SYMBOL
1915int 1917int
1916MHD_connection_handle_write (struct MHD_Connection *connection) 1918MHD_connection_handle_write (struct MHD_Connection *connection)
1917{ 1919{
@@ -2112,6 +2114,7 @@ cleanup_connection (struct MHD_Connection *connection)
2112 * @return #MHD_YES if we should continue to process the 2114 * @return #MHD_YES if we should continue to process the
2113 * connection (not dead yet), #MHD_NO if it died 2115 * connection (not dead yet), #MHD_NO if it died
2114 */ 2116 */
2117HIDDEN_SYMBOL
2115int 2118int
2116MHD_connection_handle_idle (struct MHD_Connection *connection) 2119MHD_connection_handle_idle (struct MHD_Connection *connection)
2117{ 2120{
@@ -2548,6 +2551,7 @@ MHD_connection_handle_idle (struct MHD_Connection *connection)
2548 * @return #MHD_YES if we should continue to process the 2551 * @return #MHD_YES if we should continue to process the
2549 * connection (not dead yet), #MHD_NO if it died 2552 * connection (not dead yet), #MHD_NO if it died
2550 */ 2553 */
2554HIDDEN_SYMBOL
2551int 2555int
2552MHD_connection_epoll_update_ (struct MHD_Connection *connection) 2556MHD_connection_epoll_update_ (struct MHD_Connection *connection)
2553{ 2557{
@@ -2595,6 +2599,7 @@ MHD_connection_epoll_update_ (struct MHD_Connection *connection)
2595 * 2599 *
2596 * @param connection connection to initialize 2600 * @param connection connection to initialize
2597 */ 2601 */
2602HIDDEN_SYMBOL
2598void 2603void
2599MHD_set_http_callbacks_ (struct MHD_Connection *connection) 2604MHD_set_http_callbacks_ (struct MHD_Connection *connection)
2600{ 2605{
diff --git a/src/microhttpd/connection_https.c b/src/microhttpd/connection_https.c
index 0eea4837..474eece7 100644
--- a/src/microhttpd/connection_https.c
+++ b/src/microhttpd/connection_https.c
@@ -35,7 +35,7 @@
35 35
36 36
37/** 37/**
38 * Give gnuTLS chance to work on the TLS handshake. 38 * Give gnuTLS chance to work on the TLS handshake.
39 * 39 *
40 * @param connection connection to handshake on 40 * @param connection connection to handshake on
41 * @return #MHD_YES on error or if the handshake is progressing 41 * @return #MHD_YES on error or if the handshake is progressing
@@ -51,13 +51,13 @@ run_tls_handshake (struct MHD_Connection *connection)
51 if (connection->state == MHD_TLS_CONNECTION_INIT) 51 if (connection->state == MHD_TLS_CONNECTION_INIT)
52 { 52 {
53 ret = gnutls_handshake (connection->tls_session); 53 ret = gnutls_handshake (connection->tls_session);
54 if (ret == GNUTLS_E_SUCCESS) 54 if (ret == GNUTLS_E_SUCCESS)
55 { 55 {
56 /* set connection state to enable HTTP processing */ 56 /* set connection state to enable HTTP processing */
57 connection->state = MHD_CONNECTION_INIT; 57 connection->state = MHD_CONNECTION_INIT;
58 return MHD_YES; 58 return MHD_YES;
59 } 59 }
60 if ( (ret == GNUTLS_E_AGAIN) || 60 if ( (ret == GNUTLS_E_AGAIN) ||
61 (ret == GNUTLS_E_INTERRUPTED) ) 61 (ret == GNUTLS_E_INTERRUPTED) )
62 { 62 {
63 /* handshake not done */ 63 /* handshake not done */
@@ -156,7 +156,7 @@ MHD_tls_connection_handle_idle (struct MHD_Connection *connection)
156 return MHD_YES; 156 return MHD_YES;
157 return MHD_connection_handle_idle (connection); 157 return MHD_connection_handle_idle (connection);
158 } 158 }
159#if EPOLL_SUPPORT 159#if EPOLL_SUPPORT
160 return MHD_connection_epoll_update_ (connection); 160 return MHD_connection_epoll_update_ (connection);
161#else 161#else
162 return MHD_YES; 162 return MHD_YES;
@@ -170,6 +170,7 @@ MHD_tls_connection_handle_idle (struct MHD_Connection *connection)
170 * 170 *
171 * @param connection which callbacks should be modified 171 * @param connection which callbacks should be modified
172 */ 172 */
173HIDDEN_SYMBOL
173void 174void
174MHD_set_https_callbacks (struct MHD_Connection *connection) 175MHD_set_https_callbacks (struct MHD_Connection *connection)
175{ 176{
diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c
index e66cd218..0a33b773 100644
--- a/src/microhttpd/daemon.c
+++ b/src/microhttpd/daemon.c
@@ -121,11 +121,13 @@ mhd_panic_std (void *cls,
121/** 121/**
122 * Handler for fatal errors. 122 * Handler for fatal errors.
123 */ 123 */
124HIDDEN_SYMBOL
124MHD_PanicCallback mhd_panic; 125MHD_PanicCallback mhd_panic;
125 126
126/** 127/**
127 * Closure argument for "mhd_panic". 128 * Closure argument for "mhd_panic".
128 */ 129 */
130HIDDEN_SYMBOL
129void *mhd_panic_cls; 131void *mhd_panic_cls;
130 132
131 133
diff --git a/src/microhttpd/internal.c b/src/microhttpd/internal.c
index 9b234fea..7afaba74 100644
--- a/src/microhttpd/internal.c
+++ b/src/microhttpd/internal.c
@@ -31,6 +31,7 @@
31/** 31/**
32 * State to string dictionary. 32 * State to string dictionary.
33 */ 33 */
34HIDDEN_SYMBOL
34const char * 35const char *
35MHD_state_to_string (enum MHD_CONNECTION_STATE state) 36MHD_state_to_string (enum MHD_CONNECTION_STATE state)
36{ 37{
@@ -90,7 +91,7 @@ MHD_state_to_string (enum MHD_CONNECTION_STATE state)
90 * fprintf-like helper function for logging debug 91 * fprintf-like helper function for logging debug
91 * messages. 92 * messages.
92 */ 93 */
93void 94void HIDDEN_SYMBOL
94MHD_DLOG (const struct MHD_Daemon *daemon, const char *format, ...) 95MHD_DLOG (const struct MHD_Daemon *daemon, const char *format, ...)
95{ 96{
96 va_list va; 97 va_list va;
@@ -115,6 +116,7 @@ MHD_DLOG (const struct MHD_Daemon *daemon, const char *format, ...)
115 * @return length of the resulting val (strlen(val) maybe 116 * @return length of the resulting val (strlen(val) maybe
116 * shorter afterwards due to elimination of escape sequences) 117 * shorter afterwards due to elimination of escape sequences)
117 */ 118 */
119HIDDEN_SYMBOL
118size_t 120size_t
119MHD_http_unescape (void *cls, 121MHD_http_unescape (void *cls,
120 struct MHD_Connection *connection, 122 struct MHD_Connection *connection,
@@ -165,6 +167,7 @@ MHD_http_unescape (void *cls,
165} 167}
166 168
167 169
170HIDDEN_SYMBOL
168time_t 171time_t
169MHD_monotonic_time (void) 172MHD_monotonic_time (void)
170{ 173{
diff --git a/src/microhttpd/internal.h b/src/microhttpd/internal.h
index 9d50de25..6146e2ac 100644
--- a/src/microhttpd/internal.h
+++ b/src/microhttpd/internal.h
@@ -189,7 +189,7 @@ struct MHD_NonceNc
189 * fprintf-like helper function for logging debug 189 * fprintf-like helper function for logging debug
190 * messages. 190 * messages.
191 */ 191 */
192void 192void HIDDEN_SYMBOL
193MHD_DLOG (const struct MHD_Daemon *daemon, 193MHD_DLOG (const struct MHD_Daemon *daemon,
194 const char *format, ...); 194 const char *format, ...);
195#endif 195#endif
diff --git a/src/microhttpd/md5.c b/src/microhttpd/md5.c
index 5daa0334..309f492c 100644
--- a/src/microhttpd/md5.c
+++ b/src/microhttpd/md5.c
@@ -28,7 +28,7 @@
28/* 28/*
29 * Note: this code is harmless on little-endian machines. 29 * Note: this code is harmless on little-endian machines.
30 */ 30 */
31static void 31static void
32byteReverse(unsigned char *buf, 32byteReverse(unsigned char *buf,
33 unsigned longs) 33 unsigned longs)
34{ 34{
@@ -60,7 +60,7 @@ byteReverse(unsigned char *buf,
60 * reflect the addition of 16 longwords of new data. MD5Update blocks 60 * reflect the addition of 16 longwords of new data. MD5Update blocks
61 * the data and converts bytes into longwords for this routine. 61 * the data and converts bytes into longwords for this routine.
62 */ 62 */
63static void 63static void
64MD5Transform(uint32_t buf[4], 64MD5Transform(uint32_t buf[4],
65 uint32_t in[16]) 65 uint32_t in[16])
66{ 66{
@@ -150,7 +150,7 @@ MD5Transform(uint32_t buf[4],
150 * Start MD5 accumulation. Set bit count to 0 and buffer to mysterious 150 * Start MD5 accumulation. Set bit count to 0 and buffer to mysterious
151 * initialization constants. 151 * initialization constants.
152 */ 152 */
153void 153void HIDDEN_SYMBOL
154MD5Init(struct MD5Context *ctx) 154MD5Init(struct MD5Context *ctx)
155{ 155{
156 ctx->buf[0] = 0x67452301; 156 ctx->buf[0] = 0x67452301;
@@ -166,7 +166,7 @@ MD5Init(struct MD5Context *ctx)
166 * Update context to reflect the concatenation of another buffer full 166 * Update context to reflect the concatenation of another buffer full
167 * of bytes. 167 * of bytes.
168 */ 168 */
169void 169void HIDDEN_SYMBOL
170MD5Update(struct MD5Context *ctx, 170MD5Update(struct MD5Context *ctx,
171 const void *data, 171 const void *data,
172 unsigned len) 172 unsigned len)
@@ -215,49 +215,49 @@ MD5Update(struct MD5Context *ctx,
215} 215}
216 216
217/* 217/*
218 * Final wrapup - pad to 64-byte boundary with the bit pattern 218 * Final wrapup - pad to 64-byte boundary with the bit pattern
219 * 1 0* (64-bit count of bits processed, MSB-first) 219 * 1 0* (64-bit count of bits processed, MSB-first)
220 */ 220 */
221void 221void HIDDEN_SYMBOL
222MD5Final(unsigned char digest[16], 222MD5Final (unsigned char digest[16],
223 struct MD5Context *ctx) 223 struct MD5Context *ctx)
224{ 224{
225 unsigned count; 225 unsigned count;
226 unsigned char *p; 226 unsigned char *p;
227 227
228 /* Compute number of bytes mod 64 */ 228 /* Compute number of bytes mod 64 */
229 count = (ctx->bits[0] >> 3) & 0x3F; 229 count = (ctx->bits[0] >> 3) & 0x3F;
230 230
231 /* Set the first char of padding to 0x80. This is safe since there is 231 /* Set the first char of padding to 0x80. This is safe since there is
232 always at least one byte free */ 232 always at least one byte free */
233 p = ctx->in + count; 233 p = ctx->in + count;
234 *p++ = 0x80; 234 *p++ = 0x80;
235 235
236 /* Bytes of padding needed to make 64 bytes */ 236 /* Bytes of padding needed to make 64 bytes */
237 count = 64 - 1 - count; 237 count = 64 - 1 - count;
238 238
239 /* Pad out to 56 mod 64 */ 239 /* Pad out to 56 mod 64 */
240 if (count < 8) 240 if (count < 8)
241 { 241 {
242 /* Two lots of padding: Pad the first block to 64 bytes */ 242 /* Two lots of padding: Pad the first block to 64 bytes */
243 memset(p, 0, count); 243 memset(p, 0, count);
244 byteReverse(ctx->in, 16); 244 byteReverse(ctx->in, 16);
245 MD5Transform(ctx->buf, (uint32_t *) ctx->in); 245 MD5Transform(ctx->buf, (uint32_t *) ctx->in);
246 246
247 /* Now fill the next block with 56 bytes */ 247 /* Now fill the next block with 56 bytes */
248 memset(ctx->in, 0, 56); 248 memset(ctx->in, 0, 56);
249 } 249 }
250 else 250 else
251 { 251 {
252 /* Pad block to 56 bytes */ 252 /* Pad block to 56 bytes */
253 memset(p, 0, count - 8); 253 memset(p, 0, count - 8);
254 } 254 }
255 byteReverse(ctx->in, 14); 255 byteReverse(ctx->in, 14);
256 256
257 /* Append length in bits and transform */ 257 /* Append length in bits and transform */
258 ((uint32_t *) ctx->in)[14] = ctx->bits[0]; 258 ((uint32_t *) ctx->in)[14] = ctx->bits[0];
259 ((uint32_t *) ctx->in)[15] = ctx->bits[1]; 259 ((uint32_t *) ctx->in)[15] = ctx->bits[1];
260 260
261 MD5Transform(ctx->buf, (uint32_t *) ctx->in); 261 MD5Transform(ctx->buf, (uint32_t *) ctx->in);
262 byteReverse((unsigned char *) ctx->buf, 4); 262 byteReverse((unsigned char *) ctx->buf, 4);
263 memcpy(digest, ctx->buf, 16); 263 memcpy(digest, ctx->buf, 16);
diff --git a/src/microhttpd/md5.h b/src/microhttpd/md5.h
index 15d620d7..077b2e8c 100644
--- a/src/microhttpd/md5.h
+++ b/src/microhttpd/md5.h
@@ -29,7 +29,7 @@
29 29
30#define MD5_DIGEST_SIZE 16 30#define MD5_DIGEST_SIZE 16
31 31
32struct MD5Context 32struct MD5Context
33{ 33{
34 uint32_t buf[4]; 34 uint32_t buf[4];
35 uint32_t bits[2]; 35 uint32_t bits[2];
@@ -37,15 +37,16 @@ struct MD5Context
37}; 37};
38 38
39 39
40void 40void HIDDEN_SYMBOL
41MD5Init(struct MD5Context *ctx); 41MD5Init(struct MD5Context *ctx);
42 42
43void 43void HIDDEN_SYMBOL
44MD5Update(struct MD5Context *ctx, 44MD5Update(struct MD5Context *ctx,
45 const void *buf, 45 const void *buf,
46 unsigned len); 46 unsigned len);
47 47
48void MD5Final(unsigned char digest[MD5_DIGEST_SIZE], 48void HIDDEN_SYMBOL
49 struct MD5Context *ctx); 49MD5Final(unsigned char digest[MD5_DIGEST_SIZE],
50 struct MD5Context *ctx);
50 51
51#endif /* !MD5_H */ 52#endif /* !MD5_H */
diff --git a/src/microhttpd/reason_phrase.c b/src/microhttpd/reason_phrase.c
index 843f47a9..6eb79d14 100644
--- a/src/microhttpd/reason_phrase.c
+++ b/src/microhttpd/reason_phrase.c
@@ -148,11 +148,13 @@ static const struct MHD_Reason_Block reasons[] = {
148 BLOCK (five_hundred), 148 BLOCK (five_hundred),
149}; 149};
150 150
151
152HIDDEN_SYMBOL
151const char * 153const char *
152MHD_get_reason_phrase_for (unsigned int code) 154MHD_get_reason_phrase_for (unsigned int code)
153{ 155{
154 if ( (code >= 100) && 156 if ( (code >= 100) &&
155 (code < 600) && 157 (code < 600) &&
156 (reasons[code / 100].max > (code % 100)) ) 158 (reasons[code / 100].max > (code % 100)) )
157 return reasons[code / 100].data[code % 100]; 159 return reasons[code / 100].data[code % 100];
158 return "Unknown"; 160 return "Unknown";