From: Peter Eisentraut <peter@eisentraut.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: pgcrypto: Remove internal padding implementation
Date: Tue, 22 Mar 2022 08:00:06 +0000
Message-ID: <E1nWZQz-000pyf-Uc@gemulon.postgresql.org> (raw)
pgcrypto: Remove internal padding implementation
Use the padding provided by OpenSSL instead of doing it ourselves.
The internal implementation was once applicable to the non-OpenSSL
code paths, but those have since been removed. The padding algorithm
is still the same.
The OpenSSL padding implementation is stricter than the previous
internal one: Bad padding during decryption is now an error, and
encryption without padding now requires the input size to be a
multiple of the block size, otherwise it is also an error.
Previously, these cases silently proceeded, in spite of the
documentation saying otherwise.
Add some test cases about this, too. (The test cases are in
rijndael.sql, but they apply to all encryption algorithms.)
Reviewed-by: Jacob Champion <pchampion@vmware.com>
Reviewed-by: Nathan Bossart <nathandbossart@gmail.com>
Discussion: https://www.postgresql.org/message-id/flat/ba94c26b-0c58-c97e-7a44-f44e08b4cca2%40enterprisedb.com
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/f5576a21b0778f275d7418f6f7a44d9400ee90aa
Modified Files
--------------
contrib/pgcrypto/expected/rijndael.out | 14 ++++
contrib/pgcrypto/openssl.c | 22 +++---
contrib/pgcrypto/pgp-cfb.c | 4 +-
contrib/pgcrypto/px.c | 120 +--------------------------------
contrib/pgcrypto/px.h | 14 ++--
contrib/pgcrypto/sql/rijndael.sql | 12 ++++
6 files changed, 52 insertions(+), 134 deletions(-)
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-committers@postgresql.org
Cc: peter@eisentraut.org
Subject: Re: pgsql: pgcrypto: Remove internal padding implementation
In-Reply-To: <E1nWZQz-000pyf-Uc@gemulon.postgresql.org>
References: <E1nWZQz-000pyf-Uc@gemulon.postgresql.org>
* 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