liuqun / tpm2-ibmswtpm

Ubuntu snap package for IBM's software TPM 2.0 simulator
2 stars 3 forks source link

Faild to build ibmtpm974 on 32bit x86 and arm platform #1

Closed liuqun closed 6 years ago

liuqun commented 6 years ago

Hardware: Raspberry Pi 3B OS: Ubuntu mate for Raspberry Pi Error message:

/usr/bin/gcc -Wall -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Werror -Wsign-compare -c -ggdb -O0 -DTPM_POSIX -D_POSIX_ -I../utils -I. Attest_spt.c -o Attest_spt.o
In file included from BnValues.h:281:0,
                 from Global.h:84,
                 from Tpm.h:71,
                 from Attest_spt.c:62:
TpmToOsslMath.h:79:4: error: #error "Ossl library is using different radix"
 #  error "Ossl library is using different radix"
    ^
In file included from BnValues.h:281:0,
                 from Global.h:84,
                 from Tpm.h:71,
                 from AlgorithmTests.c:66:
TpmToOsslMath.h:79:4: error: #error "Ossl library is using different radix"
 #  error "Ossl library is using different radix"
    ^
In file included from BnValues.h:281:0,
                 from Global.h:84,
                 from Tpm.h:71,
                 from AlgorithmCap.c:67:
TpmToOsslMath.h:79:4: error: #error "Ossl library is using different radix"
 #  error "Ossl library is using different radix"
    ^
In file included from BnValues.h:281:0,
                 from Global.h:84,
                 from Tpm.h:71,
                 from AsymmetricCommands.c:62:
TpmToOsslMath.h:79:4: error: #error "Ossl library is using different radix"
 #  error "Ossl library is using different radix"
    ^
makefile:79: recipe for target 'AlgorithmCap.o' failed
make: *** [AlgorithmCap.o] Error 1
liuqun commented 6 years ago

Hardware: x86 VMWare OS: Ubuntu Mate 16.04.3-desktop i386

/usr/bin/gcc -Wall -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Werror -Wsign-compare -c -ggdb -O0 -DTPM_POSIX -D_POSIX_ -I../utils -I. AlgorithmCap.c -o AlgorithmCap.o
In file included from BnValues.h:281:0,
                 from Global.h:84,
                 from Tpm.h:71,
                 from AlgorithmCap.c:67:
TpmToOsslMath.h:79:4: error: #error "Ossl library is using different radix"
 #  error "Ossl library is using different radix"
    ^
makefile:79: recipe for target 'AlgorithmCap.o' failed
liuqun commented 6 years ago

Reference:

For 32 bit i386 and Raspberry Pi, you must change RADIX_BITS defined in "ibmtpm974.tar.gz/./src/Implementation.h"

Raspian is 32-bit (at least its openssl is 32-bit) while the TPM crypto defaults to 64-bit. For Raspian, change Implementation.h RADIX_BITS from 64 to 32.

#ifdef TPM_POSIX
#define  RADIX_BITS                     32
liuqun commented 6 years ago

This is a sample patch that works for 32 bit system:

https://github.com/stefanberger/libtpms/commit/33c1f3c3c40e307663359a3505fc52cdaf311fd8 tpm2: Make RADIX_BITS dependent on openssl