From: Stefan Kaltenbrunner <stefan@kaltenbrunner.cc>
To: Postgres-Bugs <pgsql-bugs@postgresql.org>
Subject: Re: pgcrypto decrypt_iv() issue
Date: Tue, 24 Jan 2012 22:34:32 +0100
Message-ID: <4F1F23E8.80100@kaltenbrunner.cc> (raw)
In-Reply-To: <4F1DB7BF.60304@kaltenbrunner.cc>
References: <4F1DB7BF.60304@kaltenbrunner.cc>
On 01/23/2012 08:40 PM, Stefan Kaltenbrunner wrote:
> We are using the raw decryption features of contrib/pgcrypto here to
> decode certain AES128 encrypted data. However depending on the data to
> decode and what statements have been executed in the same session before
> we are seeing different (and sometimes completely wrong) answers
>
> this is 9.1.2 on Debian/amd64 compiled with -enable-debug (note that the
> the first and the third query do not result in the same answer):
>
>
[examples snipped]
>
> which seems even more of a "wtf"?!
from some looking at the code in pgcrypto.c it seems to me that the
coding pattern in most functions there only checks for errors from the
corresponding initialization function, in the case of say decrypt_iv()
that means only the IV and the key are actually "validated" because that
is what the init function sees(it never sees that data!), if the actual
decrypt call fails (because the data is maybe a bit weird^broken) it
will happily ignore that and return random data.
Stefan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: stefan@kaltenbrunner.cc
Subject: Re: pgcrypto decrypt_iv() issue
In-Reply-To: <4F1F23E8.80100@kaltenbrunner.cc>
References: <4F1DB7BF.60304@kaltenbrunner.cc> <4F1F23E8.80100@kaltenbrunner.cc>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox