postgresql/contrib/pgcrypto
Michael Paquier b88afd8b61 pgcrypto: Detect errors with EVP calls from OpenSSL
The following routines are called within pgcrypto when handling digests
but there were no checks for failures:
- EVP_MD_CTX_size (can fail with -1 as of 3.0.0)
- EVP_MD_CTX_block_size (can fail with -1 as of 3.0.0)
- EVP_DigestInit_ex
- EVP_DigestUpdate
- EVP_DigestFinal_ex

A set of elog(ERROR) is added by this commit to detect such failures,
that should never happen except in the event of a processing failure
internal to OpenSSL.

Note that it would be possible to use ERR_reason_error_string() to get
more context about such errors, but these refer mainly to the internals
of OpenSSL, so it is not really obvious how useful that would be.  This
is left out for simplicity.

Per report from Coverity.  Thanks to Tom Lane for the discussion.

Backpatch-through: 9.5
2020-12-08 15:22:48 +09:00
..
expected Adjust pgcrypto's expected test results for --disable-strong-random. 2020-08-02 11:00:12 -04:00
sql Fix corner case with 16kB-long decompression in pgcrypto, take 2 2020-07-27 15:59:03 +09:00
.gitignore
blf.c
blf.h
crypt-blowfish.c Get rid of trailing semicolons in C macro definitions. 2020-05-01 17:28:01 -04:00
crypt-des.c
crypt-gensalt.c
crypt-md5.c Add missing error check in pgcrypto/crypt-md5.c. 2020-10-16 11:59:36 -04:00
imath.c Allow btree comparison functions to return INT_MIN. 2018-10-05 16:01:29 -04:00
imath.h
internal-sha2.c
internal.c
Makefile
mbuf.c
mbuf.h
md5.c
md5.h
openssl.c pgcrypto: Detect errors with EVP calls from OpenSSL 2020-12-08 15:22:48 +09:00
pgcrypto--1.0--1.1.sql
pgcrypto--1.1--1.2.sql
pgcrypto--1.2--1.3.sql
pgcrypto--1.3.sql
pgcrypto--unpackaged--1.0.sql
pgcrypto.c
pgcrypto.control
pgcrypto.h
pgp-armor.c Rename base64 routines to avoid conflict with Solaris built-in functions. 2018-02-28 18:33:45 -05:00
pgp-cfb.c
pgp-compress.c Fix corner case with 16kB-long decompression in pgcrypto, take 2 2020-07-27 15:59:03 +09:00
pgp-decrypt.c Fix misc typos in comments. 2019-01-23 13:43:41 +02:00
pgp-encrypt.c
pgp-info.c
pgp-mpi-internal.c
pgp-mpi-openssl.c
pgp-mpi.c
pgp-pgsql.c
pgp-pubdec.c
pgp-pubenc.c Fix generation of padding message before encrypting Elgamal in pgcrypto 2019-01-01 10:39:29 +09:00
pgp-pubkey.c
pgp-s2k.c
pgp.c
pgp.h
px-crypt.c
px-crypt.h
px-hmac.c
px.c Improve style guideline compliance of assorted error-report messages. 2018-03-22 17:33:10 -04:00
px.h
rijndael.c Fix a boatload of typos in C comments. 2018-04-01 15:01:28 -04:00
rijndael.h
rijndael.tbl
sha1.c
sha1.h