postgresql/src/common
Michael Paquier b67b57a966 Refactor MD5 implementations according to new cryptohash infrastructure
This commit heavily reorganizes the MD5 implementations that exist in
the tree in various aspects.

First, MD5 is added to the list of options available in cryptohash.c and
cryptohash_openssl.c.  This means that if building with OpenSSL, EVP is
used for MD5 instead of the fallback implementation that Postgres had
for ages.  With the recent refactoring work for cryptohash functions,
this change is straight-forward.  If not building with OpenSSL, a
fallback implementation internal to src/common/ is used.

Second, this reduces the number of MD5 implementations present in the
tree from two to one, by moving the KAME implementation from pgcrypto to
src/common/, and by removing the implementation that existed in
src/common/.  KAME was already structured with an init/update/final set
of routines by pgcrypto (see original pgcrypto/md5.h) for compatibility
with OpenSSL, so moving it to src/common/ has proved to be a
straight-forward move, requiring no actual manipulation of the internals
of each routine.  Some benchmarking has not shown any performance gap
between both implementations.

Similarly to the fallback implementation used for SHA2, the fallback
implementation of MD5 is moved to src/common/md5.c with an internal
header called md5_int.h for the init, update and final routines.  This
gets then consumed by cryptohash.c.

The original routines used for MD5-hashed passwords are moved to a
separate file called md5_common.c, also in src/common/, aimed at being
shared between all MD5 implementations as utility routines to keep
compatibility with any code relying on them.

Like the SHA2 changes, this commit had its round of tests on both Linux
and Windows, across all versions of OpenSSL supported on HEAD, with and
even without OpenSSL.

Author: Michael Paquier
Reviewed-by: Daniel Gustafsson
Discussion: https://postgr.es/m/20201106073434.GA4961@paquier.xyz
2020-12-10 11:59:10 +09:00
..
unicode Fix minor issues with new unicode {de,re}composition code 2020-11-07 10:15:58 +09:00
.gitignore Replace the data structure used for keyword lookup. 2019-01-06 17:02:57 -05:00
archive.c Move routine building restore_command to src/common/ 2020-03-24 12:13:36 +09:00
base64.c Update copyrights for 2020 2020-01-01 12:21:45 -05:00
checksum_helper.c Move SHA2 routines to a new generic API layer for crypto hashes 2020-12-02 10:37:20 +09:00
config_info.c Simplify passing of configure arguments to pg_config 2020-02-10 19:23:41 +01:00
controldata_utils.c Update copyrights for 2020 2020-01-01 12:21:45 -05:00
cryptohash.c Refactor MD5 implementations according to new cryptohash infrastructure 2020-12-10 11:59:10 +09:00
cryptohash_openssl.c Refactor MD5 implementations according to new cryptohash infrastructure 2020-12-10 11:59:10 +09:00
d2s.c Update copyrights for 2020 2020-01-01 12:21:45 -05:00
d2s_full_table.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
d2s_intrinsics.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
digit_table.h Change floating-point output format for improved performance. 2019-02-13 15:20:33 +00:00
encnames.c Rationalize code placement between wchar.c, encnames.c, and mbutils.c. 2020-01-16 18:08:21 -05:00
exec.c Replace remaining StrNCpy() by strlcpy() 2020-08-10 23:20:37 +02:00
f2s.c Update copyrights for 2020 2020-01-01 12:21:45 -05:00
fe_memutils.c Update copyrights for 2020 2020-01-01 12:21:45 -05:00
file_perm.c Update copyrights for 2020 2020-01-01 12:21:45 -05:00
file_utils.c Skip unnecessary stat() calls in walkdir(). 2020-09-07 18:28:06 +12:00
hashfn.c Dial back -Wimplicit-fallthrough to level 3 2020-05-13 15:31:14 -04:00
ip.c Add support for abstract Unix-domain sockets 2020-11-25 08:33:57 +01:00
jsonapi.c Run pgindent with new pg_bsd_indent version 2.1.1. 2020-05-16 11:54:51 -04:00
keywords.c Allow most keywords to be used as column labels without requiring AS. 2020-09-18 16:46:36 -04:00
kwlookup.c Update copyrights for 2020 2020-01-01 12:21:45 -05:00
link-canary.c Update copyrights for 2020 2020-01-01 12:21:45 -05:00
logging.c Improve common/logging.c's support for multiple verbosity levels. 2020-09-17 12:52:18 -04:00
Makefile Refactor MD5 implementations according to new cryptohash infrastructure 2020-12-10 11:59:10 +09:00
md5.c Refactor MD5 implementations according to new cryptohash infrastructure 2020-12-10 11:59:10 +09:00
md5_common.c Refactor MD5 implementations according to new cryptohash infrastructure 2020-12-10 11:59:10 +09:00
md5_int.h Refactor MD5 implementations according to new cryptohash infrastructure 2020-12-10 11:59:10 +09:00
pg_get_line.c Rethink API for pg_get_line.c, one more time. 2020-09-22 15:55:13 -04:00
pg_lzcompress.c Second thoughts on TOAST decompression. 2020-11-02 11:25:18 -05:00
pgfnames.c Update copyrights for 2020 2020-01-01 12:21:45 -05:00
protocol_openssl.c Move OpenSSL routines for min/max protocol setting to src/common/ 2020-01-17 10:06:17 +09:00
psprintf.c Update copyrights for 2020 2020-01-01 12:21:45 -05:00
relpath.c Add declaration-level assertions for compile-time checks 2020-02-03 14:48:42 +09:00
restricted_token.c Fix -Wcast-function-type warnings on Windows/MinGW 2020-10-21 08:17:51 +02:00
rmtree.c Update copyrights for 2020 2020-01-01 12:21:45 -05:00
ryu_common.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
saslprep.c Remove arbitrary restrictions on password length. 2020-09-03 20:09:18 -04:00
scram-common.c Move SHA2 routines to a new generic API layer for crypto hashes 2020-12-02 10:37:20 +09:00
sha2.c Move SHA2 routines to a new generic API layer for crypto hashes 2020-12-02 10:37:20 +09:00
sha2_int.h Move SHA2 routines to a new generic API layer for crypto hashes 2020-12-02 10:37:20 +09:00
sprompt.c Remove arbitrary restrictions on password length. 2020-09-03 20:09:18 -04:00
string.c Update copyrights for 2020 2020-01-01 12:21:45 -05:00
stringinfo.c Update copyrights for 2020 2020-01-01 12:21:45 -05:00
unicode_norm.c Simplify code for getting a unicode codepoint's canonical class. 2020-12-09 13:24:38 +09:00
username.c Update copyrights for 2020 2020-01-01 12:21:45 -05:00
wait_error.c Update copyrights for 2020 2020-01-01 12:21:45 -05:00
wchar.c Dial back -Wimplicit-fallthrough to level 3 2020-05-13 15:31:14 -04:00