Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

e_aes.c:1323:37: error: passing argument 1 of 'aes_gcm_set_key' from incompatible pointer type [-Wincompatible-pointer-types] #3

Open
blshkv opened this issue Jan 18, 2025 · 8 comments

Comments

@blshkv
Copy link

blshkv commented Jan 18, 2025

Configuring for linux-x86_64
======================================================================
=== SANITY TESTING!
=== No configuration will be done, all other arguments will be ignored!
======================================================================
No sanity errors detected!
 �[32m*�[0m Will copy sources from /var/tmp/portage/dev-libs/openssl-bad-1.0.2_p20250104/work/openssl-1.0.2.bad-a9c866be14959b8b213a66ee47736be16db968fd
 �[32m*�[0m abi_x86_64.amd64: copying to /var/tmp/portage/dev-libs/openssl-bad-1.0.2_p20250104/work/openssl-1.0.2.bad-a9c866be14959b8b213a66ee47736be16db968fd-abi_x86_64.amd64
>>> Source prepared.
>>> Configuring source in /var/tmp/portage/dev-libs/openssl-bad-1.0.2_p20250104/work/openssl-1.0.2.bad-a9c866be14959b8b213a66ee47736be16db968fd ...
 �[32m*�[0m abi_x86_64.amd64: running multilib-minimal_abi_src_configure
 �[32m*�[0m Use configuration linux-x86_64
./Configure linux-x86_64 enable-camellia enable-ec enable-ec2m enable-srp enable-idea enable-mdc2 enable-rc5 enable-tlsext enable-asm no-gmp no-krb5 no-rfc3779 no-sctp no-ssl2 enable-ssl3 enable-heartbeats no-zlib --prefix=/usr --openssldir=/etc/ssl --libdir=lib64 shared threads
Configuring for linux-x86_64
    no-ec_nistp_64_gcc_128 [default]  OPENSSL_NO_EC_NISTP_64_GCC_128 (skip dir)
    no-gmp          [option]   OPENSSL_NO_GMP (skip dir)
    no-jpake        [experimental] OPENSSL_NO_JPAKE (skip dir)
    no-krb5         [krb5-flavor not specified] OPENSSL_NO_KRB5
    no-libunbound   [experimental] OPENSSL_NO_LIBUNBOUND (skip dir)
    no-md2          [default]  OPENSSL_NO_MD2 (skip dir)
    no-rfc3779      [option]   OPENSSL_NO_RFC3779 (skip dir)
    no-sctp         [option]   OPENSSL_NO_SCTP (skip dir)
    no-ssl-trace    [default]  OPENSSL_NO_SSL_TRACE (skip dir)
    no-ssl2         [option]   OPENSSL_NO_SSL2 (skip dir)
    no-store        [experimental] OPENSSL_NO_STORE (skip dir)
    no-unit-test    [default]  OPENSSL_NO_UNIT_TEST (skip dir)
    no-zlib         [option]  
    no-zlib-dynamic [default] 
IsMK1MF=0
No makedepend executable found on your path.
CC            =x86_64-pc-linux-gnu-gcc
CFLAG         =-fPIC -DOPENSSL_PIC -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -m64 -DL_ENDIAN -O3 -Wall -DOPENSSL_IA32_SSE2 -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_MONT5 -DOPENSSL_BN_ASM_GF2m -DRC4_ASM -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DMD5_ASM -DAES_ASM -DVPAES_ASM -DBSAES_ASM -DWHIRLPOOL_ASM -DGHASH_ASM -DECP_NISTZ256_ASM
EX_LIBS       =-ldl
CPUID_OBJ     =x86_64cpuid.o
BN_ASM        =x86_64-gcc.o x86_64-mont.o x86_64-mont5.o x86_64-gf2m.o rsaz_exp.o rsaz-x86_64.o rsaz-avx2.o
EC_ASM        =ecp_nistz256.o ecp_nistz256-x86_64.o
DES_ENC       =des_enc.o fcrypt_b.o
AES_ENC       =aes-x86_64.o vpaes-x86_64.o bsaes-x86_64.o aesni-x86_64.o aesni-sha1-x86_64.o aesni-sha256-x86_64.o aesni-mb-x86_64.o
BF_ENC        =bf_enc.o
CAST_ENC      =c_enc.o
RC4_ENC       =rc4-x86_64.o rc4-md5-x86_64.o
CHACHA_ENC    =chacha_vec.o
POLY1305      =poly1305_vec.o
RC5_ENC       =rc5_enc.o
MD5_OBJ_ASM   =md5-x86_64.o
SHA1_OBJ_ASM  =sha1-x86_64.o sha256-x86_64.o sha512-x86_64.o sha1-mb-x86_64.o sha256-mb-x86_64.o
RMD160_OBJ_ASM=
CMLL_ENC      =cmll-x86_64.o cmll_misc.o
MODES_OBJ     =ghash-x86_64.o aesni-gcm-x86_64.o
ENGINES_OBJ   =
PROCESSOR     =
RANLIB        =x86_64-pc-linux-gnu-ranlib
ARFLAGS       =
PERL          =/usr/bin/perl
SIXTY_FOUR_BIT_LONG mode
DES_UNROLL used
DES_INT used
RC4_CHUNK is unsigned long
created directory `include'
created directory `include/openssl'
e_os2.h => include/openssl/e_os2.h

and then:

x86_64-pc-linux-gnu-gcc -I.. -I../.. -I../modes -I../asn1 -I../evp -I../../include  -fPIC -DOPENSSL_PIC -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -DL_ENDIAN -Wall -DOPENSSL_IA32_SSE2 -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_MONT5 -DOPENSSL_BN_ASM_GF2m -DRC4_ASM -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DMD5_ASM -DAES_ASM -DVPAES_ASM -DBSAES_ASM -DWHIRLPOOL_ASM -DGHASH_ASM -DECP_NISTZ256_ASM -O2 -pipe -frecord-gcc-switches -fno-strict-aliasing -Wa,--noexecstack  -DOPENSSL_NO_BUF_FREELISTS  -c -o e_seed.o e_seed.c
x86_64-pc-linux-gnu-gcc -I.. -I../.. -I../modes -I../asn1 -I../evp -I../../include  -fPIC -DOPENSSL_PIC -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -DL_ENDIAN -Wall -DOPENSSL_IA32_SSE2 -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_MONT5 -DOPENSSL_BN_ASM_GF2m -DRC4_ASM -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DMD5_ASM -DAES_ASM -DVPAES_ASM -DBSAES_ASM -DWHIRLPOOL_ASM -DGHASH_ASM -DECP_NISTZ256_ASM -O2 -pipe -frecord-gcc-switches -fno-strict-aliasing -Wa,--noexecstack  -DOPENSSL_NO_BUF_FREELISTS  -c -o e_xcbc_d.o e_xcbc_d.c
x86_64-pc-linux-gnu-gcc -I.. -I../.. -I../modes -I../asn1 -I../evp -I../../include  -fPIC -DOPENSSL_PIC -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -DL_ENDIAN -Wall -DOPENSSL_IA32_SSE2 -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_MONT5 -DOPENSSL_BN_ASM_GF2m -DRC4_ASM -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DMD5_ASM -DAES_ASM -DVPAES_ASM -DBSAES_ASM -DWHIRLPOOL_ASM -DGHASH_ASM -DECP_NISTZ256_ASM -O2 -pipe -frecord-gcc-switches -fno-strict-aliasing -Wa,--noexecstack  -DOPENSSL_NO_BUF_FREELISTS  -c -o e_rc2.o e_rc2.c
e_aes.c: In function 'aes_gcm_init_key':
e_aes.c:1323:37: error: passing argument 1 of 'aes_gcm_set_key' from incompatible pointer type [-Wincompatible-pointer-types]
 1323 |         gctx->ctr = aes_gcm_set_key(&gctx->ks, &gctx->gcm, key, ctx->key_len);
      |                                     ^~~~~~~~~
      |                                     |
      |                                     union <anonymous> *
e_aes.c:1274:42: note: expected 'AES_KEY *' {aka 'struct aes_key_st *'} but argument is of type 'union <anonymous> *'
 1274 | static ctr128_f aes_gcm_set_key(AES_KEY *aes_key, GCM128_CONTEXT *gcm_ctx,
      |                                 ~~~~~~~~~^~~~~~~
make[2]: *** [<builtin>: e_aes.o] Error 1

Please sync e_aes.c with upstream

@drwetter
Copy link
Collaborator

a) what do you mean by upstream?
b) what kind of system do you try to compile this on (portage for Linux?)

@blshkv
Copy link
Author

blshkv commented Jan 19, 2025

according to openssl.spec spec the fork is based on Version: 1.0.2k.
As a PoC, I copied that file from 1.0.2r and it compiled fine.

P.S. I use Hardened Gentoo Linux:

sh bash 5.2_p37
ld GNU ld (Gentoo 2.43 p3) 2.43.1
app-misc/pax-utils:        1.3.8::gentoo
app-shells/bash:           5.2_p37::gentoo
dev-build/autoconf:        2.72-r1::gentoo
dev-build/automake:        1.16.5-r2::gentoo
dev-build/cmake:           3.30.6::gentoo
dev-build/libtool:         2.5.4::gentoo
dev-build/make:            4.4.1-r100::gentoo
dev-build/meson:           1.5.2::gentoo
dev-java/java-config:      2.3.4::gentoo
dev-lang/perl:             5.40.0::gentoo
dev-lang/python:           3.12.8::gentoo, 3.13.1::gentoo
dev-lang/rust-bin:         1.82.0-r101::gentoo
llvm-core/clang:           18.1.8-r6::gentoo, 19.1.4::gentoo
llvm-core/lld:             18.1.8::gentoo
llvm-core/llvm:            18.1.8-r6::gentoo, 19.1.4::gentoo
sys-apps/baselayout:       2.17::gentoo
sys-apps/openrc:           0.55.1::gentoo
sys-apps/sandbox:          2.39::gentoo
sys-devel/binutils:        2.43-r2::gentoo
sys-devel/binutils-config: 5.5.2::gentoo
sys-devel/gcc:             14.2.1_p20241221::gentoo
sys-devel/gcc-config:      2.11::gentoo
sys-kernel/linux-headers:  6.6-r1::gentoo (virtual/os-headers)
sys-libs/glibc:            2.40-r5::gentoo

ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="@FREE"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -pipe -frecord-gcc-switches"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /etc/stunnel/stunnel.conf /usr/lib64/libreoffice/program/sofficerc /usr/share/config /usr/share/easy-rsa /usr/share/gnupg/qualified.txt /usr/share/themes/oxygen-gtk/gtk-2.0 /var/bind"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d"
CXXFLAGS="-O2 -pipe -frecord-gcc-switches"
DISTDIR="/var/cache/distfiles"
EMERGE_DEFAULT_OPTS="--quiet-build"
ENV_UNSET="CARGO_HOME DBUS_SESSION_BUS_ADDRESS DISPLAY GDK_PIXBUF_MODULE_FILE GOBIN GOPATH PERL5LIB PERL5OPT PERLPREFIX PERL_CORE PERL_MB_OPT PERL_MM_OPT XAUTHORITY XDG_CACHE_HOME XDG_CONFIG_HOME XDG_DATA_HOME XDG_RUNTIME_DIR XDG_STATE_HOME"
FCFLAGS="-O2 -pipe -frecord-gcc-switches"
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs buildpkg-live compressdebug config-protect-if-modified distlocks ebuild-locks fixlafiles ipc-sandbox merge-sync merge-wait multilib-strict network-sandbox news parallel-fetch pid-sandbox pkgdir-index-trusted preserve-libs protect-owned qa-unresolved-soname-deps sandbox sfperms splitdebug strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2 -pipe -frecord-gcc-switches"
GENTOO_MIRRORS="http://distfiles.gentoo.org"
INSTALL_MASK="*.la"
LANG="en_US.utf8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed -Wl,-z,pack-relative-relocs -Wl,--defsym=__gentoo_check_ldflags__=0"
LEX="flex"
LINGUAS="en ru"
MAKEOPTS="-j8"
PKGDIR="/var/cache/binpkgs"
PORTAGE_BINHOST="https://gentoo.osuosl.org/experimental/amd64/binpkg/default/linux/17.1/x86-64/"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_EXTRA_OPTS="--omit-dir-times"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --exclude=/.git"
PORTAGE_TMPDIR="/var/tmp"
SHELL="/bin/bash"
USE="X a52 aac acl acpi activities alsa amd64 bluetooth branding bzip2 cairo cdda cet crypt cuda cups dbus declarative dri dri3 dts dvdr elogind encode exif ffmpeg flac gdbm gif gtk gui hackrf hardened iconv icu ipv6 jpeg kde keyring kf6compat kwallet lcms libnotify libtirpc mad mariadb minipentoo mng mp3 mp4 mpeg multilib ncurses networkmanager nls ogg opencl opengl openmp pam pango pcre pdf pic pie pipewire plasma png policykit ppds pulseaudio qml qt5 qt6 readline samba screencast sdl seccomp semantic-desktop sound spell ssl ssp startup-notification svg test-rust tiff truetype udev udisks unicode upower usb vdpau vlc vorbis vulkan wayland widgets wxwidgets x264 xattr xcb xft xinerama xml xtpax xv xvid zlib" ABI_X86="64" ADA_TARGET="gcc_13" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_anon authn_dbm authn_file authz_dbm authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir env expires ext_filter file_cache filter headers include info log_config logio mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="karbon sheets words" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="aes avx avx2 f16c fma3 mmx mmxext pclmul popcnt rdrand sse sse2 sse3 sse4_1 sse4_2 ssse3" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock greis isync itrax navcom oceanserver oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 tsip tripmate tnt ublox" GUILE_SINGLE_TARGET="3-0" GUILE_TARGETS="3-0" INPUT_DEVICES="libinput" KERNEL="linux" L10N="en ru en-US en-GB" LCD_DEVICES="bayrad cfontz glk hd44780 lb216 lcdm001 mtxorb text" LLVM_TARGETS="X86" LUA_SINGLE_TARGET="lua5-1" LUA_TARGETS="lua5-1" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php8-2" POSTGRES_TARGETS="postgres16" PYTHON_SINGLE_TARGET="python3_12" PYTHON_TARGETS="python3_12" RUBY_TARGETS="ruby32" VIDEO_CARDS="vesa intel i965 nvidia" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipp2p iface geoip fuzzy condition tarpit sysrq proto logmark ipmark dhcpmac delude chaos account"
Unset:  ADDR2LINE, AR, ARFLAGS, AS, ASFLAGS, CC, CCLD, CONFIG_SHELL, CPP, CPPFLAGS, CTARGET, CXX, CXXFILT, ELFEDIT, EXTRA_ECONF, F77FLAGS, FC, GCOV, GPROF, LC_ALL, LD, LFLAGS, LIBTOOL, MAKE, MAKEFLAGS, NM, OBJCOPY, OBJDUMP, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PYTHONPATH, RANLIB, READELF, RUSTFLAGS, SIZE, STRINGS, STRIP, YACC, YFLAGS

@blshkv blshkv mentioned this issue Jan 19, 2025
blshkv added a commit to blshkv/pentoo-overlay that referenced this issue Jan 19, 2025
@drwetter
Copy link
Collaborator

okay, thanks @blshkv !

I don't get why it compiled fine for me but on gentoo not. Probably it's due to the age of the system I used. For compiling the binary I'd rather tend to pick an old system so that users with those systems won't have problems running the binary.

@blshkv
Copy link
Author

blshkv commented Jan 20, 2025

so the workaround is to compile with the following options:

-Wno-error=implicit-function-declaration -Wno-error=incompatible-pointer-types

A long term solution is to re-fork a more decent version and re-apply bad patches

@drwetter
Copy link
Collaborator

probably it's gcc 14 which implicitly does -Werror=incompatible-pointer-types, see https://gcc.gnu.org/gcc-14/porting_to.html . I got a warning only with the earlier version, whereas you got an error and above your mentioned sys-devel/gcc: 14.2.1_p20241221::gentoo . So maybe I should include -Wno-error=incompatible-pointer-types.

yeah, I could start from scratch with the "latest" version before the 1.0.2 branch became extinct :-) . But I wonder whether it would be better to use my time on other issues of the project.

@blshkv
Copy link
Author

blshkv commented Jan 22, 2025

Yeah, may be not worth it, it's not a critical bug for this project.
It's your call. Im happy with the workaround

@drwetter
Copy link
Collaborator

drwetter commented Jan 28, 2025

so the workaround is to compile with the following options

Where did you supply them? I didn't manage to pass the two flags, or better : I passed them but it looks like they were ignored.

drwetter added a commit that referenced this issue Jan 28, 2025
* Backport from https://github.com/openssl/openssl/pull/2300/files (openssl 1.1.1)
* Trying to supply gcc compilerflags for gcc >=14 (see #3) in 00-testssl-stuff/make-openssl.sh but w/o success (Same with Configure)

This fixes #2.

See also testssl/testssl.sh#2356 .
@drwetter drwetter mentioned this issue Jan 28, 2025
drwetter added a commit that referenced this issue Jan 28, 2025
* Backport from https://github.com/openssl/openssl/pull/2300/files (openssl 1.1.1)
* Trying to supply gcc compilerflags for gcc >=14 (see #3) in 00-testssl-stuff/make-openssl.sh but w/o success (Same with Configure)

This fixes #2.

See also testssl/testssl.sh#2356 .
drwetter added a commit that referenced this issue Jan 28, 2025
* Backport from https://github.com/openssl/openssl/pull/2300/files (openssl 1.1.1)
* Trying to supply gcc compilerflags for gcc >=14 (see #3) in 00-testssl-stuff/make-openssl.sh but w/o success (Same with Configure)

This fixes #2.

See also testssl/testssl.sh#2356 .
@drwetter drwetter mentioned this issue Jan 29, 2025
@blshkv
Copy link
Author

blshkv commented Jan 30, 2025

Sorry, I can't clarify it right away because I added flags using Gentoo framework. I think it adds it to one of configs but I can't tell to which one exactly. I'll try to debug once I have access to my computer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants