git.postgresql.org Git - postgresql.git/commitdiff

git projects / postgresql.git / commitdiff
? search:
summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 8d3b389)
Fix generation of padding message before encrypting Elgamal in pgcrypto
Tue, 1 Jan 2019 01:39:19 +0000 (10:39 +0900)
Tue, 1 Jan 2019 01:39:19 +0000 (10:39 +0900)
fe0a0b5, which has added a stronger random source in Postgres, has
introduced a thinko when creating a padding message which gets encrypted
for Elgamal. The padding message cannot have zeros, which are replaced
by random bytes. However if pg_strong_random() failed, the message
would finish by being considered in correct shape for encryption with
zeros.

Author: Tom Lane
Reviewed-by: Michael Paquier
Discussion: https://postgr.es/m/20186.1546188423@sss.pgh.pa.us
Backpatch-through: 10


diff --git a/contrib/pgcrypto/pgp-pubenc.c b/contrib/pgcrypto/pgp-pubenc.c
index 443987666431f9c0b3ce9ffbc78b11738449a4c4..e4ff832f90d0bd08fd3df8f59e41f4a149e37810 100644 (file)
--- a/contrib/pgcrypto/pgp-pubenc.c
+++ b/contrib/pgcrypto/pgp-pubenc.c
@@ -66,7 +66,7 @@ pad_eme_pkcs1_v15(uint8 *data, int data_len, int res_len, uint8 **res_p)
{
px_memset(buf, 0, res_len);
px_free(buf);
- break;
+ return PXE_NO_RANDOM;
}
}
if (*p != 0)
This is the main PostgreSQL git repository.
RSS Atom

AltStyle によって変換されたページ (->オリジナル) /