Commit e35b2bad authored by Bruce Momjian's avatar Bruce Momjian

remove uint128 requirement from patch 978f869b (CFE)

Used char[16] instead.

Reported-by: buildfarm member florican

Backpatch-through: master
parent 945083b2
...@@ -81,7 +81,7 @@ kmgr_wrap_key(PgCipherCtx *ctx, CryptoKey *in, CryptoKey *out) ...@@ -81,7 +81,7 @@ kmgr_wrap_key(PgCipherCtx *ctx, CryptoKey *in, CryptoKey *out)
&enclen, /* Resulting length, must match input for us */ &enclen, /* Resulting length, must match input for us */
iv, /* Generated IV from above */ iv, /* Generated IV from above */
sizeof(iv), /* Length of the IV */ sizeof(iv), /* Length of the IV */
(unsigned char *) &out->tag, /* Resulting tag */ out->tag, /* Resulting tag */
sizeof(out->tag))) /* Length of our tag */ sizeof(out->tag))) /* Length of our tag */
return false; return false;
...@@ -106,7 +106,7 @@ kmgr_unwrap_key(PgCipherCtx *ctx, CryptoKey *in, CryptoKey *out) ...@@ -106,7 +106,7 @@ kmgr_unwrap_key(PgCipherCtx *ctx, CryptoKey *in, CryptoKey *out)
out->pgkey_id = in->pgkey_id; out->pgkey_id = in->pgkey_id;
out->counter = in->counter; out->counter = in->counter;
out->tag = in->tag; memcpy(out->tag, in->tag, sizeof(in->tag));
/* Construct the IV we are going to use, see kmgr_utils.h */ /* Construct the IV we are going to use, see kmgr_utils.h */
memcpy(iv, &out->pgkey_id, sizeof(out->pgkey_id)); memcpy(iv, &out->pgkey_id, sizeof(out->pgkey_id));
...@@ -120,7 +120,7 @@ kmgr_unwrap_key(PgCipherCtx *ctx, CryptoKey *in, CryptoKey *out) ...@@ -120,7 +120,7 @@ kmgr_unwrap_key(PgCipherCtx *ctx, CryptoKey *in, CryptoKey *out)
&declen, /* Length of plaintext */ &declen, /* Length of plaintext */
iv, /* IV we constructed above */ iv, /* IV we constructed above */
sizeof(iv), /* Size of our IV */ sizeof(iv), /* Size of our IV */
(unsigned char *) &in->tag, /* Tag which will be verified */ in->tag, /* Tag which will be verified */
sizeof(in->tag))) /* Size of our tag */ sizeof(in->tag))) /* Size of our tag */
return false; return false;
......
...@@ -82,7 +82,7 @@ typedef struct CryptoKey ...@@ -82,7 +82,7 @@ typedef struct CryptoKey
{ {
uint64 pgkey_id; /* Upper half of IV */ uint64 pgkey_id; /* Upper half of IV */
uint64 counter; /* Lower half of IV */ uint64 counter; /* Lower half of IV */
uint128 tag; /* GCM tag */ unsigned char tag[16]; /* GCM tag */
unsigned char encrypted_key[sizeof(int) + KMGR_MAX_KEY_LEN_BYTES]; unsigned char encrypted_key[sizeof(int) + KMGR_MAX_KEY_LEN_BYTES];
} CryptoKey; } CryptoKey;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment