Skip to content
Snippets Groups Projects
Commit a8b4b843 authored by Tom Lane's avatar Tom Lane
Browse files

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
parent 0816fad6
No related branches found
No related tags found
No related merge requests found
...@@ -341,8 +341,8 @@ pg_encrypt_iv(PG_FUNCTION_ARGS) ...@@ -341,8 +341,8 @@ pg_encrypt_iv(PG_FUNCTION_ARGS)
err = px_combo_init(c, (uint8 *) VARDATA(key), klen, err = px_combo_init(c, (uint8 *) VARDATA(key), klen,
(uint8 *) VARDATA(iv), ivlen); (uint8 *) VARDATA(iv), ivlen);
if (!err) if (!err)
px_combo_encrypt(c, (uint8 *) VARDATA(data), dlen, err = px_combo_encrypt(c, (uint8 *) VARDATA(data), dlen,
(uint8 *) VARDATA(res), &rlen); (uint8 *) VARDATA(res), &rlen);
px_combo_free(c); px_combo_free(c);
...@@ -395,8 +395,8 @@ pg_decrypt_iv(PG_FUNCTION_ARGS) ...@@ -395,8 +395,8 @@ pg_decrypt_iv(PG_FUNCTION_ARGS)
err = px_combo_init(c, (uint8 *) VARDATA(key), klen, err = px_combo_init(c, (uint8 *) VARDATA(key), klen,
(uint8 *) VARDATA(iv), ivlen); (uint8 *) VARDATA(iv), ivlen);
if (!err) if (!err)
px_combo_decrypt(c, (uint8 *) VARDATA(data), dlen, err = px_combo_decrypt(c, (uint8 *) VARDATA(data), dlen,
(uint8 *) VARDATA(res), &rlen); (uint8 *) VARDATA(res), &rlen);
px_combo_free(c); px_combo_free(c);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment