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

re build failure - hmac.c:74:31: error: invalid application of 'sizeof' to an incomplete type 'HMAC_CTX' #201

Closed
jungle-boogie opened this issue Jan 24, 2022 · 16 comments

Comments

@jungle-boogie
Copy link

Hi,

Getting build failure with re. The file being referenced is ~5 years old.

  CC      build-i586/hmac/openssl/hmac.o
src/hmac/openssl/hmac.c:30:3: warning: implicit declaration of function 'HMAC_CTX_cleanup' is invalid in C99 [-Wimplicit-function-declaration]
                HMAC_CTX_cleanup(hmac->ctx);
                ^
src/hmac/openssl/hmac.c:74:31: error: invalid application of 'sizeof' to an incomplete type 'HMAC_CTX' (aka 'struct hmac_ctx_st')
        hmac->ctx = mem_zalloc(sizeof(*hmac->ctx), NULL);
                                     ^~~~~~~~~~~~
/usr/include/openssl/ossl_typ.h:114:16: note: forward declaration of 'struct hmac_ctx_st'
typedef struct hmac_ctx_st HMAC_CTX;
               ^
src/hmac/openssl/hmac.c:80:2: warning: implicit declaration of function 'HMAC_CTX_init' is invalid in C99 [-Wimplicit-function-declaration]
        HMAC_CTX_init(hmac->ctx);
        ^
2 warnings and 1 error generated.
gmake: *** [Makefile:122: build-i586/hmac/openssl/hmac.o] Error 1
@sreimers
Copy link
Member

Can you provide the output of make info and some details about the build system?

@jungle-boogie
Copy link
Author

OpenBSD i386 building with clang via gmake.

$ cc -v
OpenBSD clang version 13.0.0
Target: i386-unknown-openbsd7.0
Thread model: posix
InstalledDir: /usr/bin
p$ gmake -v
GNU Make 4.3
Built for i386-unknown-openbsd7.0

@jungle-boogie
Copy link
Author

$ gmake CC=clang info
info - baresip version 1.1.0
  MODULES:       account auconv contact ctrl_tcp debug_cmd ebuacip echo fakevideo httpd ice menu mwi natpmp presence rtcpsummary selfview serreg srtp stun turn uuid
vidbridge vidinfo vumeter mixausrc mixminus multicast aubridge aufile ausine cons dtls_srtp g711 ctrl_dbus gtk httpreq l16 netroam stdio sndio syslog v4l2
  MACHINE:       i386-unknown-openbsd7.0
  ARCH:          i586
  OS:            openbsd
  BUILD:         build-i586
  PKG_CONFIG:
  CCACHE:
  CC:            clang 13.0.0 (13.x)

@sreimers
Copy link
Member

Is this the complete output? It should look like this:

$ make info
info - baresip version 1.1.0
  MODULES:       account auconv b2bua contact ctrl_tcp debug_cmd ebuacip echo fakevideo httpd ice menu mwi natpmp presence rtcpsummary selfview serreg srtp stun turn uuid vidbridge vidinfo vumeter mixausrc mixminus multicast aubridge aufile ausine aac alsa amr aptx av1 avcodec avformat cons dtls_srtp evdev g711 g722 g726 gsm ctrl_dbus gst gst_video gtk httpreq jack l16 opus_multistream mpa mqtt netroam opus plc portaudio pulse sdl snapshot sndfile stdio syslog v4l2 omx vp8 vp9 x11 x11grab webrtc_aec 
  MACHINE:       x86_64-pc-linux-gnu
  ARCH:          x86_64
  OS:            linux
  BUILD:         build-x86_64
  PKG_CONFIG:    1.8.0
  CCACHE:        
  CC:            gcc 11.1.0 (11.x)
  CFLAGS:        -Wall -Wextra -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wbad-function-cast -Wsign-compare -Wnested-externs -Wshadow -Waggregate-return -Wcast-align -Wold-style-definition -Wdeclaration-after-statement -Wvla  -g -fPIC -DLINUX -DOS="linux" -std=c11 -pedantic -DHAVE_ATOMIC -DARCH="x86_64" -DUSE_OPENSSL -DUSE_TLS -DUSE_OPENSSL_DTLS -DUSE_DTLS -DUSE_OPENSSL_SRTP -DUSE_DTLS_SRTP -DUSE_ZLIB -DHAVE_PTHREAD -DHAVE_GETIFADDRS -DHAVE_STRERROR_R -DHAVE_GETOPT -DHAVE_INTTYPES_H -DHAVE_NET_ROUTE_H -DHAVE_STDBOOL_H -DHAVE_INET6 -DHAVE_SYSLOG -DHAVE_RESOLV -DHAVE_EXECINFO -DHAVE_FORK -DHAVE_PWD_H -DHAVE_POLL  -DHAVE_SELECT -DHAVE_SELECT_H -DHAVE_SETRLIMIT -DHAVE_SIGNAL -DHAVE_SYS_TIME_H -DHAVE_EPOLL -DHAVE_UNAME -DHAVE_UNISTD_H -DHAVE_STRINGS_H -DVERSION="1.1.0" -DVER_MAJOR= -DVER_MINOR= -DVER_PATCH=  -I. -Iinclude -I../re/include -I../rem/include -DPREFIX="/usr/local" -DMOD_PATH="/usr/local/lib/baresip/modules" -DSHARE_PATH="/usr/local/share/baresip"
  DFLAGS:        -MD -MF info -MT info
  LFLAGS:        -fPIC 
  SH_LFLAGS:     -shared
  MOD_LFLAGS:    -L/usr/local/lib
  APP_LFLAGS:    -rdynamic
  LIBS:          -ldl -lssl -lcrypto -lz -lpthread -L../rem -L/usr/local/lib -lrem -lm
  LIBRE_MK:      ../re/mk/re.mk
  LIBRE_PATH:    ../re
  LIBRE_INC:     ../re/include
  LIBRE_SO:      ../re
  OPENSSL_OPT:   
  USE_OPENSSL:   yes
  USE_OPENSSL_AES:   yes
  USE_OPENSSL_HMAC:  yes
  USE_TLS:       yes
  USE_DTLS:      yes
  USE_DTLS_SRTP: yes
  USE_ZLIB:      yes
  GCOV:          
  GPROF:         
  CROSS_COMPILE: 
  SYSROOT:       /usr
  SYSROOT_ALT:   
  LIB_SUFFIX:    .so
  MOD_SUFFIX:    .so
  BIN_SUFFIX:    

@jungle-boogie
Copy link
Author

The full output is available here: https://termbin.com/6lgf

@sreimers
Copy link
Member

Can you check which OpenSSL Version/Variant is used? OpenSSL 3.0 with no-deprecated?

@jungle-boogie
Copy link
Author

jungle-boogie commented Jan 25, 2022

$ openssl version -a
LibreSSL 3.5.0
built on: date not available
platform: information not available
options:  bn(64,32) rc4(8x,mmx) des(ptr,risc1,16,long) idea(int) blowfish(idx)
compiler: information not available
OPENSSLDIR: "/etc/ssl"

@jungle-boogie
Copy link
Author

I don't know what you mean with no-deprecated.

@sreimers
Copy link
Member

sreimers commented Jan 26, 2022

@jungle-boogie
Copy link
Author

jungle-boogie commented Jan 26, 2022

I did a git update, since I see hmac.c was updated on master.

Now things went sideways with src/tls/openssl/tls_tcp.c:

src/tls/openssl/tls_tcp.c:72:3: error: incomplete definition of type 'struct bio_st'
        b->init  = 1;
        ~^
/usr/include/openssl/ossl_typ.h:95:16: note: forward declaration of 'struct bio_st'
typedef struct bio_st BIO;
               ^
src/tls/openssl/tls_tcp.c:73:3: error: incomplete definition of type 'struct bio_st'
        b->num   = 0;
        ~^
