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

passing argument 2 of ‘Fapi_SetAuthCB’ from incompatible pointer type [-Werror=incompatible-pointer-types] #3408

Open
wydxyreh opened this issue Jun 19, 2024 · 1 comment

Comments

@wydxyreh
Copy link

I tried to build tpm2-tss and tpm2-tools nowadays, but I failed when I tried to run make in tpm2-tools:

tools/fapi/tss2_template.c: In function ‘main’:
tools/fapi/tss2_template.c:524:39: error: passing argument 2 of ‘Fapi_SetAuthCB’ from incompatible pointer type [-Werror=incompatible-pointer-types]
  524 |     TSS2_RC r = Fapi_SetAuthCB (fctx, auth_callback, NULL);
      |                                       ^~~~~~~~~~~~~
      |                                       |
      |                                       TSS2_RC (*)(FAPI_CONTEXT *, const char *, char **, void *) {aka unsigned int (*)(FAPI_CONTEXT *, const char *, char **, void *)}
In file included from ./tools/fapi/tss2_template.h:6,
                 from tools/fapi/tss2_template.c:22:
/usr/local/include/tss2/tss2_fapi.h:689:21: note: expected ‘Fapi_CB_Auth’ {aka ‘unsigned int (*)(const char *, const char *, const char **, void *)’} but argument is of type ‘TSS2_RC (*)(FAPI_CONTEXT *, const char *, char **, void *)’ {aka ‘unsigned int (*)(FAPI_CONTEXT *, const char *, char **, void *)’}
  689 |     Fapi_CB_Auth    callback,
      |     ~~~~~~~~~~~~~~~~^~~~~~~~
tools/fapi/tss2_template.c:531:31: error: passing argument 2 of ‘Fapi_SetSignCB’ from incompatible pointer type [-Werror=incompatible-pointer-types]
  531 |     r = Fapi_SetSignCB (fctx, sign_callback, NULL);
      |                               ^~~~~~~~~~~~~
      |                               |
      |                               TSS2_RC (*)(FAPI_CONTEXT *, const char *, const char *, const char *, uint32_t,  const uint8_t *, size_t,  uint8_t **, size_t *, void *) {aka unsigned int (*)(FAPI_CONTEXT *, const char *, const char *, const char *, unsigned int,  const unsigned char *, long unsigned int,  unsigned char **, long unsigned int *, void *)}
In file included from ./tools/fapi/tss2_template.h:6,
                 from tools/fapi/tss2_template.c:22:
/usr/local/include/tss2/tss2_fapi.h:719:21: note: expected ‘Fapi_CB_Sign’ {aka ‘unsigned int (*)(const char *, const char *, const char *, const char *, unsigned int,  const unsigned char *, long unsigned int,  const unsigned char **, long unsigned int *, void *)’} but argument is of type ‘TSS2_RC (*)(FAPI_CONTEXT *, const char *, const char *, const char *, uint32_t,  const uint8_t *, size_t,  uint8_t **, size_t *, void *)’ {aka ‘unsigned int (*)(FAPI_CONTEXT *, const char *, const char *, const char *, unsigned int,  const unsigned char *, long unsigned int,  unsigned char **, long unsigned int *, void *)’}
  719 |     Fapi_CB_Sign    callback,
      |     ~~~~~~~~~~~~~~~~^~~~~~~~
tools/fapi/tss2_template.c:538:33: error: passing argument 2 of ‘Fapi_SetBranchCB’ from incompatible pointer type [-Werror=incompatible-pointer-types]
  538 |     r = Fapi_SetBranchCB (fctx, branch_callback, NULL);
      |                                 ^~~~~~~~~~~~~~~
      |                                 |
      |                                 TSS2_RC (*)(FAPI_CONTEXT *, const char *, const char **, size_t,  size_t *, void *) {aka unsigned int (*)(FAPI_CONTEXT *, const char *, const char **, long unsigned int,  long unsigned int *, void *)}
In file included from ./tools/fapi/tss2_template.h:6,
                 from tools/fapi/tss2_template.c:22:
/usr/local/include/tss2/tss2_fapi.h:702:21: note: expected ‘Fapi_CB_Branch’ {aka ‘unsigned int (*)(const char *, const char *, const char **, long unsigned int,  long unsigned int *, void *)’} but argument is of type ‘TSS2_RC (*)(FAPI_CONTEXT *, const char *, const char **, size_t,  size_t *, void *)’ {aka ‘unsigned int (*)(FAPI_CONTEXT *, const char *, const char **, long unsigned int,  long unsigned int *, void *)’}
  702 |     Fapi_CB_Branch  callback,
      |     ~~~~~~~~~~~~~~~~^~~~~~~~

this is my step

# get from github
git clone https://github.com/tpm2-software/tpm2-tss.git

pushd tpm2-tss
# Building From Source
# Install dependencies using dnf (RHEL, Fedora)
sudo dnf -y install libtasn1-devel expect socat python3-twisted fuse-devel glib2-devel gnutls-devel gnutls-utils gnutls json-glib-devel
sudo ./bootstrap
sudo ./configure
sudo make -j$(nproc)
#sudo make -j$(nproc) check
sudo make install
popd

# get from github
git clone https://github.com/tpm2-software/tpm2-tools.git

pushd tpm2-tools
# Building From Source
# Install dependencies using dnf (RHEL, Fedora)
sudo ./bootstrap
sudo ./configure
sudo make -j$(nproc)  # failed here
sudo make install
popd

I searched this issue in tpm2-tools, and I find someone met the similar issue with me #1998. But I find those bugs should be fixed long time ago. I'm confused, can you help me?

@JuergenReppSIT
Copy link
Member

JuergenReppSIT commented Jun 19, 2024

You could try:
make -j 'CFLAGS=-H' 2>&1 | grep fapi
to check what fapi header file is used and to check the type of *Fapi_CB_Auth in this file.

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