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.
pull/238/head
Andreas Karlsson 1 month ago committed by Andreas Karlsson
parent cff0bf5ad3
commit b2bb77c0ef
  1. 1
      contrib/pg_tde/src/access/pg_tde_tdemap.c
  2. 2
      contrib/pg_tde/src/access/pg_tde_xlog_keys.c
  3. 19
      contrib/pg_tde/src/include/access/pg_tde_keys_common.h
  4. 16
      contrib/pg_tde/src/include/access/pg_tde_tdemap.h
  5. 3
      contrib/pg_tde/src/include/access/pg_tde_xlog_keys.h

@ -17,6 +17,7 @@
#include "access/pg_tde_xlog.h"
#include "catalog/tde_global_space.h"
#include "catalog/tde_principal_key.h"
#include "common/pg_tde_utils.h"
#include "encryption/enc_aes.h"
#include "encryption/enc_tde.h"
#include "keyring/keyring_api.h"

@ -9,11 +9,11 @@
#include "storage/fd.h"
#include "utils/memutils.h"
#include "access/pg_tde_tdemap.h"
#include "access/pg_tde_xlog_keys.h"
#include "access/pg_tde_xlog.h"
#include "catalog/tde_global_space.h"
#include "catalog/tde_principal_key.h"
#include "common/pg_tde_utils.h"
#include "encryption/enc_aes.h"
#include "encryption/enc_tde.h"

@ -0,0 +1,19 @@
#ifndef PG_TDE_KEYS_COMMON_H
#define PG_TDE_KEYS_COMMON_H
#include "catalog/tde_principal_key.h"
#define INTERNAL_KEY_LEN 16
#define INTERNAL_KEY_IV_LEN 16
#define MAP_ENTRY_IV_SIZE 16
#define MAP_ENTRY_AEAD_TAG_SIZE 16
typedef struct
{
TDEPrincipalKeyInfo data;
unsigned char sign_iv[MAP_ENTRY_IV_SIZE];
unsigned char aead_tag[MAP_ENTRY_AEAD_TAG_SIZE];
} TDESignedPrincipalKeyInfo;
#endif /* PG_TDE_KEYS_COMMON_H */

@ -1,13 +1,9 @@
#ifndef PG_TDE_MAP_H
#define PG_TDE_MAP_H
#include "access/xlog_internal.h"
#include "storage/relfilelocator.h"
#include "catalog/tde_principal_key.h"
#include "common/pg_tde_utils.h"
#define INTERNAL_KEY_LEN 16
#define INTERNAL_KEY_IV_LEN 16
#include "access/pg_tde_keys_common.h"
typedef struct InternalKey
{
@ -15,16 +11,6 @@ typedef struct InternalKey
uint8 base_iv[INTERNAL_KEY_IV_LEN];
} InternalKey;
#define MAP_ENTRY_IV_SIZE 16
#define MAP_ENTRY_AEAD_TAG_SIZE 16
typedef struct
{
TDEPrincipalKeyInfo data;
unsigned char sign_iv[MAP_ENTRY_IV_SIZE];
unsigned char aead_tag[MAP_ENTRY_AEAD_TAG_SIZE];
} TDESignedPrincipalKeyInfo;
extern void pg_tde_save_smgr_key(RelFileLocator rel, const InternalKey *key);
extern bool pg_tde_has_smgr_key(RelFileLocator rel);
extern InternalKey *pg_tde_get_smgr_key(RelFileLocator rel);

@ -3,8 +3,7 @@
#include "access/xlog_internal.h"
#include "access/pg_tde_tdemap.h"
#include "catalog/tde_principal_key.h"
#include "access/pg_tde_keys_common.h"
typedef enum
{

Loading…
Cancel
Save