Skip to content

nettle-benchmark: avoid -Wmaybe-uninitialized warnings

Daiki Ueno requested to merge ueno/nettle:wip/ueno/maybe-uninit into master

Otherwise GCC 11 prints the following warning:

  nettle-benchmark.c: In function ‘time_umac’:
  ../umac.h:42:25: warning: ‘key’ may be used uninitialized [-Wmaybe-uninitialized]
     42 | #define umac32_set_key  nettle_umac32_set_key
  nettle-benchmark.c:395:3: note: in expansion of macro ‘umac32_set_key’
    395 |   umac32_set_key (&ctx32, key);
        |   ^~~~~~~~~~~~~~

Although this should be harmless as it's in the benchmarking code and the content of the key doesn't matter, it wouldn't hurt to explicitly initialize it. This patch also uses predefined constants for key sizes.

Merge request reports