From: Tom Lane Date: Sat, 28 Jan 2012 04:09:16 +0000 (-0500) Subject: Fix error detection in contrib/pgcrypto's encrypt_iv() and decrypt_iv(). X-Git-Tag: REL9_1_3~35 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7c016e3f56e2a7d8e9dd00a6d2d80bdc2239424e;p=postgresql Fix error detection in contrib/pgcrypto's encrypt_iv() and decrypt_iv(). Due to oversights, the encrypt_iv() and decrypt_iv() functions failed to report certain types of invalid-input errors, and would instead return random garbage values. Marko Kreen, per report from Stefan Kaltenbrunner --- diff --git a/contrib/pgcrypto/pgcrypto.c b/contrib/pgcrypto/pgcrypto.c index d271ddc302..1da3afcd1d 100644 --- a/contrib/pgcrypto/pgcrypto.c +++ b/contrib/pgcrypto/pgcrypto.c @@ -342,8 +342,8 @@ pg_encrypt_iv(PG_FUNCTION_ARGS) err = px_combo_init(c, (uint8 *) VARDATA(key), klen, (uint8 *) VARDATA(iv), ivlen); if (!err) - px_combo_encrypt(c, (uint8 *) VARDATA(data), dlen, - (uint8 *) VARDATA(res), &rlen); + err = px_combo_encrypt(c, (uint8 *) VARDATA(data), dlen, + (uint8 *) VARDATA(res), &rlen); px_combo_free(c); @@ -396,8 +396,8 @@ pg_decrypt_iv(PG_FUNCTION_ARGS) err = px_combo_init(c, (uint8 *) VARDATA(key), klen, (uint8 *) VARDATA(iv), ivlen); if (!err) - px_combo_decrypt(c, (uint8 *) VARDATA(data), dlen, - (uint8 *) VARDATA(res), &rlen); + err = px_combo_decrypt(c, (uint8 *) VARDATA(data), dlen, + (uint8 *) VARDATA(res), &rlen); px_combo_free(c);