Обсуждение: Check for interrupts in bf and xdes crypt()

Поиск
Список
Период
Сортировка

Check for interrupts in bf and xdes crypt()

От
Andreas Karlsson
Дата:
Hi,

Here is a patch which makes it possible to cancel a query which runs the
crypt() function with the bf or xdes hashing algorithm, e.g.
crypt('foo', gen_salt('bf', 13)). The md5 algorithm does not run for
multiple rounds so there is no reason to patch it.

I noticed this problem when I accidentally picked a too high n for the
number of hash rounds.

I have added a call to CHECK_FOR_INTERRUPTS() after every round, and I
could not measure any performance hit from this.

Andreas

Вложения

Re: Check for interrupts in bf and xdes crypt()

От
Jeff Janes
Дата:
On Tue, Dec 15, 2015 at 12:35 AM, Andreas Karlsson <andreas@proxel.se> wrote:
> Hi,
>
> Here is a patch which makes it possible to cancel a query which runs the
> crypt() function with the bf or xdes hashing algorithm, e.g. crypt('foo',
> gen_salt('bf', 13)). The md5 algorithm does not run for multiple rounds so
> there is no reason to patch it.
>
> I noticed this problem when I accidentally picked a too high n for the
> number of hash rounds.
>
> I have added a call to CHECK_FOR_INTERRUPTS() after every round, and I could
> not measure any performance hit from this.

Looks good to me.  Applies, builds, passes make check, does what it
says and says what it does.  No need for docs, no noticeable
performance impact.

I've marked it ready for committer.  Also recommend for back-patching.

Cheers,

Jeff



Re: Check for interrupts in bf and xdes crypt()

От
Alvaro Herrera
Дата:
Jeff Janes wrote:
> On Tue, Dec 15, 2015 at 12:35 AM, Andreas Karlsson <andreas@proxel.se> wrote:

> > Here is a patch which makes it possible to cancel a query which runs the
> > crypt() function with the bf or xdes hashing algorithm, e.g. crypt('foo',
> > gen_salt('bf', 13)). The md5 algorithm does not run for multiple rounds so
> > there is no reason to patch it.

> Looks good to me.  Applies, builds, passes make check, does what it
> says and says what it does.  No need for docs, no noticeable
> performance impact.
> 
> I've marked it ready for committer.  Also recommend for back-patching.

Pushed, thanks.

-- 
Álvaro Herrera                http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services