Re: Support for NSS as a libpq TLS backend

From: Daniel Gustafsson <daniel(at)yesql(dot)se>
To: Jacob Champion <pchampion(at)vmware(dot)com>
Cc: "michael(at)paquier(dot)xyz" <michael(at)paquier(dot)xyz>, "hlinnaka(at)iki(dot)fi" <hlinnaka(at)iki(dot)fi>, "pgsql-hackers(at)lists(dot)postgresql(dot)org" <pgsql-hackers(at)lists(dot)postgresql(dot)org>, "andrew(dot)dunstan(at)2ndquadrant(dot)com" <andrew(dot)dunstan(at)2ndquadrant(dot)com>, "thomas(dot)munro(at)gmail(dot)com" <thomas(dot)munro(at)gmail(dot)com>, "andres(at)anarazel(dot)de" <andres(at)anarazel(dot)de>, "sfrost(at)snowman(dot)net" <sfrost(at)snowman(dot)net>
Subject: Re: Support for NSS as a libpq TLS backend
Date: 2021-02-01 20:49:26
Message-ID: 464B85DD-4734-4268-9C31-D1BCEEC3A98B@yesql.se
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> On 29 Jan 2021, at 19:46, Jacob Champion <pchampion(at)vmware(dot)com> wrote:

> I think the bad news is that the static approach will need support for
> ENABLE_THREAD_SAFETY.

I did some more reading today and noticed that the NSS documentation (and their
sample code for doing crypto without TLS connections) says to use NSS_NoDB_Init
to perform a read-only init which don't require a matching close call. Now,
the docs aren't terribly clear and also seems to have gone offline from MDN,
and skimming the code isn't entirelt self-explanatory, so I may well have
missed something. The v24 patchset posted changes to this and at least passes
tests with decent performance so it seems worth investigating.

> (It looks like the NSS implementation of pgtls_close() needs some thread
> support too?)

Storing the context in conn would probably be better?

> The good(?) news is that I don't understand why OpenSSL's
> implementation of cryptohash doesn't _also_ need the thread-safety
> code. (Shouldn't we need to call CRYPTO_set_locking_callback() et al
> before using any of its cryptohash implementation?) So maybe we can
> implement the same global setup/teardown API for OpenSSL too and not
> have to one-off it for NSS...

No idea here, wouldn't that impact pgcrypto as well in that case?

--
Daniel Gustafsson https://vmware.com/

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Daniel Gustafsson 2021-02-01 20:51:49 Re: Support for NSS as a libpq TLS backend
Previous Message Daniel Gustafsson 2021-02-01 20:49:20 Re: Support for NSS as a libpq TLS backend