Skip to content

Commit e35b2ba

Browse files
committed
remove uint128 requirement from patch 978f869 (CFE)
Used char[16] instead. Reported-by: buildfarm member florican Backpatch-through: master
1 parent 945083b commit e35b2ba

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/common/kmgr_utils.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ kmgr_wrap_key(PgCipherCtx *ctx, CryptoKey *in, CryptoKey *out)
8181
&enclen, /* Resulting length, must match input for us */
8282
iv, /* Generated IV from above */
8383
sizeof(iv), /* Length of the IV */
84-
(unsigned char *) &out->tag, /* Resulting tag */
84+
out->tag, /* Resulting tag */
8585
sizeof(out->tag))) /* Length of our tag */
8686
return false;
8787

@@ -106,7 +106,7 @@ kmgr_unwrap_key(PgCipherCtx *ctx, CryptoKey *in, CryptoKey *out)
106106

107107
out->pgkey_id = in->pgkey_id;
108108
out->counter = in->counter;
109-
out->tag = in->tag;
109+
memcpy(out->tag, in->tag, sizeof(in->tag));
110110

111111
/* Construct the IV we are going to use, see kmgr_utils.h */
112112
memcpy(iv, &out->pgkey_id, sizeof(out->pgkey_id));
@@ -120,7 +120,7 @@ kmgr_unwrap_key(PgCipherCtx *ctx, CryptoKey *in, CryptoKey *out)
120120
&declen, /* Length of plaintext */
121121
iv, /* IV we constructed above */
122122
sizeof(iv), /* Size of our IV */
123-
(unsigned char *) &in->tag, /* Tag which will be verified */
123+
in->tag, /* Tag which will be verified */
124124
sizeof(in->tag))) /* Size of our tag */
125125
return false;
126126

src/include/common/kmgr_utils.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ typedef struct CryptoKey
8282
{
8383
uint64 pgkey_id; /* Upper half of IV */
8484
uint64 counter; /* Lower half of IV */
85-
uint128 tag; /* GCM tag */
85+
unsigned char tag[16]; /* GCM tag */
8686
unsigned char encrypted_key[sizeof(int) + KMGR_MAX_KEY_LEN_BYTES];
8787
} CryptoKey;
8888

0 commit comments

Comments
 (0)