haproxy/include/common
Willy Tarreau 340b07e868 BUG/MAJOR: hashes: fix the signedness of the hash inputs
Wietse Venema reported in the thread below that we have a signedness
issue with our hashes implementations: due to the use of const char*
for the input key that's often text, the crc32, sdbm, djb2, and wt6
algorithms return a platform-dependent value for binary input keys
containing bytes with bit 7 set. This means that an ARM or PPC
platform will hash binary inputs differently from an x86 typically.
Worse, some algorithms are well defined in the industry (like CRC32)
and do not provide the expected result on x86, possibly causing
interoperability issues (e.g. a user-agent would fail to compare the
CRC32 of a message body against the one computed by haproxy).

Fortunately, and contrary to the first impression, the CRC32c variant
used in the PROXY protocol processing is not affected. Thus the impact
remains very limited (the vast majority of input keys are text-based,
such as user-agent headers for exmaple).

This patch addresses the issue by fixing all hash functions' prototypes
(even those not affected, for API consistency). A reg test will follow
in another patch.

The vast majority of users do not use these hashes. And among those
using them, very few will pass them on binary inputs. However, for the
rare ones doing it, this fix MAY have an impact during the upgrade. For
example if the package is upgraded on one LB then on another one, and
the CRC32 of a binary input is used as a stick table key (why?) then
these CRCs will not match between both nodes. Similarly, if
"hash-type ... crc32" is used, LB inconsistency may appear during the
transition. For this reason it is preferable to apply the patch on all
nodes using such hashes at the same time. Systems upgraded via their
distros will likely observe the least impact since they're expected to
be upgraded within a short time frame.

And it is important for distros NOT to skip this fix, in order to avoid
distributing an incompatible implementation of a hash. This is the
reason why this patch is tagged as MAJOR, eventhough it's extremely
unlikely that anyone will ever notice a change at all.

This patch must be backported to all supported branches since the
hashes were introduced in 1.5-dev20 (commit 98634f0c). Some parts
may be dropped since implemented later.

Link to Wietse's report:
  https://marc.info/?l=postfix-users&m=157879464518535&w=2
2020-01-16 08:23:42 +01:00
..
accept4.h
base64.h
buf.h MINOR: buffer: add functions to read/write varints from/to buffers 2019-08-27 17:14:19 +02:00
buffer.h CLEANUP: buffer: replace b_drop() with b_free() 2019-08-08 08:07:45 +02:00
cfgparse.h
chunk.h MINOR: chunk: add chunk_istcat() to concatenate an ist after a chunk 2019-10-29 13:09:14 +01:00
compat.h
compiler.h
config.h
debug.h MINOR: stats/debug: maintain a counter of debug commands issued 2019-10-24 18:38:00 +02:00
defaults.h
epoll.h
errors.h
fcgi.h MINOR: fcgi: Add function to get the string representation of a record type 2019-10-04 16:12:02 +02:00
h1.h MEDIUM: mux-h1/h1-htx: move HTX convertion of H1 messages in dedicated file 2019-09-17 10:18:54 +02:00
h2.h MINOR: h2: add a function to report H2 error codes as strings 2019-11-25 11:34:26 +01:00
hash.h BUG/MAJOR: hashes: fix the signedness of the hash inputs 2020-01-16 08:23:42 +01:00
hathreads.h BUG/MEDIUM: pattern: make the pattern LRU cache thread-local and lockless 2019-10-23 07:27:25 +02:00
hpack-dec.h
hpack-enc.h
hpack-huff.h
hpack-tbl.h
http-hdr.h
http.h MINOR: http: Add 404 to http-request deny 2020-01-08 16:15:23 +01:00
htx.h MINOR: htx: Add a flag on HTX to known when a response was generated by HAProxy 2019-10-16 10:03:12 +02:00
initcall.h
ist.h MINOR: ist: add ist_find_ctl() 2019-11-25 10:33:35 +01:00
istbuf.h Revert "MINOR: istbuf: add b_fromist() to make a buffer from an ist" 2019-10-29 13:09:14 +01:00
memory.h MINOR: memory: also poison the area on freeing 2019-11-15 07:06:46 +01:00
mini-clist.h BUG/MEDIUM: lists: Handle 1-element-lists in MT_LIST_BEHEAD(). 2019-10-17 17:48:20 +02:00
namespace.h
net_helper.h
openssl-compat.h BUILD: ssl: improve SSL_CTX_set_ecdh_auto compatibility 2019-12-21 06:46:55 +01:00
regex.h
splice.h
standard.h MINOR: tools: add a generic struct "name_desc" for name-description pairs 2019-08-29 09:34:53 +02:00
syscall.h
template.h
ticks.h
time.h MINOR: time: add timeofday_as_iso_us() to return instant time as ISO 2019-09-26 08:13:38 +02:00
tools.h
uri_auth.h MINOR: stats: replace the ST_* uri_auth flags with STAT_* 2019-10-10 11:30:07 +02:00
version.h MINOR: version: this is development again, update the status 2019-11-25 20:38:32 +01:00
xref.h