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 1gdeFo-0003gV-Df for pgsql-hackers@arkaria.postgresql.org; Sun, 30 Dec 2018 16:47:56 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gdeFk-0004GT-Ua for pgsql-hackers@arkaria.postgresql.org; Sun, 30 Dec 2018 16:47:52 +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 1gdeFk-0004GM-NB for pgsql-hackers@lists.postgresql.org; Sun, 30 Dec 2018 16:47:52 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gdeFg-0001kT-PP for pgsql-hackers@lists.postgresql.org; Sun, 30 Dec 2018 16:47:51 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id wBUGl3Ca020187; Sun, 30 Dec 2018 11:47:03 -0500 From: Tom Lane To: Michael Paquier cc: Postgres hackers , Heikki Linnakangas Subject: Re: Removing --disable-strong-random from the code In-reply-to: <20181230143740.GB2734@paquier.xyz> References: <20181230063219.GG608@paquier.xyz> <23371.1546152342@sss.pgh.pa.us> <20181230071549.GA2734@paquier.xyz> <20181230143740.GB2734@paquier.xyz> Comments: In-reply-to Michael Paquier message dated "Sun, 30 Dec 2018 23:37:40 +0900" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <20185.1546188423.1@sss.pgh.pa.us> Date: Sun, 30 Dec 2018 11:47:03 -0500 Message-ID: <20186.1546188423@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Michael Paquier writes: > And attached is an updated patch with all those fixes included. Any > thoughts or opinions? contrib/pgcrypto has some variant expected-files for the no-strong-random case that could be removed now. BackendRandomLock should be removed, too. Since pg_strong_random is declared to take "void *", the places that cast arguments to "char *" could be simplified. (I guess that's a hangover from the rather random decision to make pg_backend_random take char *?) The wording for pgcrypto's PXE_NO_RANDOM error, {PXE_NO_RANDOM, "No strong random source"}, perhaps needs to be changed --- maybe "Failed to generate strong random bits"? Not the fault of this patch, but surely this bit in pgcrypto's pad_eme_pkcs1_v15() if (!pg_strong_random((char *) p, 1)) { px_memset(buf, 0, res_len); px_free(buf); break; } is insane, because the "break" makes it fall into code that will continue to scribble on "buf". I think the "break" needs to be "return PXE_NO_RANDOM", and probably we'd better back-patch that as a bug fix. (I'm also failing to see the point of that px_memset before freeing the buffer --- at this point, it contains no sensitive data, surely.) LGTM otherwise. regards, tom lane