p11-glue / p11-kit

Provides a way to load and enumerate PKCS#11 modules.
https://p11-glue.github.io/p11-glue/p11-kit.html
Other
149 stars 91 forks source link

Compilation error on i386: passing argument 3 of 'p11_asn1_read' from incompatible pointer type #638

Closed dschepler closed 2 months ago

dschepler commented 2 months ago

When I try building p11-kit (version 0.25.3) for i386, I get errors such as this one:

[95/416] Compiling C object p11-kit/p11-kit.p/import-object.c.o
FAILED: p11-kit/p11-kit.p/import-object.c.o 
cc -Ip11-kit/p11-kit.p -Ip11-kit -I../../p11-kit -I. -I../.. -Icommon -I../../common -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -O3 -D_GNU_SOURCE -DP11_KIT_FUTURE_UNSTABLE_API '-DBINDIR="/usr/bin"' '-DPRIVATEDIR="/usr/libexec/p11-kit"' '-DSYSCONFDIR="/etc"' '-DP11_SYSTEM_CONFIG_FILE="/etc/pkcs11/pkcs11.conf"' '-DP11_SYSTEM_CONFIG_MODULES="/etc/pkcs11/modules"' '-DP11_PACKAGE_CONFIG_MODULES="/usr/share/p11-kit/modules"' '-DP11_USER_CONFIG_FILE="~/.config/pkcs11/pkcs11.conf"' '-DP11_USER_CONFIG_MODULES="~/.config/pkcs11/modules"' '-DP11_MODULE_PATH="/usr/lib/pkcs11"' -MD -MQ p11-kit/p11-kit.p/import-object.c.o -MF p11-kit/p11-kit.p/import-object.c.o.d -o p11-kit/p11-kit.p/import-object.c.o -c ../../p11-kit/import-object.c
../../p11-kit/import-object.c: In function 'add_attrs_pubkey_rsa':
../../p11-kit/import-object.c:223:62: error: passing argument 3 of 'p11_asn1_read' from incompatible pointer type [-Wincompatible-pointer-types]
  223 |         attr_modulus.pValue = p11_asn1_read (asn, "modulus", &attr_modulus.ulValueLen);
      |                                                              ^~~~~~~~~~~~~~~~~~~~~~~~
      |                                                              |
      |                                                              long unsigned int *
In file included from ../../p11-kit/import-object.c:53:
../../common/asn1.h:60:62: note: expected 'size_t *' {aka 'unsigned int *'} but argument is of type 'long unsigned int *'
   60 |                                                      size_t *length);
      |                                                      ~~~~~~~~^~~~~~
../../p11-kit/import-object.c:229:70: error: passing argument 3 of 'p11_asn1_read' from incompatible pointer type [-Wincompatible-pointer-types]
  229 |         attr_exponent.pValue = p11_asn1_read (asn, "publicExponent", &attr_exponent.ulValueLen);
      |                                                                      ^~~~~~~~~~~~~~~~~~~~~~~~~
      |                                                                      |
      |                                                                      long unsigned int *
../../common/asn1.h:60:62: note: expected 'size_t *' {aka 'unsigned int *'} but argument is of type 'long unsigned int *'
   60 |                                                      size_t *length);
      |                                                      ~~~~~~~~^~~~~~
../../p11-kit/import-object.c: In function 'add_attrs_pubkey_ec':
../../p11-kit/import-object.c:264:78: error: passing argument 3 of 'p11_asn1_read' from incompatible pointer type [-Wincompatible-pointer-types]
  264 |         attr_ec_params.pValue = p11_asn1_read (info, "algorithm.parameters", &attr_ec_params.ulValueLen);
      |                                                                              ^~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                                                              |
      |                                                                              long unsigned int *
../../common/asn1.h:60:62: note: expected 'size_t *' {aka 'unsigned int *'} but argument is of type 'long unsigned int *'
   60 |                                                      size_t *length);
      |                                                      ~~~~~~~~^~~~~~
ueno commented 2 months ago

This is #608 (fixed by #609), though apparently we haven't made any new release since then.

dschepler commented 2 months ago

OK, sorry for the duplicate. I had tried looking at recent issues including the closed ones, but I guess I didn't look far enough down the list.