Project

General

Profile

Bug #2567

libtpmtss compile issue

Added by Nicolai Kuntze over 2 years ago. Updated over 1 year ago.

Status:
Closed
Priority:
Normal
Category:
build
Target version:
Start date:
Due date:
Estimated time:
Affected version:
5.6.2
Resolution:
Fixed

Description

Hi,

I have some issues compiling libtpmtss together with the recent version of the TSS 2.0. I already adjusted the #include <tpm20.h> to #include <sapi/tpm20.h>, reflecting the changes in the TSS includes location.

Best regards,
Nicolai

make[5]: Entering directory '/home/pi/StrongSwan/strongswan/src/libtpmtss'
depbase=`echo tpm_tss_tss2.lo | sed 's|[^/]*$|.deps/&|;s|\.lo$||'`;\
/bin/bash ../../libtool  --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I. -I../..  -I../../src/libstrongswan  -I/usr/local/include -g -O2 -Wall -Wno-format -Wno-format-security -Wno-pointer-sign -include /home/pi/StrongSwan/strongswan/config.h -MT tpm_tss_tss2.lo -MD -MP -MF $depbase.Tpo -c -o tpm_tss_tss2.lo tpm_tss_tss2.c &&\
mv -f $depbase.Tpo $depbase.Plo
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I../.. -I../../src/libstrongswan -I/usr/local/include -g -O2 -Wall -Wno-format -Wno-format-security -Wno-pointer-sign -include /home/pi/StrongSwan/strongswan/config.h -MT tpm_tss_tss2.lo -MD -MP -MF .deps/tpm_tss_tss2.Tpo -c tpm_tss_tss2.c  -fPIC -DPIC -o .libs/tpm_tss_tss2.o
tpm_tss_tss2.c:70:2: error: unknown type name ‘TPM_ALG_ID’
  TPM_ALG_ID supported_algs[TPM_PT_ALGORITHM_SET];
  ^~~~~~~~~~
tpm_tss_tss2.c:70:28: error: ‘TPM_PT_ALGORITHM_SET’ undeclared here (not in a function)
  TPM_ALG_ID supported_algs[TPM_PT_ALGORITHM_SET];
                            ^~~~~~~~~~~~~~~~~~~~
tpm_tss_tss2.c:87:8: error: unknown type name ‘TPM_ALG_ID’
 static TPM_ALG_ID hash_alg_to_tpm_alg_id(hash_algorithm_t alg)
        ^~~~~~~~~~
tpm_tss_tss2.c: In function ‘hash_alg_to_tpm_alg_id’:
tpm_tss_tss2.c:92:11: error: ‘TPM_ALG_SHA1’ undeclared (first use in this function)
    return TPM_ALG_SHA1;

[omitted rest of output]

History

#1 Updated by Tobias Brunner over 2 years ago

  • Description updated (diff)
  • Status changed from New to Feedback

I have some issues compiling libtpmtss together with the recent version of the TSS 2.0.

I guess you are not building against a release (1.3.0 respectively 1.4.0-rc1 seem to be the latest) or the 1.x branch, but the master branch.

I already adjusted the #include <tpm20.h> to #include <sapi/tpm20.h>, reflecting the changes in the TSS includes location.

Looks like that was caused by this commit. Didn't you also have to change the tcti_socket.h include?

I'm not sure, but it might also be necessary to check for the sapi package as the tcti-socket package, for which the configure script does a lookup, does not have a dependency on it anymore (since), only on the new marshal package, which in turn does not have a dependency on the sapi package (but it actually seems to incorrectly be named sapi, although, that's only the human-readable name, so it probably doesn't really matter).

tpm_tss_tss2.c:70:2: error: unknown type name ‘TPM_ALG_ID’
  TPM_ALG_ID supported_algs[TPM_PT_ALGORITHM_SET];
  ^~~~~~~~~~

This and the rest of the errors are caused by this commit, that is, the TPM_ prefix has to be replaced with TPM2_ where appropriate.

It looks like the current code is compatible with 1.x of tpm2-tss. Being compatible with the current master and 1.x will be quite ugly as it would require a lot of redefined constants/types. So abandoning backwards compatibility would definitely be easier. Not sure what Andreas' preference is.

#2 Updated by Tobias Brunner over 1 year ago

  • Tracker changed from Issue to Bug
  • Category set to build
  • Status changed from Feedback to Closed
  • Assignee set to Andreas Steffen
  • Target version set to 5.7.0
  • Resolution set to Fixed

Support for the newer versions of the SAPI provided by tpm2-tss 2.x was added with 5.7.0 (e74e920bbcec).

Also available in: Atom PDF