pgsql: The large one adds support for RSA keys and reorganizes the

From: momjian(at)svr1(dot)postgresql(dot)org (Bruce Momjian)
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: The large one adds support for RSA keys and reorganizes the
Date: 2005-08-13 02:06:22
Message-ID: 20050813020622.0D63752BD5@svr1.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Log Message:
-----------
The large one adds support for RSA keys and reorganizes
the pubkey functions a bit. The actual RSA-specific code
there is tiny, most of the patch consists of reorg of the
pubkey code, as lots of it was written as elgamal-only.

---------------------------------------------------------------------------

The SHLIB section was copy-pasted from somewhere and contains
several unnecessary libs. This cleans it up a bit.

-lcrypt
we don't use system crypt()

-lssl, -lssleay32
no SSL here

-lz in win32 section
already added on previous line

-ldes
The chance anybody has it is pretty low.
And the chance pgcrypto works with it is even lower.

Also trim the win32 section.

---------------------------------------------------------------------------

It is already disabled in Makefile, remove code too.

---------------------------------------------------------------------------

I was bit hasty making the random exponent 'k' a prime. Further researh
shows that Elgamal encryption has no specific needs in respect to k,
any random number is fine.

It is bit different for signing, there it needs to be 'relatively prime'
to p - 1, that means GCD(k, p-1) == 1, which is also a lot lighter than
full primality. As we don't do signing, this can be ignored.

This brings major speedup to Elgamal encryption.

---------------------------------------------------------------------------

o pgp_mpi_free: Accept NULLs
o pgp_mpi_cksum: result should be 16bit
o Remove function name from error messages - to be similar to other
SQL functions, and it does not match anyway the called function
o remove couple junk lines

---------------------------------------------------------------------------

o Support for RSA encryption
o Big reorg to better separate generic and algorithm-specific code.
o Regression tests for RSA.

---------------------------------------------------------------------------

o Tom stuck a CVS id into file. I doubt the usefulness of it,
but if it needs to be in the file then rather at the end.
Also tag it as comment for asciidoc.
o Mention bytea vs. text difference
o Couple clarifications

---------------------------------------------------------------------------

There is a choice whether to update it with pgp functions or
remove it. I decided to remove it, updating is pointless.

I've tried to keep the core of pgcrypto relatively independent
from main PostgreSQL, to make it easy to use externally if needed,
and that is good. Eg. that made development of PGP functions much
nicer.

But I have no plans to release it as generic library, so keeping such
doc
up-to-date is waste of time. If anyone is interested in using it in
other products, he can probably bother to read the source too.

Commented source is another thing - I'll try to make another pass
over code to see if there is anything non-obvious that would need
more comments.

---------------------------------------------------------------------------

Marko Kreen

Modified Files:
--------------
pgsql/contrib/pgcrypto:
Makefile (r1.21 -> r1.22)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/contrib/pgcrypto/Makefile.diff?r1=1.21&r2=1.22)
README.pgcrypto (r1.12 -> r1.13)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/contrib/pgcrypto/README.pgcrypto.diff?r1=1.12&r2=1.13)
pgp-info.c (r1.2 -> r1.3)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/contrib/pgcrypto/pgp-info.c.diff?r1=1.2&r2=1.3)
pgp-mpi-internal.c (r1.2 -> r1.3)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/contrib/pgcrypto/pgp-mpi-internal.c.diff?r1=1.2&r2=1.3)
pgp-mpi-openssl.c (r1.2 -> r1.3)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/contrib/pgcrypto/pgp-mpi-openssl.c.diff?r1=1.2&r2=1.3)
pgp-mpi.c (r1.2 -> r1.3)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/contrib/pgcrypto/pgp-mpi.c.diff?r1=1.2&r2=1.3)
pgp-pgsql.c (r1.3 -> r1.4)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/contrib/pgcrypto/pgp-pgsql.c.diff?r1=1.3&r2=1.4)
pgp-pubdec.c (r1.3 -> r1.4)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/contrib/pgcrypto/pgp-pubdec.c.diff?r1=1.3&r2=1.4)
pgp-pubenc.c (r1.2 -> r1.3)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/contrib/pgcrypto/pgp-pubenc.c.diff?r1=1.2&r2=1.3)
pgp-pubkey.c (r1.2 -> r1.3)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/contrib/pgcrypto/pgp-pubkey.c.diff?r1=1.2&r2=1.3)
pgp.h (r1.2 -> r1.3)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/contrib/pgcrypto/pgp.h.diff?r1=1.2&r2=1.3)
px-crypt.c (r1.12 -> r1.13)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/contrib/pgcrypto/px-crypt.c.diff?r1=1.12&r2=1.13)
px-crypt.h (r1.7 -> r1.8)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/contrib/pgcrypto/px-crypt.h.diff?r1=1.7&r2=1.8)
px.c (r1.13 -> r1.14)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/contrib/pgcrypto/px.c.diff?r1=1.13&r2=1.14)
px.h (r1.14 -> r1.15)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/contrib/pgcrypto/px.h.diff?r1=1.14&r2=1.15)
pgsql/contrib/pgcrypto/expected:
pgp-armor.out (r1.1 -> r1.2)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/contrib/pgcrypto/expected/pgp-armor.out.diff?r1=1.1&r2=1.2)
pgp-encrypt.out (r1.1 -> r1.2)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/contrib/pgcrypto/expected/pgp-encrypt.out.diff?r1=1.1&r2=1.2)
pgp-info.out (r1.1 -> r1.2)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/contrib/pgcrypto/expected/pgp-info.out.diff?r1=1.1&r2=1.2)
pgp-pubkey-decrypt.out (r1.1 -> r1.2)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/contrib/pgcrypto/expected/pgp-pubkey-decrypt.out.diff?r1=1.1&r2=1.2)
pgp-pubkey-encrypt.out (r1.1 -> r1.2)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/contrib/pgcrypto/expected/pgp-pubkey-encrypt.out.diff?r1=1.1&r2=1.2)
pgsql/contrib/pgcrypto/sql:
pgp-info.sql (r1.1 -> r1.2)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/contrib/pgcrypto/sql/pgp-info.sql.diff?r1=1.1&r2=1.2)
pgp-pubkey-decrypt.sql (r1.1 -> r1.2)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/contrib/pgcrypto/sql/pgp-pubkey-decrypt.sql.diff?r1=1.1&r2=1.2)
pgp-pubkey-encrypt.sql (r1.1 -> r1.2)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/contrib/pgcrypto/sql/pgp-pubkey-encrypt.sql.diff?r1=1.1&r2=1.2)

Browse pgsql-committers by date

  From Date Subject
Next Message Bruce Momjian 2005-08-13 02:48:24 pgsql: CREATE TABLE has optional column names, so change {} to [].
Previous Message Bruce Momjian 2005-08-13 01:55:42 pgsql: Add documentation: >>>I think a more accurate description would