Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iDMHw-0004JA-AB for pgsql-hackers@arkaria.postgresql.org; Thu, 26 Sep 2019 05:26:00 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iDMHu-0000fJ-RT for pgsql-hackers@arkaria.postgresql.org; Thu, 26 Sep 2019 05:25:58 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iDMHu-0000fC-J9 for pgsql-hackers@lists.postgresql.org; Thu, 26 Sep 2019 05:25:58 +0000 Received: from out4-smtp.messagingengine.com ([66.111.4.28]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iDMHs-0004oy-AU for pgsql-hackers@lists.postgresql.org; Thu, 26 Sep 2019 05:25:58 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 195AB21368; Thu, 26 Sep 2019 01:25:55 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Thu, 26 Sep 2019 01:25:55 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paquier.xyz; h= date:from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; s=fm2; bh=SbjD1ivbHLRUL+yPEgWUWrbBnmk rwSWHS7GNuDLFzZc=; b=Me3lX3HjCeXrSSURXhg6EcL4Seaxt9RpiubNWFTeVHQ iL9EfwsLA64aCIdkhBJT8BnxE+tKkFKBgvNljwwKDCQ/jFgLO2OGLzuNmHgmRUCf PGLiWr/U5a5g8K5Lye0xCZ6/aXyVGERutXRakM3LaiFt9I4Z0AXK8UjdylpGHMyp /O+16/IWfOYlVTw525LLG4kJ15RIaJU7YVgHYhuclTnMyEhp4yXIWJiacBgE1BJQ qI/IMs+E3te6RIs+mIF5YvHId7l8pC7OzDyWe6nloni0u42upeLOZAlkAjQUJm4L /p+ZymtbGLzGgPN7ZQDC9BqgL6vpJtyj2LE6I2lfmkw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=SbjD1i vbHLRUL+yPEgWUWrbBnmkrwSWHS7GNuDLFzZc=; b=h2yypUbtHTIRQQeNsiv0b9 kj91kl2XuhHjYB2sS7AznSRuHpJx1wddM7YQMFg8j/Hyggl82sYizCTyTv9eKjvl M92suVp2K+HsrsTfW3i8slRNmrUMKSWERIQ+yI6yjSrf2+jJoERMKLNCsUkKicJG 57XSb7XtxEXMLq47fweJetsI4zpNOLfimAfeinUSYWspK7xorKizTdhcLmxLuXh7 iHJljL+97YYIVelWfOvfHK4E9ZVSUMlxO+/ZL3mnQMmMiqOkiRJwN+EVWRdJAtCz ZvfsyriyW7Y6ucFCYN+XEsL8OlVYQ0zlsZkCoiQpwvmMyToOa1todzTRjV+D1dbA == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedufedrfeefgdelhecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecufghrlhcuvffnffculdefhedmnecujfgurhepfffhvf fukfhfgggtuggjsehgtderredttddvnecuhfhrohhmpefoihgthhgrvghlucfrrghquhhi vghruceomhhitghhrggvlhesphgrqhhuihgvrhdrgiihiieqnecukfhppeduuddurddutd dvrddukedtrddukeehnecurfgrrhgrmhepmhgrihhlfhhrohhmpehmihgthhgrvghlsehp rghquhhivghrrdighiiinecuvehluhhsthgvrhfuihiivgeptd X-ME-Proxy: Received: from paquier.xyz (ee0822lan1.rev.em-net.ne.jp [111.102.180.185]) by mail.messagingengine.com (Postfix) with ESMTPA id 33B4C8005C; Thu, 26 Sep 2019 01:25:51 -0400 (EDT) Date: Thu, 26 Sep 2019 14:25:48 +0900 From: Michael Paquier To: Tom Lane Cc: Victor Wagner , pgsql-hackers@lists.postgresql.org Subject: Re: PostgreSQL12 and older versions of OpenSSL Message-ID: <20190926052548.GD2115@paquier.xyz> References: <20190924101859.09383b4f@fafnir.local.vm> <20190924094917.GB1982@paquier.xyz> <20190924130731.2270332e@fafnir.local.vm> <22006.1569343397@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="0H629O+sVkh21xTi" Content-Disposition: inline In-Reply-To: <22006.1569343397@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --0H629O+sVkh21xTi Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Tue, Sep 24, 2019 at 12:43:17PM -0400, Tom Lane wrote: > One thing I'm wondering is if it's safe to assume that TLS_MAX_VERSION > will be defined whenever these other symbols are. Looking in an > 0.9.8x install tree, that doesn't seem to define any of them; while > in 1.0.1e I see Yeah, I could personally live with the argument of simplicity and just say that trying to compile v12 with any version older than 0.9.8zc or any version that does not have those symbols just does not work, and that one needs to use the top of the released versions. > ./tls1.h:#define TLS1_1_VERSION 0x0302 > ./tls1.h:#define TLS1_2_VERSION 0x0303 > ./tls1.h:#define TLS_MAX_VERSION TLS1_2_VERSION > > So the patch seems okay for these two versions, but I have no data about > intermediate OpenSSL versions. More precisely, all those fields have been added by this upstream commit, so the fields are present since 0.9.8zc: commit: c6a876473cbff0fd323c8abcaace98ee2d21863d author: Bodo Moeller date: Wed, 15 Oct 2014 04:18:29 +0200 Support TLS_FALLBACK_SCSV. > BTW, the spacing in this patch seems rather random. Indeed. Now that I think about it, another method would be to rely on the fact that a given version of OpenSSL does not support TLS 1.1 and 1.2. So we could also just add checks based on OPENSSL_VERSION_NUMBER and be done with it. And actually, looking at their tree TLS 1.1 and 2.2 are not supported in 1.0.0 either. 1.0.1, 1.0.2, 1.1.0 and HEAD do support them, but not TLS 1.3. I would still prefer relying on TLS_MAX_VERSION though, as that's more portable for future decisions, like the introduction of TLS1_3_VERSION for which we have already some logic in be-secure-openssl.c. And updating this stuff would very likely get forgotten once OpenSSL adds support for TLS 1.3... There is another issue in the patch: -#ifdef TLS1_3_VERSION +#if defined(TLS1_3_VERSION) && TLS1_2_VERSION <= TLS_MAX_VERSION The second part of the if needs to use TLS1_3_VERSION. I would also add more brackets around the extra conditions for readability. -- Michael --0H629O+sVkh21xTi Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAl2MS9wACgkQnvQgOdby QH1J6g/+OZ0aME5WqD2jI0Nyu3MsJUT8Xg3vfOAAbqXjh00xP318ZSmyvJezK54i 4q+orpAF1n6n0xPVBFWlgjJrqcJmK7lU6WZTzuHm/rqWT6CMPc0l3hz2Q4v608PB niN3rBdkdvBURA9AwQcfBV9Vb2lyQ4MLNb08ZTp3WZw5DRM62OEYarBTcRHWT2aX Xy9uknDFK9KYo2YRbAOmg6u8QHHHty4g5cCQAmLnwaZXPWJ4CWSF4n3FXIzPrdQS /9+Ok72ZfwDs29VGNyWNg2Q3CSa0M7CJ0vAOt4+YWwWVnCqfVK0/o+pkSmmW9AhP NXlNxeUubDzm2v9Eh+BsI7k1g7HcWNbQSo/GbgT1Ej/x+pC7+SLYoVb86JzMFoRx 9dLV9RMi2owHSRJcFTk6LZ8x3CjXsLwg6kP3LYYj4g44tyy5I3pE7Ue/hvpYbuE4 A07r/L+FVMouREmiNi85wJsKHqCkEKOHd7d/Zo232+FQV3uLd3T7Y9De3UUdGqVe O43Iz5w56I6XUzvcWSlIkw3EYgdLzbrubtjf+2h4wwxYMA45kj4HHptkCrl9Wl2m 8sugl7wJjeSw3eRcwRN47xgKYmzEgI5ZToi7d140BJmchMORXWU1i/BuSko8P6bm gRwFVPJH/Y/N5ML5AKYsmsvSVIzx2+SCd0vTzmbM5euinlcwB4Y= =qe1+ -----END PGP SIGNATURE----- --0H629O+sVkh21xTi--