Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eTzZd-0006um-Gs for pgsql-hackers@arkaria.postgresql.org; Wed, 27 Dec 2017 00:27:57 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eTzZb-0000Ke-TX for pgsql-hackers@arkaria.postgresql.org; Wed, 27 Dec 2017 00:27:55 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1eTzZb-0000KU-GT for pgsql-hackers@lists.postgresql.org; Wed, 27 Dec 2017 00:27:55 +0000 Received: from mail-pl0-x244.google.com ([2607:f8b0:400e:c01::244]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1eTzZZ-0002Ug-4o for pgsql-hackers@postgresql.org; Wed, 27 Dec 2017 00:27:54 +0000 Received: by mail-pl0-x244.google.com with SMTP id o2so18594697plk.12 for ; Tue, 26 Dec 2017 16:27:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=YC2nT+I/pns/9j/gKWRrLvsPw1XrZkbbHLJe9g0T0ss=; b=gBbvGAceOCbyTWL07EwNPXEd1B0Ymf0SxGmmeGFJ+A5ubt/vMvH21vP26q5lMHk5Eo RC5SkkmTeBvilz96zwcfhq4l/rfCgVPg0BBVw6x/tVFw7EJu4bevq2oo0Cgw2JUFEUWL +eSxAnWAgcMzxndnGmNhjvNSL+vnjLySTBl5mX/9Q5IdKgkqKTHhaGdH1wyWpA/vmnEr rUX8qGzOrDHxNIEfsgbj1ocLDsA02Ofcp5DOt9QUWalUJuJptlrlwso6dNMdbzjTq8e6 usFQ1/k6QT0AYC6RSq7ZcVnVB0CJoHMF48t8fhdyDVSK10G+UdjnncaBaGYXYE7RbCBY floA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=YC2nT+I/pns/9j/gKWRrLvsPw1XrZkbbHLJe9g0T0ss=; b=dPav70K43bG/MV+uavP/yzhW6sb2wbd2FiWKZdISSghbEqX6aDW1j2wSPlEObgoklW WTPF41q0ornC7vWXje5LtuYiQmP4VuTEUMiuLus0aUdTyWzSPnZ4C5KuGuAb9NPitWaS mUHsMoe0g185pkO5m0ro+ZXfp3xVMjQ56QVKJ0CUFqnQfTFHm42sf08Hb8vtovn/gAqx xoETm1LwZa+52I3vL/9mLpjEc4qdzutpFludnCe40xICJgy/6Y84au0s493JznkpY2/Q LUrlx0i22Pl/udS3oL7dWyTbjI1megD+Va/7LokpVQ2N9XDmUEHrGnHXLmXVU1kAMzNx QqTQ== X-Gm-Message-State: AKGB3mI7Pqllg4QVMt2UDQOtqMAY5oelKavQCuCHKquiyOsIlolz8AOs dLoqvJsEY1dmlWcqDoE2Q0A= X-Google-Smtp-Source: ACJfBoskqlhZ2T7lt7Ma/aRd+Lo4c/JXrXUmK4g2OOMK07uiKcAJwB/m2rwB+6HNpegrGHNzxP9U7w== X-Received: by 10.84.164.104 with SMTP id m37mr26524878plg.29.1514334471580; Tue, 26 Dec 2017 16:27:51 -0800 (PST) Received: from paquier.xyz (c137162.net61215.cablenet.ne.jp. [61.215.137.162]) by smtp.gmail.com with ESMTPSA id f80sm29000460pfk.142.2017.12.26.16.27.47 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 26 Dec 2017 16:27:49 -0800 (PST) Date: Wed, 27 Dec 2017 09:27:40 +0900 From: Michael Paquier To: Peter Eisentraut Cc: Robert Haas , =?iso-8859-1?Q?=C1lvaro_Hern=E1ndez?= Tortosa , "pgsql-hackers@postgresql.org" Subject: Re: [JDBC] [HACKERS] Channel binding support for SCRAM-SHA-256 Message-ID: <20171227002740.GA1727@paquier.xyz> References: <6de87398-a9da-aa8b-a4c2-ca06ef8d757c@2ndquadrant.com> <0eeb65bc-7f7d-064f-bbe2-5814c9763873@2ndquadrant.com> <20171222025908.GA11776@paquier.xyz> <63b10730-d6d6-fe96-c86b-b2ef4d320be7@2ndquadrant.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="ibTvN161/egqYuK8" Content-Disposition: inline In-Reply-To: <63b10730-d6d6-fe96-c86b-b2ef4d320be7@2ndquadrant.com> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --ibTvN161/egqYuK8 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Dec 26, 2017 at 03:28:09PM -0500, Peter Eisentraut wrote: > On 12/22/17 03:10, Michael Paquier wrote: > > Second thoughts on 0002 as there is actually no need to move around > > errorMessage if the PGconn* pointer is saved in the SCRAM status data > > as both are linked. The attached simplifies the logic even more. > >=20 >=20 > That all looks pretty reasonable. Thanks for the review. Don't you think that the the refactoring simplifications should be done first though? This would result in producing the patch set in reverse order. I'll be fine to produce them if need be. > I'm working through patch 0001 now. I haven't found any documentation > on the function OBJ_find_sigid_algs(). What does it do? One might > think that the nid returned by X509_get_signature_nid() is already the > algo_nid we want to use, but there appears to be more to this. All the objects returned by X509_get_signature_nid() are listed in crypto/objects/obj_dat.h which may include more information than just the algorithm type, like for example if RSA encryption is used or not, etc. I found about the low-level OBJ_find_sigid_algs() to actually get the real hashing algorithm after diving into X509* informations. And by looking at X509_signature_print() I found out that this returns the information we are looking for. This has the damn advantage that we rely on a minimal lists of algorithms and we don't need to worry about any future options linked with X509_get_signature_nid(), so this simplifies Postgres code as well as long-term maintenance. -- Michael --ibTvN161/egqYuK8 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAlpC6PwACgkQnvQgOdby QH3Z7xAAoTZ7dsyVkgUsuREhaN0BEX5UfYVT5kLY+7NWL5tKPBa1qQBn0VbWY8tA H4NGD7sW06V1h4nJ4PRkPgP/NQyzovhr828AYc6XvSTxu1ICz6sKdGkq9BH7MU8G WS6mI5xW7NwFWaOkwZAh+vpHadj6oOnt1uM/nHH7ea2R/aIbJW95xgCqa63bMgQE vaWl5nC2SbJnMGTodOt7AzsmYtiA8KtJ1kOQs0XRllhio1awtAI/xqxWgQYVjEeD IUdcWWbZllJRN3roPSgKs16W4CptmFgqLUVO9Z4gfi82vzwlgkNPD3Fn4CUHOVT+ sFSASeoNxZ4Yl9bA4oEW1BheoS5pcUzbA+qcN6jQ0DZe789VnC0MiRURIJnEmpvj 22qG8iGWhab0l8tOBCiKGHJoS3VlnMHjI2ECWG2J8l/8IrmlLWGSZDuc+ZasrCkJ e0hOB1LS3EOGkVTA6JmQ2qiyMjSSbgMHYCrKYJwwy6kt9aRGD4pL0OVrGz/KXPVf ng2gTY1iSsrr3q7VaEb5hNE+nc/oTMmsXFVJ0jJcE2ihGzVgdrncWUZewdSdGHbr Zwi2NfIhEk4oTKrENmQgrUcgBvWAnUtr6LoJqSWMKJ63MNh9mvGzto4w2zV/vgLi rDAnzQEnruJ9XdkeVjIGZszKQ5REm8zxqnTMh62dhvywd/nAkIE= =yS63 -----END PGP SIGNATURE----- --ibTvN161/egqYuK8--