Skip to content

Commit

Permalink
Fix compiler error: unused variable 'byte' or 'word"
Browse files Browse the repository at this point in the history
  • Loading branch information
justsmth committed Nov 24, 2023
1 parent d551452 commit c8e30c0
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions crypto/fipsmodule/bn/bytes.c
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,9 @@ void bn_assert_fits_in_bytes(const BIGNUM *bn, size_t num) {
size_t tot_bytes = bn->width * sizeof(BN_ULONG);
if (tot_bytes > num) {
CONSTTIME_DECLASSIFY(bytes + num, tot_bytes - num);
// Avoids compiler error: unused variable 'byte' or 'word'
// The assert statements below are only effective in DEBUG builds
#ifndef NDEBUG
#ifdef OPENSSL_BIG_ENDIAN
for (int i = num / BN_BYTES; i < bn->width; i++) {
BN_ULONG word = bn->d[i];
Expand All @@ -229,6 +232,7 @@ void bn_assert_fits_in_bytes(const BIGNUM *bn, size_t num) {
for (size_t i = num; i < tot_bytes; i++) {
assert(bytes[i] == 0);
}
#endif
#endif
(void)bytes;
}
Expand Down

0 comments on commit c8e30c0

Please sign in to comment.