gost-engine / engine

A reference implementation of the Russian GOST crypto algorithms for OpenSSL
Apache License 2.0
379 stars 174 forks source link

Last GCC version complains #436

Closed beldmit closed 1 year ago

beldmit commented 1 year ago

gcc-13 (Fedora rawhide)

[ 41%] Building C object CMakeFiles/gost_core.dir/gost_omac_acpkm.c.o
/usr/bin/gcc -DL_ENDIAN  -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -mbranch-protection=standard -fasynchronous-unwind-tables -fstack-clash-protection -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -fPIC -Werror -Wall -Wno-unused-parameter -Wno-unused-function -Wno-missing-braces -Wno-error=unknown-pragmas -Wno-error=pragmas -Wno-deprecated-declarations -std=gnu90 -MD -MT CMakeFiles/gost_core.dir/gost_omac_acpkm.c.o -MF CMakeFiles/gost_core.dir/gost_omac_acpkm.c.o.d -o CMakeFiles/gost_core.dir/gost_omac_acpkm.c.o -c /builddir/build/BUILD/engine-3.0.0/gost_omac_acpkm.c
In function 'make_kn',
    inlined from 'CMAC_ACPKM_Final' at /builddir/build/BUILD/engine-3.0.0/gost_omac_acpkm.c:274:5,
    inlined from 'omac_acpkm_imit_final' at /builddir/build/BUILD/engine-3.0.0/gost_omac_acpkm.c:354:5:
/builddir/build/BUILD/engine-3.0.0/gost_omac_acpkm.c:55:20: error: writing 1 byte into a region of size 0 [-Werror=stringop-overflow=]
   55 |         k1[bl - 1] ^= bl == 16 ? 0x87 : 0x1b;
      |         ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
/builddir/build/BUILD/engine-3.0.0/gost_omac_acpkm.c: In function 'omac_acpkm_imit_final':
/builddir/build/BUILD/engine-3.0.0/gost_omac_acpkm.c:260:24: note: at offset [-2147483649, -1] into destination object 'k2' of size 32
  260 |     unsigned char *k1, k2[EVP_MAX_BLOCK_LENGTH];
      |                        ^~
cc1: all warnings being treated as errors

As a temporary solution I just removed -Werror but it's worth having a more regular one. @vt-alt could you please take a look?