-
-
Notifications
You must be signed in to change notification settings - Fork 11.2k
Incorrect error return in ppc_aes_gcm_cipher_update #30380
Copy link
Copy link
Closed
Labels
issue: bug reportThe issue was opened to report a bugThe issue was opened to report a bug
Description
The function ppc_aes_gcm_cipher_update() has a clear contract: return 1 on success, 0 on failure (see line 139: return 1). On the decrypt pre-alignment path, line 122 returns -1 instead of 0 when CRYPTO_gcm128_decrypt fails:
// Line 121-122 (decrypt — WRONG):
if (CRYPTO_gcm128_decrypt(&ctx->gcm, in, out, res))
return -1;
// Line 97-98 (encrypt — CORRECT):
if (CRYPTO_gcm128_encrypt(&ctx->gcm, in, out, res))
return 0;The caller at ciphercommon_gcm.c:460 checks:
if (!hw->cipherupdate(ctx, in, len, out))
goto err;Since !(-1) evaluates to 0 (false in C), the goto err is not taken. The error is silently swallowed and GCM processing continues with potentially corrupt state. This is the only return -1 across all GCM cipher implementation files — all five other error returns in the same function correctly return 0.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
issue: bug reportThe issue was opened to report a bugThe issue was opened to report a bug