mcuboot icon indicating copy to clipboard operation
mcuboot copied to clipboard

bootutil: Fix signed/unsigned comparison in boot_read_enc_key

Open taltenbach opened this issue 1 year ago • 0 comments

When MCUBOOT_SWAP_SAVE_ENCTLV is enabled, a comparison between a signed and an unsigned integer is made in boot_read_enc_key. This shouldn't cause any issue at runtime but might lead to a warning to be emitted at compile-time.

In particular, with GCC, if -Wsign-compare is enabled:

MCUboot/boot/bootutil/src/bootutil_misc.c:279:23: warning: comparison of integer expressions of different signedness: 'int' and 'unsigned int' [-Wsign-compare]
         for (i = 0; i < BOOT_ENC_TLV_ALIGN_SIZE; i++) {
                       ^

taltenbach avatar May 13 '24 13:05 taltenbach