Re: Patch to eliminate duplicate b64 code from pgcrypto

From: Marc Munro <marc(at)bloodnok(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Patch to eliminate duplicate b64 code from pgcrypto
Date: 2008-12-18 20:21:40
Message-ID: 1229631700.7683.44.camel@bloodnok.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Oops, forgot to cc my reply to hackers:

On Thu, 2008-12-18 at 01:49 +0200, Marko Kreen wrote:
> On 12/16/08, Bruce Momjian <bruce(at)momjian(dot)us> wrote:
> > Would someone who understand pgcrypto please review this?
>
> > Marc Munro wrote:
> > > I am attaching a patch to eliminate duplicate b64_encode and decode
> > > functions from pgcrypto, and to expose those functions for use by
> > > add-ins (I want to use them in Veil).
>
> Although your patch achieves the goal, it may make more sense to export
> pg_find_encoding() and struct pg_encoding, thus making all encoding
> algorithms available externally.

I had a very specific use-case in mind which was to eliminate the need
for Veil to re-implement b64_encode and b64_decode, so I took the path
of least effort.

> > > The patch was made against CVS head today. It compiles and tests
> > > successfully. Though I was unable to run pgrypto regression tests, I
> > > did give the b64 encoding a sanity check.
> > >
> > > I also added a b64_char() function that is now used from pgcrypto. This
> > > allowed me to remove the duplicate _base64 character array.
>
> I think this can be avoided by using plain b64_encode() for those 3 bytes.
> That step is really not speed critical.

You are probably right: I was being somewhat timid and tried to make the
smallest set of changes that were possible.

Unfortunately I don't have the time right now to revisit the patch. If
you or anyone else would like to re-implement it as you suggest I will
still be a happy camper. If not, Veil has already re-implemented the
functions, for compatibility with current and older versions of
postgres, so I can live with that too.

Thanks very much for looking at it. To be honest, I thought that it had
got lost in the transition to the new improved patch process so I was
expecting to have to resubmit it later when I have more time. Kudos to
Bruce for tracking it down.

__
Marc

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2008-12-18 20:33:24 Re: PLUGINS Functionlity in Win32 build scripts
Previous Message Pavel Stehule 2008-12-18 20:16:52 Re: Function with defval returns error