Introduce SHA1 implementations in the cryptohash infrastructure

Michael Paquier <michael@paquier.xyz>

Commit: a8ed6bb8f4cf259b95c1bff5da09a8f4c79dca46
Author: Michael Paquier <michael@paquier.xyz>
Date: 2021-01-23T02:33:04Z
Releases: 14.0
Introduce SHA1 implementations in the cryptohash infrastructure

With this commit, SHA1 goes through the implementation provided by
OpenSSL via EVP when building the backend with it, and uses as fallback
implementation KAME which was located in pgcrypto and already shaped for
an integration with a set of init, update and final routines.
Structures and routines have been renamed to make things consistent with
the fallback implementations of MD5 and SHA2.

uuid-ossp has used for ages a shortcut with pgcrypto to fetch a copy of
SHA1 if needed.  This was built depending on the build options within
./configure, so this cleans up some code and removes the build
dependency between pgcrypto and uuid-ossp.

Note that this will help with the refactoring of HMAC, as pgcrypto
offers the option to use MD5, SHA1 or SHA2, so only the second option
was missing to make that possible.

Author: Michael Paquier
Reviewed-by: Heikki Linnakangas
Discussion: https://postgr.es/m/X9HXKTgrvJvYO7Oh@paquier.xyz

Files

PathChange+/−
configure modified +7 −12
configure.ac modified +10 −14
contrib/pgcrypto/internal.c modified +14 −20
contrib/pgcrypto/Makefile modified +1 −1
contrib/pgcrypto/sha1.c deleted +0 −331
contrib/uuid-ossp/.gitignore modified +0 −1
contrib/uuid-ossp/Makefile modified +0 −6
contrib/uuid-ossp/uuid-ossp.c modified +12 −15
src/common/cryptohash.c modified +11 −0
src/common/cryptohash_openssl.c modified +3 −0
src/common/Makefile modified +1 −0
src/common/sha1.c added +369 −0
src/common/sha1_int.h (from contrib/pgcrypto/sha1.h) renamed +25 −19
src/include/common/cryptohash.h modified +1 −0
src/include/common/sha1.h added +19 −0
src/Makefile.global.in modified +0 −1
src/tools/msvc/Mkvcbuild.pm modified +5 −4
src/tools/pgindent/typedefs.list modified +1 −0

Discussion