On Wed, Jul 31, 2019 at 04:11:03PM +0900, Masahiko Sawada wrote: > On Wed, Jul 31, 2019 at 5:48 AM Bruce Momjian <br...@momjian.us> wrote: > > I am thinking for the heap/index IV, it would be: > > > > uint64 lsn; > > unint32 page number; > > /* only uses 11 bits for a zero-based CTR counter for 32k pages */ > > uint32 counter; > > > > +1 > IIUC since this would require to ensure uniqueness by using key+IV we > need to use different keys for different relations. Is that right?
No. My other email states that the LSN is only used for a single relation, so there is no need for the relfilenode in the nonce. A single LSN writing to multiple parts of the relation generates a unique nonce since the page number is also part of the nonce. > > and for WAL it would be: > > > > uint64 segment_number; > > uint32 counter; > > /* guarantees this IV doesn't match any relation IV */ > > uint32 2^32-1 /* all 1's */ > > I would propose to include the page number within a WAL segment to IV > so that we can encrypt each WAL page with the counter always starting > from 0. And if we use different encryption keys for tables/indexes and What is the value of that? > And if we use different encryption keys for tables/indexes and > WAL I think we don't need 2^32-1. I see little value to using different encryption keys for tables/indexes and WAL. -- Bruce Momjian <br...@momjian.us> http://momjian.us EnterpriseDB http://enterprisedb.com + As you are, so once was I. As I am, so you will be. + + Ancient Roman grave inscription +