Skip to content

Commit

Permalink
Change loops conditions to make zero loop risk more obvious.
Browse files Browse the repository at this point in the history
Fixes #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 #18327)
  • Loading branch information
faramir-dev authored and paulidale committed May 24, 2022
1 parent 2721387 commit 36c269c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion crypto/aria/aria.c
Expand Up @@ -498,7 +498,7 @@ void ossl_aria_encrypt(const unsigned char *in, unsigned char *out,
ARIA_ADD_ROUND_KEY(rk, reg0, reg1, reg2, reg3);
rk++;

while (Nr -= 2) {
while ((Nr -= 2) > 0) {
ARIA_SUBST_DIFF_EVEN(reg0, reg1, reg2, reg3);
ARIA_ADD_ROUND_KEY(rk, reg0, reg1, reg2, reg3);
rk++;
Expand Down
6 changes: 5 additions & 1 deletion crypto/modes/gcm128.c
Expand Up @@ -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
Expand Down

0 comments on commit 36c269c

Please sign in to comment.