wolfSSL / wolfTPM

wolfTPM is a highly portable TPM 2.0 library, designed for embedded use.
https://www.wolfssl.com
GNU General Public License v2.0
232 stars 56 forks source link

Unable to compile both latest release and git version #64

Closed XF-CSM closed 5 years ago

XF-CSM commented 5 years ago

Hello, wolfSSL Team! I am a master student and a beginner of this wolfTPM project. I am trying to compile the latest release version of this project. However, my GCC compiler yields the following error.

pi@raspi-fx:~/Software/wolfTPM-1.5 $ make
make -j5  all-am
make[1]: Entering directory '/home/pi/Software/wolfTPM-1.5'
  CC       src/src_libwolftpm_la-tpm2_wrap.lo
  CC       examples/csr/csr.o
src/tpm2_wrap.c: In function ‘wolfTPM2_CryptoDevCb’:
src/tpm2_wrap.c:2887:28: error: ‘WC_ALGO_TYPE_RNG’ undeclared (first use in this function)
     if (info->algo_type == WC_ALGO_TYPE_RNG) {
                            ^~~~~~~~~~~~~~~~
src/tpm2_wrap.c:2887:28: note: each undeclared identifier is reported only once for each function it appears in
src/tpm2_wrap.c:2892:50: error: ‘wc_CryptoInfo {aka struct wc_CryptoInfo}’ has no member named ‘rng’
         rc = wolfTPM2_GetRandom(tlsCtx->dev, info->rng.out, info->rng.sz);
                                                  ^~
src/tpm2_wrap.c:2892:65: error: ‘wc_CryptoInfo {aka struct wc_CryptoInfo}’ has no member named ‘rng’
         rc = wolfTPM2_GetRandom(tlsCtx->dev, info->rng.out, info->rng.sz);
                                                                 ^~
src/tpm2_wrap.c:3132:17: error: ‘wc_CryptoInfo {aka struct wc_CryptoInfo}’ has no member named ‘hash’
         if (info->hash.type != WC_HASH_TYPE_SHA &&
                 ^~
src/tpm2_wrap.c:3133:17: error: ‘wc_CryptoInfo {aka struct wc_CryptoInfo}’ has no member named ‘hash’
             info->hash.type != WC_HASH_TYPE_SHA256) {
                 ^~
src/tpm2_wrap.c:3249:33: error: ‘WC_ALGO_TYPE_HMAC’ undeclared (first use in this function)
     else if (info->algo_type == WC_ALGO_TYPE_HMAC) {
                                 ^~~~~~~~~~~~~~~~~
src/tpm2_wrap.c:3258:17: error: ‘wc_CryptoInfo {aka struct wc_CryptoInfo}’ has no member named ‘hmac’
         if (info->hmac.macType != WC_HASH_TYPE_SHA &&
                 ^~
src/tpm2_wrap.c:3259:17: error: ‘wc_CryptoInfo {aka struct wc_CryptoInfo}’ has no member named ‘hmac’
             info->hmac.macType != WC_HASH_TYPE_SHA256) {
                 ^~
src/tpm2_wrap.c:3262:17: error: ‘wc_CryptoInfo {aka struct wc_CryptoInfo}’ has no member named ‘hmac’
         if (info->hmac.hmac == NULL) {
                 ^~
src/tpm2_wrap.c: In function ‘wolfTPM2_ClearCryptoDevCb’:
src/tpm2_wrap.c:3383:9: warning: implicit declaration of function ‘wc_CryptoCb_UnRegisterDevice’ [-Wimplicit-function-declaration]
         wc_CryptoCb_UnRegisterDevice(devId);
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/tpm2_wrap.c:3383:9: warning: nested extern declaration of ‘wc_CryptoCb_UnRegisterDevice’ [-Wnested-externs]
Makefile:1197: recipe for target 'src/src_libwolftpm_la-tpm2_wrap.lo' failed
make[1]: *** [src/src_libwolftpm_la-tpm2_wrap.lo] Error 1
make[1]: Leaving directory '/home/pi/Software/wolfTPM-1.5'
Makefile:841: recipe for target 'all' failed
make: *** [all] Error 2

I am running these codes on a Raspberry Pi 3, with the latest stable Raspbian installed. An SLB9670 module is attached to GPIO. The latest stable WolfSSL has been successfully installed. I am just following the official tutorial https://github.com/wolfSSL/wolfTPM with exactly the same bash commands. My GCC version is (Raspbian 6.3.0-18+rpi1+deb9u1) 6.3.0 20170516.

Thank you in advance and have a nice day.

dgarske commented 5 years ago

Hi SherlyFU,

The latest wolfTPM v1.5 release requires using a wolfSSL GitHub master commit at or after PR https://github.com/wolfSSL/wolfssl/pull/2070.

The errors you are seeing are for the TLS examples, which require some newer wolfCrypt Crypto Callback features that are only in GitHub master. We should be doing another wolfSSL release soon, which will include these.

Thanks, David Garske, wolfSSL