tpm2-software / tpm2-tss-engine

OpenSSL Engine for TPM2 devices
https://tpm2-software.github.io
BSD 3-Clause "New" or "Revised" License
150 stars 100 forks source link

Error building tpm2-tss-engine on ubuntu 22.04 LTS / Raspberry PI 4 #269

Closed phaus closed 1 year ago

phaus commented 1 year ago

I followed the instructions from here to install the openssl-engine.

I tried both, the most recent master, but also Tag 1.2.0.

I am able to complete all steps until the compilation of tpm2-tss-engine. I got a linking error that looks like the compilation tries to bind against wrong openssl dev libs:

# ./configure
…
configure: creating ./config.status
config.status: creating Makefile
config.status: creating src/config.h
config.status: src/config.h is unchanged
config.status: executing depfiles commands
config.status: executing libtool commands

tpm2-tss-engine 1.2.0
    man-pages:      /usr/bin/pandoc
    enginesdir:     /usr/lib/aarch64-linux-gnu/engines-3
    completionsdir: /usr/share/bash-completion/completions
    device:

# make -j$(nproc)
  GEN      man/man1/tpm2tss-genkey.1
  GEN      man/man3/tpm2tss_tpm2data_write.3
  GEN      man/man3/tpm2tss_rsa_makekey.3
  GEN      man/man3/tpm2tss_rsa_genkey.3
  GEN      man/man3/tpm2tss_ecc_makekey.3
  GEN      man/man3/tpm2tss_ecc_genkey.3
  GEN      man/man3/tpm2tss_ecc_getappdata.3
  GEN      man/man3/tpm2tss_tpm2data_read.3
  CCLD     tpm2tss-genkey
  GEN      man/man3/tpm2tss_ecc_setappdata.3
/usr/bin/ld: /usr/local/lib/libtss2-esys.so: undefined reference to `Tss2_Sys_MAC_Prepare'
/usr/bin/ld: /usr/local/lib/libtss2-esys.so: undefined reference to `Tss2_Sys_MAC_Complete'
/usr/bin/ld: /usr/local/lib/libtss2-esys.so: undefined reference to `Tss2_Sys_MAC_Start_Prepare'
/usr/bin/ld: /usr/local/lib/libtss2-esys.so: undefined reference to `Tss2_Sys_MAC_Start_Complete'
collect2: error: ld returned 1 exit status
make: *** [Makefile:1087: tpm2tss-genkey] Error 1

My OpenSSL Version is:

# openssl version
OpenSSL 3.0.2 15 Mar 2022 (Library: OpenSSL 3.0.2 15 Mar 2022)
jenguidanos commented 1 year ago

+1

# make -j$(nproc)
make: Warning: File 'test/.deps/tpm2_tss_engine_common-tpm2-tss-engine-common.Po' has modification time 3010 s in the future
  CCLD     tpm2tss-genkey
/usr/bin/ld: /usr/local/lib/libtss2-esys.so: undefined reference to `Tss2_Sys_MAC_Start_Complete'
/usr/bin/ld: /usr/local/lib/libtss2-esys.so: undefined reference to `Tss2_Sys_ACT_SetTimeout_Complete'
/usr/bin/ld: /usr/local/lib/libtss2-esys.so: undefined reference to `Tss2_Sys_CertifyX509_Prepare'
/usr/bin/ld: /usr/local/lib/libtss2-esys.so: undefined reference to `Tss2_Sys_MAC_Start_Prepare'
/usr/bin/ld: /usr/local/lib/libtss2-esys.so: undefined reference to `Tss2_Sys_MAC_Prepare'
/usr/bin/ld: /usr/local/lib/libtss2-esys.so: undefined reference to `Tss2_Sys_CertifyX509_Complete'
/usr/bin/ld: /usr/local/lib/libtss2-esys.so: undefined reference to `Tss2_Sys_ACT_SetTimeout_Prepare'
/usr/bin/ld: /usr/local/lib/libtss2-esys.so: undefined reference to `Tss2_Sys_MAC_Complete'
collect2: error: ld returned 1 exit status
make: *** [Makefile:1087: tpm2tss-genkey] Error 1

Running Raspbian GNU/Linux 11 (bullseye) with OpenSSL 1.1.1n 15 Mar 2022. Installed apt dependencies and compiled tpm2-tss

jenguidanos commented 1 year ago

I solved the problem by removing the libtss2-esys-3.0.2-0 package. Now is working:

openssl rand -engine tpm2tss -hex 10
engine "tpm2tss" set.
337384b378a68995e379
AndreasFuchsTPM commented 1 year ago

Thank you