lua-openssl icon indicating copy to clipboard operation
lua-openssl copied to clipboard

ocsp.c:190:29: error: passing argument 1 of PEM_ASN1_read_bio from incompatible pointer type

Open ConiKost opened this issue 1 year ago • 3 comments

  • uname -a or OS info: Gentoo Linux (Kernel 6.6.9)

  • openssl version or OPENSSL_VERSION_TEXT in your opensslv.h: OpenSSL 3.1.4 24 Oct 2023 (Library: OpenSSL 3.1.4 24 Oct 2023)

  • lua -v or luajit -v: Lua 5.4.6 Copyright (C) 1994-2023 Lua.org, PUC-Rio

Problem details Using GCC14 and newer makes compilation fail. GCC14 sets -Wincompatible-pointer-types as fatal error. As a result, the compilation will fail with lua-openssl.

Steps/codes to reproduce the bug

  1. Use GCC14
  2. Compile lua-openssl

Expected result Compilation succeeds

Additional context

x86_64-pc-linux-gnu-gcc -O2 -march=x86-64 -pipe -pipe -frecord-gcc-switches -fno-diagnostics-color -fmessage-length=0 -fPIC  -O2 -march=x86-64 -pipe -pipe -frecord-gcc-switches -fno-diagnostics-color -fmessage-length=0 -I/usr/include/luajit-2.1  -Wall -Wno-unused-value -Wno-unused-function -Ideps -Ideps/lua-compat/c-api -Ideps/auxiliar -c -o src/xalgor.o src/xalgor.c
src/ocsp.c: In function ‘openssl_ocsp_request_read’:
src/ocsp.c:190:29: error: passing argument 1 of ‘PEM_ASN1_read_bio’ from incompatible pointer type [-Wincompatible-pointer-types]
  190 |   OCSP_REQUEST *req = pem ? PEM_read_bio_OCSP_REQUEST(bio, NULL, NULL)
      |                             ^~~~~~~~~~~~~~~~~~~~~~~~~
      |                             |
      |                             char * (*)()
In file included from src/openssl.h:23,
                 from src/ocsp.c:16:
/usr/include/openssl/pem.h:391:38: note: expected ‘void * (*)(void **, const unsigned char **, long int)’ but argument is of type ‘char * (*)()’
  391 | void *PEM_ASN1_read_bio(d2i_of_void *d2i, const char *name, BIO *bp, void **x,
      |                         ~~~~~~~~~~~~~^~~
src/ocsp.c:190:29: error: passing argument 4 of ‘PEM_ASN1_read_bio’ from incompatible pointer type [-Wincompatible-pointer-types]
  190 |   OCSP_REQUEST *req = pem ? PEM_read_bio_OCSP_REQUEST(bio, NULL, NULL)
      |                             ^~~~~~~~~~~~~~~~~~~~~~~~~
      |                             |
      |                             char **
/usr/include/openssl/pem.h:391:77: note: expected ‘void **’ but argument is of type ‘char **’
  391 | void *PEM_ASN1_read_bio(d2i_of_void *d2i, const char *name, BIO *bp, void **x,
      |                                                                      ~~~~~~~^
src/ocsp.c: In function ‘openssl_ocsp_response_read’:
src/ocsp.c:366:30: error: passing argument 1 of ‘PEM_ASN1_read_bio’ from incompatible pointer type [-Wincompatible-pointer-types]
  366 |   OCSP_RESPONSE *res = pem ? PEM_read_bio_OCSP_RESPONSE(bio, NULL, NULL)
      |                              ^~~~~~~~~~~~~~~~~~~~~~~~~~
      |                              |
      |                              char * (*)()
/usr/include/openssl/pem.h:391:38: note: expected ‘void * (*)(void **, const unsigned char **, long int)’ but argument is of type ‘char * (*)()’
  391 | void *PEM_ASN1_read_bio(d2i_of_void *d2i, const char *name, BIO *bp, void **x,
      |                         ~~~~~~~~~~~~~^~~
src/ocsp.c:366:30: error: passing argument 4 of ‘PEM_ASN1_read_bio’ from incompatible pointer type [-Wincompatible-pointer-types]
  366 |   OCSP_RESPONSE *res = pem ? PEM_read_bio_OCSP_RESPONSE(bio, NULL, NULL)
      |                              ^~~~~~~~~~~~~~~~~~~~~~~~~~
      |                              |
      |                              char **
/usr/include/openssl/pem.h:391:77: note: expected ‘void **’ but argument is of type ‘char **’
  391 | void *PEM_ASN1_read_bio(d2i_of_void *d2i, const char *name, BIO *bp, void **x,
      |                                                                      ~~~~~~~^

ConiKost avatar Jan 05 '24 13:01 ConiKost

@zhaozg This will be a hard issue with GCC14, as GCC14 by default does now error on -Wincompatible-pointer-types.

ConiKost avatar Jan 23 '24 23:01 ConiKost