Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1k2dc1-0003Sq-Rg for pgsql-hackers@arkaria.postgresql.org; Mon, 03 Aug 2020 16:46:58 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1k2dbz-0002j3-Ki for pgsql-hackers@arkaria.postgresql.org; Mon, 03 Aug 2020 16:46:55 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1k2dby-0002iu-C4 for pgsql-hackers@lists.postgresql.org; Mon, 03 Aug 2020 16:46:55 +0000 Received: from mail-qt1-x842.google.com ([2607:f8b0:4864:20::842]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1k2dba-0003ja-1Z for pgsql-hackers@lists.postgresql.org; Mon, 03 Aug 2020 16:46:53 +0000 Received: by mail-qt1-x842.google.com with SMTP id k18so28675439qtm.10 for ; Mon, 03 Aug 2020 09:46:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=from:subject:to:cc:references:autocrypt:message-id:date:user-agent :mime-version:in-reply-to:content-language; bh=ckWnYIAf9zIYubkb08Hnx2eSln2aC1EfNhA1vDftPns=; b=dZOg3X/y/QEXYswOrMCNj0uM0K4/twB4m3X0bdYBJtyqin+Kb7N050GQu0BUzeNqFE GJTWOnFdNQJxS9P2rZZ+MQZ/EWshp3VkABaKOow8cjF0Ot5cGhf1Ndwe5hVuupuFR5XK 0ErRUhxTafiJqHdOpiguPkLI2rQxyfIassStopwwEftH+t+AcFU7nV5cC1QmlwR8BFwq BLEpOqYqjoc+OVIj9mqPNBEYNadMlpSxUlGEsUjkuceFtrGgvLFjQ7GD/eAiphX7ncqY SzvoyGQv257Xq8LxF4HB4Bkykc2rfjxqlZHlJWaXV27d76yOFF9+PKnE/BxGOBVSQmeS 3aiw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:subject:to:cc:references:autocrypt :message-id:date:user-agent:mime-version:in-reply-to :content-language; bh=ckWnYIAf9zIYubkb08Hnx2eSln2aC1EfNhA1vDftPns=; b=df5Lzo/sBhUdYFss9CfN0GwuFceyzaHJgxN6SqyZdxsexa88ehLBmatoKwB4VXKR+a YwtSIqu5bXoEVuo9yIKOzERmoltt/9dlpf/eaG06hRjXZ0szqt97HvanSvO46WScaY+k UB0hjIHRm1TmwOBqTLyxkXfF1vN2x03xlL7HB0fRve3PtGthSYXtXYC6NPBFH8gvT08D hrGDgBkeXafkXfOspDZJwPyk+VDbIaVfy9FPSoKk54yaJYDrWJX1Nq3kPWlRU2pUNFRu /sIr66Ugi3iE64Yryevo4Vx/F58UC3ku0MKAop5yoDfMcoIbCrMkxi0Gh7uY+MAmpVXm gatA== X-Gm-Message-State: AOAM532GabGTeZwRFHhKkFshEHa2qKJNo4RamZYKGGpLi01Okr2ffz2K dziEeC6/zyJSW4nnO0kaG310 X-Google-Smtp-Source: ABdhPJwGD1BW1f8pL/D81kxW/mkEmmqlSae3MIkPmJCO+NDTDiDVn6MVPVgxthACRg/+58BBGCBgmg== X-Received: by 2002:ac8:104:: with SMTP id e4mr17648030qtg.47.1596473188584; Mon, 03 Aug 2020 09:46:28 -0700 (PDT) Received: from ?IPv6:2600:1700:722:4630::43? ([2600:1700:722:4630::43]) by smtp.gmail.com with ESMTPSA id d198sm19200826qke.129.2020.08.03.09.46.25 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 03 Aug 2020 09:46:26 -0700 (PDT) From: Andrew Dunstan X-Google-Original-From: Andrew Dunstan Subject: Re: Support for NSS as a libpq TLS backend To: Daniel Gustafsson Cc: Postgres hackers , Stephen Frost References: <08B1D888-6151-4002-B0C2-488893AB51B2@yesql.se> Autocrypt: addr=andrew.dunstan@2ndQuadrant.com; prefer-encrypt=mutual; keydata= mQENBE7KWFkBCAClridxur2AIc7eW2AR7izbfp3EnNefie2HbLF0izW5Ik5UjX2HBXBx4syI gY6b0ugohXrr274+baoAlvSbq6cAoQuEVrk5IZFzt20b1Xkx65FwGSEj526yiKLocqkJceSq Xr9xcA5SGY+FZv441chh5SU92v4q6z+6LPpoHOh97ptAVXZYNTtU0LevyvD5lja0TzbvJm6C eFXitJfnm1pLEr0DGJCR/iUOl/N62Kh4855zZC7NHIjQHPOvV5Stz/l5ilDhvGVk+xkXFPys SjZoUr1rXhYLpiyi5sR0X9FHXT0KnGuz1F5ERO7ZTLSSQ6fJwPj6gOk9K+vvoKvoeql5ABEB AAG0L0FuZHJldyBEdW5zdGFuIDxhbmRyZXcuZHVuc3RhbkAybmRRdWFkcmFudC5jb20+iQFY BBMBAgBCAhsDBgsJCAcDAgYVCAIJCgsEFgIDAQIeAQIXgBYhBOQ+WEYd/Hy/RGkVpZn6f8tZ /DuBAhkBBQJd1pSYBQkSzqMsAAoJEJn6f8tZ/DuBJmEIAIVFBIC3qGqh+YTPVTkfowwxpHz0 tZSPjZ6GS/5y62kgoZrZOVXw+Rg2ceuMM3a+In/RRjTx4bembgYqRKgzXlDfiNBJeq5ioVuN H1faDKE2lm5a6QkRQ2JU6DKf60fqSJGP5LisCUr1V0wz6EnlO31ArrKtXCNB+yk0KDAS6o6I Ql4pkXpr+vq4iilwJmiJOqTBam0LmQE7ulYCCYU8Z6MkpiSl+dO7QSramcGyxauQRI3a7gcq dpo8Vrv3gFTQDeMYxk7cqZp08pIVH5XR0+LgBz4X84f59rA/VAKlC/r6CyEQk59rvDLxCMyP 2buoj51Z25N3MVghRDGcsU6mT7e5AQ0ETspYWQEIANGc4zQULOxhbqO2dyD51YhqCNRmm9oK Waqf+wmW4tpDe/VVcxAnNizd4LWCHfzpb5cHAtGkOPePMfzWVf6nvdF7d3eglbtf59+zG7O7 llV0xSSoFiieQBsrGvqDInXYX/4mRRXMtyhM353/tixC9RWLs1oofyYmCPPXXY7h9R7en3B8 BoVrRFcdzlIY/NFNhFGW/9dkEiGjgna2Rk6e15kln4ZvFBWUg23p93w/pqXcxY6+k/8TEk+C 4R+M6w7o2PLGOjdZ+kPiUcw5H85zf/yZJwQXzisXaNduwWB6Vads9YC9dj6kPR1c4VGRqAaY L++LAEOqrlvm2TvqQqZRtnEAEQEAAYkBJQQYAQIADwIbDAUCXdaUtAUJEs6jVQAKCRCZ+n/L Wfw7gQi5B/9sHbmRloZNCWWwZGm+O9iG/JGQxS0WWa4GaZqzqSTWOft2/gO0Bgag89r1djq4 PFgSZtzHvKQpqYz/7HkPrWh1jpcS83i/uYY1uyHXUUtpdEmn4buNObEtD0YNaJkGdhASsECq 6akw+u7WJYmAHs/SpR6ok6HqLw7JHDVc2h5dViLfTk0qrgDa7sq/LVMoJje5Ct/Ku3YaWAV6 YSmzoPP5BmPVFqP11OMQkCqurIu9vTLXKFWX623vCmqRDHJ6e5GCDHbH8USU+4wJBfPymZkd cA7NGm/mmWeJiWBFIDyjzYxrjku8ty9TZJVsaRXnS+OFQzXz9Eu2wTpKdHij46uY Message-ID: Date: Mon, 3 Aug 2020 12:46:24 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.9.0 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/mixed; boundary="------------C29A190231AE8074F549FB7F" Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk This is a multi-part message in MIME format. --------------C29A190231AE8074F549FB7F Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit On 7/31/20 4:44 PM, Andrew Dunstan wrote: > On 7/15/20 6:18 PM, Daniel Gustafsson wrote: >>> On 15 Jul 2020, at 20:35, Andrew Dunstan wrote: >>> >>> On 5/15/20 4:46 PM, Daniel Gustafsson wrote: >>>> My plan is to keep hacking at this to have it reviewable for the 14 cycle, so >>>> if anyone has an interest in NSS, then I would love to hear feedback on how it >>>> works (and doesn't work). >>> I'll be happy to help, particularly with Windows support and with some >>> of the callback stuff I've had a hand in. >> That would be fantastic, thanks! The password callback handling is still a >> TODO so feel free to take a stab at that since you have a lot of context on >> there. >> >> For Windows, I've include USE_NSS in Solution.pm as Thomas pointed out in this >> thread, but that was done blind as I've done no testing on Windows yet. >> > > OK, here is an update of your patch that compiles and runs against NSS > under Windows (VS2019). > > > In addition to some work that was missing in src/tools/msvc, I had to > make a few adjustments, including: > > > * strtok_r() isn't available on Windows. We don't use it elsewhere in > the postgres code, and it seemed unnecessary to have reentrant calls > here, so I just replaced it with equivalent strtok() calls. > * We were missing an NSS implementation of > pgtls_verify_peer_name_matches_certificate_guts(). I supplied a > dummy that's enough to get it building cleanly, but that needs to be > filled in properly. > > > There is still plenty of work to go, but this seemed a sufficient > milestone to report progress on. > > OK, this version contains pre-generated nss files, and passes a full buildfarm run including the ssl test module, with both openssl and NSS. That should keep the cfbot happy :-) cheers andrew -- Andrew Dunstan https://www.2ndQuadrant.com PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services --------------C29A190231AE8074F549FB7F Content-Type: text/x-patch; charset=UTF-8; name="0001-WIP-Support-libnss-for-as-TLS-backend-v7.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="0001-WIP-Support-libnss-for-as-TLS-backend-v7.patch"