/usr/include/openssl/ossl_typ.h:95:16: note: forward declaration of 'struct bio_st'
typedef struct bio_st BIO;
               ^
src/tls/openssl/tls_tcp.c:74:3: error: incomplete definition of type 'struct bio_st'
        b->ptr   = NULL;
        ~^
/usr/include/openssl/ossl_typ.h:95:16: note: forward declaration of 'struct bio_st'
typedef struct bio_st BIO;
               ^
src/tls/openssl/tls_tcp.c:75:3: error: incomplete definition of type 'struct bio_st'
        b->flags = 0;
        ~^
/usr/include/openssl/ossl_typ.h:95:16: note: forward declaration of 'struct bio_st'
typedef struct bio_st BIO;
               ^
src/tls/openssl/tls_tcp.c:92:3: error: incomplete definition of type 'struct bio_st'
        b->ptr   = NULL;
        ~^
/usr/include/openssl/ossl_typ.h:95:16: note: forward declaration of 'struct bio_st'
typedef struct bio_st BIO;
               ^
src/tls/openssl/tls_tcp.c:93:3: error: incomplete definition of type 'struct bio_st'
        b->init  = 0;
        ~^
/usr/include/openssl/ossl_typ.h:95:16: note: forward declaration of 'struct bio_st'
typedef struct bio_st BIO;
               ^
src/tls/openssl/tls_tcp.c:94:3: error: incomplete definition of type 'struct bio_st'
        b->flags = 0;
        ~^
/usr/include/openssl/ossl_typ.h:95:16: note: forward declaration of 'struct bio_st'
typedef struct bio_st BIO;
               ^
src/tls/openssl/tls_tcp.c:106:25: error: incomplete definition of type 'struct bio_st'
        struct tls_conn *tc = b->ptr;
                              ~^
/usr/include/openssl/ossl_typ.h:95:16: note: forward declaration of 'struct bio_st'
typedef struct bio_st BIO;
               ^
src/tls/openssl/tls_tcp.c:161:29: error: variable has incomplete type 'struct bio_method_st'
static struct bio_method_st bio_tcp_send = {
                            ^
/usr/include/openssl/bio.h:282:16: note: forward declaration of 'struct bio_method_st'
typedef struct bio_method_st BIO_METHOD;
               ^
src/tls/openssl/tls_tcp.c:465:14: error: incomplete definition of type 'struct bio_st'
        tc->sbio_out->ptr = tc;
        ~~~~~~~~~~~~^
/usr/include/openssl/ossl_typ.h:95:16: note: forward declaration of 'struct bio_st'
typedef struct bio_st BIO;
               ^
10 errors generated.
gmake: *** [Makefile:122: build-i586/tls/openssl/tls_tcp.o] Error 1

@sreimers
Copy link
Member

sreimers commented Jan 27, 2022

You are using OpenBSD-current? It looks like there are ongoing changes to LibreSSL 3.5 (not released yet). I think we should wait until an official release comes out (maybe some changes will be reverted) and focus on fixing the OpenSSL 3 deprecation warnings for now.

@jungle-boogie
Copy link
Author

jungle-boogie commented Jan 27, 2022 via email

@sreimers
Copy link
Member

Will close this for now until a complete migration guide for LibreSSL 3.5 is available.

@sreimers
Copy link
Member

Since libressl 3.5 is released now, I could test and fix the remaining issues. Can you re-test on OpenBSD current?

@jungle-boogie
Copy link
Author

jungle-boogie commented Feb 27, 2022 via email

@jungle-boogie
Copy link
Author

jungle-boogie commented Feb 28, 2022

re now builds fine, but baresip still has issues.

 LD      baresip
ld: error: ../re/libre.so: undefined reference to backtrace_symbols [--no-allow-shlib-undefined]
ld: error: ../re/libre.so: undefined reference to backtrace [--no-allow-shlib-undefined]
clang: error: linker command failed with exit code 1 (use -v to see invocation)
gmake: *** [Makefile:319: baresip] Error 1

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