summaryrefslogtreecommitdiffstats
path: root/crypto/modes
diff options
context:
space:
mode:
authorDaniel Fiala <daniel@openssl.org>2022-05-15 04:39:50 +0200
committerPauli <pauli@openssl.org>2022-05-24 14:11:20 +1000
commit36c269c3023f5eb626ec79777ed8b285ef939be2 (patch)
tree9351ab951219478b3344b4479c873ced2a42dd0f /crypto/modes
parent272138795ffa63d5811e985f98cac94acf658dbe (diff)
Change loops conditions to make zero loop risk more obvious.
Fixes openssl#18073. Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Todd Short <todd.short@me.com> Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/18327)
Diffstat (limited to 'crypto/modes')
-rw-r--r--crypto/modes/gcm128.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/crypto/modes/gcm128.c b/crypto/modes/gcm128.c
index 8838ffccb9..a57d0f8fd9 100644
--- a/crypto/modes/gcm128.c
+++ b/crypto/modes/gcm128.c
@@ -545,7 +545,11 @@ static void gcm_ghash_4bit(u64 Xi[2], const u128 Htable[16],
Xi[0] = Z.hi;
Xi[1] = Z.lo;
}
- } while (inp += 16, len -= 16);
+
+ inp += 16;
+ /* Block size is 128 bits so len is a multiple of 16 */
+ len -= 16;
+ } while (len > 0);
}
# endif
# else