OpenSC / pkcs11-helper

Library that simplifies the interaction with PKCS#11 providers for end-user applications using a simple API and optional OpenSSL engine
Other
65 stars 43 forks source link

Build failure with upcoming Clang 16 (-Wincompatible-function-pointer-types) #60

Closed thesamesam closed 1 year ago

thesamesam commented 1 year ago

Clang 16 will make -Wincompatible-function-pointer-types an error by default.

You can emulate this error using:

GCC via -Werror=incompatible-pointer-types (GCC lacks a more specific warning for just func. ptrs)
Clang <16 via -Werror=incompatible-function-pointer-types

Originally reported downstream in Gentoo at https://bugs.gentoo.org/880975.

Full build log: https://bugs.gentoo.org/attachment.cgi?id=831351.

Error:

pkcs11h-openssl.c:1108:3: error: incompatible function pointer types passing
      'int
      (CRYPTO_EX_DATA *, const CRYPTO_EX_DATA *, void *, int, long, void *)'
      (aka 'int (struct crypto_ex_data_st *, const struct crypto_ex_data_st *,
      void *, int, long, void *)') to parameter of type 'CRYPTO_EX_dup *' (aka
      'int (*)(struct crypto_ex_data_st *, const struct crypto_ex_data_st *,
      void **, int, long, void *)')
      [-Werror,-Wincompatible-function-pointer-types]
                __pkcs11h_openssl_ex_data_dup,
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/openssl/rsa.h:444:62: note: expanded from macro
      'RSA_get_ex_new_index'
    CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_RSA, l, p, newf, dupf, freef)
                                                             ^~~~
/usr/include/openssl/crypto.h:246:51: note: passing argument to parameter
      'dup_func' here
                                   CRYPTO_EX_dup *dup_func,
                                                  ^
alonbl commented 1 year ago

Thanks! fixed by 744001c1424b2d178272194d64e3356824ecdcdc

thesamesam commented 1 year ago

Thanks for the quick fix!

ereslibre commented 10 months ago

Hello! Sorry for commenting on this old issue. I see that 6b7674a59dee3f1ba1de6caefed11299beaa4675 fixed this issue, but no release was made afterwards.

Do you plan to create a new release that will contain this commit?

Thanks!

alonbl commented 10 months ago

Hi @ereslibre, Released.

ereslibre commented 10 months ago

Amazing, thank you @alonbl!