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 1kpDgL-0001kf-UI for pgsql-hackers@arkaria.postgresql.org; Tue, 15 Dec 2020 17:00:13 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kpDgK-0004jR-S2 for pgsql-hackers@arkaria.postgresql.org; Tue, 15 Dec 2020 17:00:12 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kpDgK-0004jH-LY for pgsql-hackers@lists.postgresql.org; Tue, 15 Dec 2020 17:00:12 +0000 Received: from momjian.us ([72.94.173.45]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kpDgI-00050Z-12 for pgsql-hackers@postgresql.org; Tue, 15 Dec 2020 17:00:12 +0000 Received: from bruce by momjian.us with local (Exim 4.92) (envelope-from ) id 1kpDgG-0001yC-AO; Tue, 15 Dec 2020 12:00:08 -0500 Date: Tue, 15 Dec 2020 12:00:08 -0500 From: Bruce Momjian To: Neil Chen Cc: PostgreSQL-development , Masahiko Sawada Subject: Re: Proposed patch for key managment Message-ID: <20201215170008.GF14596@momjian.us> References: <20201202213814.GG20285@momjian.us> <20201214230615.GA14596@momjian.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Tue, Dec 15, 2020 at 10:36:56AM +0800, Neil Chen wrote: > 2. I tried to add support for AES_CTR mode, and the code for encrypting buffer > blocks. In the process I found that in pg_cipher_ctx_create, the key length is > declared as "byte". However, in the CryptoKey structure, the length is stored > as "bit", which leads me to use a form similar to Key->klen / 8 when I call > this function. Maybe we should unify the two to avoid unnecessary confusion. Yes, I would also like to get opinions on this. We certainly have to have the key length be in _bit_ units when visible by users, but I see a lot of cases where we allocate arrays based on bytes. I am unclear where the proper units should be. At a minimum, we should specify the units in the function parameter names. -- Bruce Momjian https://momjian.us EnterpriseDB https://enterprisedb.com The usefulness of a cup is in its emptiness, Bruce Lee