Commits

Anonymous committed 7c016e3

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

  • Participants
  • Parent commits b7922a6
  • Branches rowexpr91

Comments (0)

Files changed (1)

contrib/pgcrypto/pgcrypto.c

 	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);
 
 	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);