-
-
Notifications
You must be signed in to change notification settings - Fork 11.2k
ppc_aes_gcm_crypt: integer truncation for inputs >2GB #30381
Copy link
Copy link
Closed
Labels
branch: 3.3Applies to openssl-3.3Applies to openssl-3.3branch: 3.4Applies to openssl-3.4Applies to openssl-3.4branch: 3.5Applies to openssl-3.5Applies to openssl-3.5branch: 3.6Applies to openssl-3.6Applies to openssl-3.6branch: 4.0Applies to openssl-4.0Applies to openssl-4.0branch: masterApplies to master branchApplies to master branchtriaged: bugThe issue/pr is/fixes a bugThe issue/pr is/fixes a bug
Description
In ppc_aes_gcm_crypt(), the assembly functions ppc_aes_gcm_encrypt/ppc_aes_gcm_decrypt are declared as returning size_t (64-bit on PPC64) in include/crypto/aes_platform.h:85-90. However, their return values are stored in int s (line 47) and accumulated in int ndone (line 48), both 32-bit signed.
int s = 0; // 32-bit signed — should be size_t
int ndone = 0; // 32-bit signed — should be size_t
// ...
s = encrypt ? ppc_aes_gcm_encrypt(in, out, len, key, ivec, Xi) // returns size_t
: ppc_aes_gcm_decrypt(in, out, len, key, ivec, Xi); // returns size_t
ndone += s;
return ndone; // implicit int → size_t conversionWhile the primary EVP entrypoints take length as an int (and therefore can't overflow this), EVP_Cipher() takes length as an unsigned int and therefore can.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
branch: 3.3Applies to openssl-3.3Applies to openssl-3.3branch: 3.4Applies to openssl-3.4Applies to openssl-3.4branch: 3.5Applies to openssl-3.5Applies to openssl-3.5branch: 3.6Applies to openssl-3.6Applies to openssl-3.6branch: 4.0Applies to openssl-4.0Applies to openssl-4.0branch: masterApplies to master branchApplies to master branchtriaged: bugThe issue/pr is/fixes a bugThe issue/pr is/fixes a bug