Re: pgcrypto: remove useless px_memset() and BF_ASM

From: Daniel Gustafsson <daniel(at)yesql(dot)se>
To: Dagfinn Ilmari Mannsåker <ilmari(at)ilmari(dot)org>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: pgcrypto: remove useless px_memset() and BF_ASM
Date: 2026-04-09 19:07:09
Message-ID: 9B96C179-32FA-4715-BC26-4E31D9EFF3A2@yesql.se
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> On 9 Apr 2026, at 13:51, Dagfinn Ilmari Mannsåker <ilmari(at)ilmari(dot)org> wrote:

> In the thread about centralised architecture detection, I noticed that
> the BF_ASM macro in crypt-blowfish.c has never been defined to anything
> but 0, and the _BF_body_r() function it would call has never existed, so
> that can be got rid of.

Agreed. I didn't do enough archaeology to figure out what upstream has/had or
why it was removed, but it's been dead for 25 odd years so it's about time to
remove.

> While investigating at that, I also noticed that px_memset(), which has
> the comment /* memset that must not be optimized away */, is only ever
> called with zero for the value, which could be better written with
> explicit_bzero() now that we have that.

One could imagine various tricks for rewriting px_memset to explicit_bzero in
order to reduce the churn, but since this code is very rarely backpatched into
it's not a big problem IMHO.

I'll have another look with fresh eyes once back in the office.

--
Daniel Gustafsson

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Yogesh Sharma 2026-04-09 19:21:25 Re: Logging parallel worker draught
Previous Message SATYANARAYANA NARLAPURAM 2026-04-09 18:43:09 Bug: var_is_nonnullable() gives wrong results for old/new in RETURNING