From: Bruce Momjian Date: Mon, 4 Jul 2005 14:42:39 +0000 (+0000) Subject: Backpatch to 8.0.X openssl portability fixes to pgcrypto. X-Git-Url: http://git.postgresql.org/gitweb/static/gitweb.js?a=commitdiff_plain;h=24dc54fa27dd1fcfce11525d5ccd42cb6af58666;p=users%2Fbernd%2Fpostgres.git Backpatch to 8.0.X openssl portability fixes to pgcrypto. --- diff --git a/contrib/pgcrypto/openssl.c b/contrib/pgcrypto/openssl.c index 7836c9cd1a..7ea98e4347 100644 --- a/contrib/pgcrypto/openssl.c +++ b/contrib/pgcrypto/openssl.c @@ -34,7 +34,19 @@ #include "px.h" #include +#include +#include +#include +/* + * Does OpenSSL support AES? + */ +#undef GOT_AES +#if OPENSSL_VERSION_NUMBER >= 0x00907000L +#define GOT_AES +#include +#endif + /* * Hashes */ @@ -73,8 +85,15 @@ static void digest_finish(PX_MD * h, uint8 *dst) { EVP_MD_CTX *ctx = (EVP_MD_CTX *) h->p.ptr; + const EVP_MD *md = EVP_MD_CTX_md(ctx); EVP_DigestFinal(ctx, dst, NULL); + + /* + * Some builds of 0.9.7x clear all of ctx in EVP_DigestFinal. + * Fix it by reinitializing ctx. + */ + EVP_DigestInit(ctx, md); } static void