CRYPTO_gcm128_decrypt: fix mac or tag calculation
authorZhang Jinde <zjd5536@163.com>
Thu, 24 Sep 2020 06:48:28 +0000 (14:48 +0800)
committerTomas Mraz <tomas@openssl.org>
Fri, 19 Feb 2021 11:24:03 +0000 (12:24 +0100)
The incorrect code is in #ifdef branch that is normally
not compiled in.

Signed-off-by: Zhang Jinde <zjd5536@163.com>
Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/12968)

crypto/modes/gcm128.c

index 4f52073d7f7a70a350d4e3aaf61e1f29b1708689..a6147e41a1fa0c3b8318585e3cf1ab8a384f68cd 100644 (file)
@@ -1359,8 +1359,8 @@ int CRYPTO_gcm128_decrypt(GCM128_CONTEXT *ctx,
                 else
                     ctx->Yi.d[3] = ctr;
                 for (i = 0; i < 16 / sizeof(size_t); ++i) {
-                    size_t c = in[i];
-                    out[i] = c ^ ctx->EKi.t[i];
+                    size_t c = in_t[i];
+                    out_t[i] = c ^ ctx->EKi.t[i];
                     ctx->Xi.t[i] ^= c;
                 }
                 GCM_MUL(ctx);