@@ -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
0 commit comments