@@ -45,26 +45,6 @@ typedef struct TDESMgrRelation
45
45
46
46
static void CalcBlockIv (ForkNumber forknum , BlockNumber bn , const unsigned char * base_iv , unsigned char * iv );
47
47
48
- static bool
49
- tde_smgr_is_encrypted (const RelFileLocatorBackend * smgr_rlocator )
50
- {
51
- /* Do not try to encrypt/decrypt catalog tables */
52
- if (IsCatalogRelationOid (smgr_rlocator -> locator .relNumber ))
53
- return false;
54
-
55
- return IsSMGRRelationEncrypted (* smgr_rlocator );
56
- }
57
-
58
- static InternalKey *
59
- tde_smgr_get_key (const RelFileLocatorBackend * smgr_rlocator )
60
- {
61
- /* Do not try to encrypt/decrypt catalog tables */
62
- if (IsCatalogRelationOid (smgr_rlocator -> locator .relNumber ))
63
- return NULL ;
64
-
65
- return GetSMGRRelationKey (* smgr_rlocator );
66
- }
67
-
68
48
static bool
69
49
tde_smgr_should_encrypt (const RelFileLocatorBackend * smgr_rlocator , RelFileLocator * old_locator )
70
50
{
@@ -110,7 +90,7 @@ tde_mdwritev(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum,
110
90
111
91
if (tdereln -> encryption_status == RELATION_KEY_NOT_AVAILABLE )
112
92
{
113
- InternalKey * int_key = tde_smgr_get_key ( & reln -> smgr_rlocator );
93
+ InternalKey * int_key = GetSMGRRelationKey ( reln -> smgr_rlocator );
114
94
115
95
tdereln -> relKey = * int_key ;
116
96
tdereln -> encryption_status = RELATION_KEY_AVAILABLE ;
@@ -181,7 +161,7 @@ tde_mdextend(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum,
181
161
182
162
if (tdereln -> encryption_status == RELATION_KEY_NOT_AVAILABLE )
183
163
{
184
- InternalKey * int_key = tde_smgr_get_key ( & reln -> smgr_rlocator );
164
+ InternalKey * int_key = GetSMGRRelationKey ( reln -> smgr_rlocator );
185
165
186
166
tdereln -> relKey = * int_key ;
187
167
tdereln -> encryption_status = RELATION_KEY_AVAILABLE ;
@@ -210,7 +190,7 @@ tde_mdreadv(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum,
210
190
return ;
211
191
else if (tdereln -> encryption_status == RELATION_KEY_NOT_AVAILABLE )
212
192
{
213
- InternalKey * int_key = tde_smgr_get_key ( & reln -> smgr_rlocator );
193
+ InternalKey * int_key = GetSMGRRelationKey ( reln -> smgr_rlocator );
214
194
215
195
tdereln -> relKey = * int_key ;
216
196
tdereln -> encryption_status = RELATION_KEY_AVAILABLE ;
@@ -279,7 +259,7 @@ tde_mdcreate(RelFileLocator relold, SMgrRelation reln, ForkNumber forknum, bool
279
259
* Since event triggers do not fire on the standby or in recovery we
280
260
* do not try to generate any new keys and instead trust the xlog.
281
261
*/
282
- InternalKey * key = tde_smgr_get_key ( & reln -> smgr_rlocator );
262
+ InternalKey * key = GetSMGRRelationKey ( reln -> smgr_rlocator );
283
263
284
264
if (!isRedo && !key && tde_smgr_should_encrypt (& reln -> smgr_rlocator , & relold ))
285
265
key = pg_tde_create_smgr_key (& reln -> smgr_rlocator );
@@ -311,7 +291,7 @@ tde_mdopen(SMgrRelation reln)
311
291
312
292
mdopen (reln );
313
293
314
- if (tde_smgr_is_encrypted ( & reln -> smgr_rlocator ))
294
+ if (IsSMGRRelationEncrypted ( reln -> smgr_rlocator ))
315
295
{
316
296
tdereln -> encryption_status = RELATION_KEY_NOT_AVAILABLE ;
317
297
}
0 commit comments