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

Windows and Linux build fails #46

Closed
mwyborski opened this issue Apr 7, 2020 · 2 comments
Closed

Windows and Linux build fails #46

mwyborski opened this issue Apr 7, 2020 · 2 comments

Comments

@mwyborski
Copy link

Compiling on windows failed, because i haven't found a compatible libcrypto. Can you please point me to a version that is known to work?

Also compiling on Ubuntu 19.10 failed:

gcc -std=gnu11 -Werror -Wall -Wformat-security -fstack-protector-all -fPIC -Wno-error=empty-body -Wno-error=expansion-to-defined -Wno-error=parentheses -Wno-error=pointer-to-int-cast -Wno-error=missing-braces -Wno-error=unused-result -I ./Platform/include -I ./Platform/include/prototypes -I ./tpm/include -I ./tpm/include/prototypes -I ./Simulator/include -I ./Simulator/include/prototypes  -pthread -g -O2   -o Simulator/src/tpm2-simulator Simulator/src/tpm2_simulator-TPMCmdp.o Simulator/src/tpm2_simulator-TPMCmds.o Simulator/src/tpm2_simulator-TcpServer.o  Platform/src/libplatform.a tpm/src/libtpm.a Platform/src/libplatform.a -lcrypto   
/usr/bin/ld: tpm/src/libtpm.a(libtpm_a-CryptSym.o): in function `CryptSymmetricEncrypt':
/home/marek/git/ms-tpm-20-ref/TPMCmd/tpm/src/crypt/CryptSym.c:190: undefined reference to `SM4_set_key'
/usr/bin/ld: /home/marek/git/ms-tpm-20-ref/TPMCmd/tpm/src/crypt/CryptSym.c:190: undefined reference to `SM4_encrypt'
/usr/bin/ld: tpm/src/libtpm.a(libtpm_a-CryptSym.o): in function `CryptSymmetricDecrypt':
/home/marek/git/ms-tpm-20-ref/TPMCmd/tpm/src/crypt/CryptSym.c:363: undefined reference to `SM4_set_key'
/usr/bin/ld: /home/marek/git/ms-tpm-20-ref/TPMCmd/tpm/src/crypt/CryptSym.c:363: undefined reference to `SM4_encrypt'
/usr/bin/ld: /home/marek/git/ms-tpm-20-ref/TPMCmd/tpm/src/crypt/CryptSym.c:358: undefined reference to `SM4_set_key'
/usr/bin/ld: /home/marek/git/ms-tpm-20-ref/TPMCmd/tpm/src/crypt/CryptSym.c:358: undefined reference to `SM4_decrypt'
/usr/bin/ld: tpm/src/libtpm.a(libtpm_a-CryptHash.o):/home/marek/git/ms-tpm-20-ref/TPMCmd/tpm/src/crypt/CryptHash.c:62: undefined reference to `sm3_init'
/usr/bin/ld: tpm/src/libtpm.a(libtpm_a-CryptHash.o):(.data.rel.ro+0x8): undefined reference to `sm3_update'
/usr/bin/ld: tpm/src/libtpm.a(libtpm_a-CryptHash.o):(.data.rel.ro+0x10): undefined reference to `sm3_final'
/usr/bin/ld: tpm/src/libtpm.a(libtpm_a-CryptCmac.o): in function `CryptCmacData':
/home/marek/git/ms-tpm-20-ref/TPMCmd/tpm/src/crypt/CryptCmac.c:104: undefined reference to `SM4_set_key'
/usr/bin/ld: /home/marek/git/ms-tpm-20-ref/TPMCmd/tpm/src/crypt/CryptCmac.c:104: undefined reference to `SM4_encrypt'
/usr/bin/ld: tpm/src/libtpm.a(libtpm_a-CryptCmac.o): in function `CryptCmacEnd':
/home/marek/git/ms-tpm-20-ref/TPMCmd/tpm/src/crypt/CryptCmac.c:144: undefined reference to `SM4_set_key'
/usr/bin/ld: /home/marek/git/ms-tpm-20-ref/TPMCmd/tpm/src/crypt/CryptCmac.c:144: undefined reference to `SM4_encrypt'
collect2: error: ld returned 1 exit status
make: *** [Makefile:2174: Simulator/src/tpm2-simulator] Fehler 1
@amarochk
Copy link
Contributor

1.1.1d or any stable 1.1.1 version should work. I've updated readme.md with OpenSSL build instructions.

As for the Linux, what is the value of OPENSSL_VERSION_NUMBER? Most likely the binary OpenSSL module was built with no SM support, but the opensslconf.h does not have OPENSSL_NO_SM4...

You can also disable SM4 in the reference implementation by setting ALG_SM4 to ALG_NO in TpmProfile.h.

@mwyborski
Copy link
Author

@amarochk thank you very much for your help!

I was able to compile it now on Linux.

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