Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit826f14f

Browse files
author
Neil Conway
committed
Some builds (depends on crypto engine support?) of OpenSSL
0.9.7x have EVP_DigestFinal function which which clears all ofEVP_MD_CTX. This makes pgcrypto crash in functions whichre-use one digest context several times: hmac() and crypt()with md5 algorithm.Following patch fixes it by carring the digest info aroundEVP_DigestFinal and re-initializing cipher.Marko Kreen.
1 parent5e72d01 commit826f14f

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

‎contrib/pgcrypto/openssl.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2727
* SUCH DAMAGE.
2828
*
29-
* $Id: openssl.c,v 1.10.2.1 2005/03/13 23:42:07 neilc Exp $
29+
* $Id: openssl.c,v 1.10.2.2 2005/03/13 23:46:27 neilc Exp $
3030
*/
3131

3232
#include<postgres.h>
@@ -73,8 +73,15 @@ static void
7373
digest_finish(PX_MD*h,uint8*dst)
7474
{
7575
EVP_MD_CTX*ctx= (EVP_MD_CTX*)h->p.ptr;
76+
constEVP_MD*md=EVP_MD_CTX_md(ctx);
7677

7778
EVP_DigestFinal(ctx,dst,NULL);
79+
80+
/*
81+
* Some builds of 0.9.7x clear all of ctx in EVP_DigestFinal.
82+
* Fix it by reinitializing ctx.
83+
*/
84+
EVP_DigestInit(ctx,md);
7885
}
7986

8087
staticvoid

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp