Re: Is OpenSSL AES-NI not available in pgcrypto?

From: Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>
To: "agharta82(at)gmail(dot)com" <agharta82(at)gmail(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Is OpenSSL AES-NI not available in pgcrypto?
Date: 2023-01-03 15:54:31
Message-ID: 83bd3e5c-1d7e-0b34-9e93-9fa8ecd0a77e@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 02.01.23 17:57, agharta82(at)gmail(dot)com wrote:
> select pgp_sym_encrypt(data::text, 'pwd') --default to aes128
> from generate_series('2022-01-01'::timestamp, '2022-12-31'::timestamp,
> '1 hour'::interval) data
>
> vs
>
> select pgp_sym_encrypt(data::text, 'pwd','cipher-algo=bf') -- blowfish
> from generate_series('2022-01-01'::timestamp, '2022-12-31'::timestamp,
> '1 hour'::interval) data
>
> In my test both queries execution is similar....aes-128 was expected
> about  5 time faster.
>
> So, why?
>
> Pgcrypto use OpenSSL as backend, so, does it explicit force software aes
> calculation instead of AES-NI cpu ones?

I suspect it is actually using AES hardware support, but all the other
overhead of pgcrypto makes the difference not noticeable.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2023-01-03 16:02:36 Re: perl 5.36, C99, -Wdeclaration-after-statement -Wshadow=compatible-local
Previous Message Tom Lane 2023-01-03 15:48:39 Re: perl 5.36, C99, -Wdeclaration-after-statement -Wshadow=compatible-local