Skip to content

Commit b2bb77c

Browse files
committed
Move common things for key files into a separate header file
Instead of having the WAL key code include the headers for the SMGR keys we move the shared code into a separate header file. Additionally we clean up some minor header issues.
1 parent cff0bf5 commit b2bb77c

File tree

5 files changed

+23
-18
lines changed

5 files changed

+23
-18
lines changed

contrib/pg_tde/src/access/pg_tde_tdemap.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#include "access/pg_tde_xlog.h"
1818
#include "catalog/tde_global_space.h"
1919
#include "catalog/tde_principal_key.h"
20+
#include "common/pg_tde_utils.h"
2021
#include "encryption/enc_aes.h"
2122
#include "encryption/enc_tde.h"
2223
#include "keyring/keyring_api.h"

contrib/pg_tde/src/access/pg_tde_xlog_keys.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@
99
#include "storage/fd.h"
1010
#include "utils/memutils.h"
1111

12-
#include "access/pg_tde_tdemap.h"
1312
#include "access/pg_tde_xlog_keys.h"
1413
#include "access/pg_tde_xlog.h"
1514
#include "catalog/tde_global_space.h"
1615
#include "catalog/tde_principal_key.h"
16+
#include "common/pg_tde_utils.h"
1717
#include "encryption/enc_aes.h"
1818
#include "encryption/enc_tde.h"
1919

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#ifndef PG_TDE_KEYS_COMMON_H
2+
#define PG_TDE_KEYS_COMMON_H
3+
4+
#include "catalog/tde_principal_key.h"
5+
6+
#define INTERNAL_KEY_LEN 16
7+
#define INTERNAL_KEY_IV_LEN 16
8+
9+
#define MAP_ENTRY_IV_SIZE 16
10+
#define MAP_ENTRY_AEAD_TAG_SIZE 16
11+
12+
typedef struct
13+
{
14+
TDEPrincipalKeyInfo data;
15+
unsigned char sign_iv[MAP_ENTRY_IV_SIZE];
16+
unsigned char aead_tag[MAP_ENTRY_AEAD_TAG_SIZE];
17+
} TDESignedPrincipalKeyInfo;
18+
19+
#endif /* PG_TDE_KEYS_COMMON_H */

contrib/pg_tde/src/include/access/pg_tde_tdemap.h

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,16 @@
11
#ifndef PG_TDE_MAP_H
22
#define PG_TDE_MAP_H
33

4-
#include "access/xlog_internal.h"
54
#include "storage/relfilelocator.h"
6-
#include "catalog/tde_principal_key.h"
7-
#include "common/pg_tde_utils.h"
85

9-
#define INTERNAL_KEY_LEN 16
10-
#define INTERNAL_KEY_IV_LEN 16
6+
#include "access/pg_tde_keys_common.h"
117

128
typedef struct InternalKey
139
{
1410
uint8 key[INTERNAL_KEY_LEN];
1511
uint8 base_iv[INTERNAL_KEY_IV_LEN];
1612
} InternalKey;
1713

18-
#define MAP_ENTRY_IV_SIZE 16
19-
#define MAP_ENTRY_AEAD_TAG_SIZE 16
20-
21-
typedef struct
22-
{
23-
TDEPrincipalKeyInfo data;
24-
unsigned char sign_iv[MAP_ENTRY_IV_SIZE];
25-
unsigned char aead_tag[MAP_ENTRY_AEAD_TAG_SIZE];
26-
} TDESignedPrincipalKeyInfo;
27-
2814
extern void pg_tde_save_smgr_key(RelFileLocator rel, const InternalKey *key);
2915
extern bool pg_tde_has_smgr_key(RelFileLocator rel);
3016
extern InternalKey *pg_tde_get_smgr_key(RelFileLocator rel);

contrib/pg_tde/src/include/access/pg_tde_xlog_keys.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33

44
#include "access/xlog_internal.h"
55

6-
#include "access/pg_tde_tdemap.h"
7-
#include "catalog/tde_principal_key.h"
6+
#include "access/pg_tde_keys_common.h"
87

98
typedef enum
109
{

0 commit comments

Comments
 (0)