Minor changes of the GCM-related code.
authorJerry Shih <bignose1007@gmail.com>
Mon, 25 Sep 2023 01:13:07 +0000 (09:13 +0800)
committerHugo Landau <hlandau@openssl.org>
Thu, 26 Oct 2023 14:55:50 +0000 (15:55 +0100)
Unify the return value for `CRYPTO_gcm128_decrypt` as `CRYPTO_gcm128_encrypt`.

Signed-off-by: Jerry Shih <jerry.shih@sifive.com>
Signed-off-by: Phoebe Chen <phoebe.chen@sifive.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Hugo Landau <hlandau@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/21923)

providers/implementations/ciphers/cipher_aes_gcm_hw.c

index 4830cdc1b2d66caf0e1a114391d3fe7b81d3d4e3..8f3c4870fd1f598a01310a9a6dd952074c57131a 100644 (file)
@@ -99,7 +99,7 @@ static int generic_aes_gcm_cipher_update(PROV_GCM_CTX *ctx, const unsigned char
                 size_t res = (16 - ctx->gcm.mres) % 16;
 
                 if (CRYPTO_gcm128_decrypt(&ctx->gcm, in, out, res))
-                    return -1;
+                    return 0;
 
                 bulk = AES_gcm_decrypt(in + res, out + res, len - res,
                                        ctx->gcm.key,